188 lines
6.7 KiB
C#
188 lines
6.7 KiB
C#
|
|
using System;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Configuration;
|
|||
|
|
using System.Collections;
|
|||
|
|
using System.Web;
|
|||
|
|
using System.Web.Security;
|
|||
|
|
using System.Web.UI;
|
|||
|
|
using System.Web.UI.WebControls;
|
|||
|
|
using System.Web.UI.WebControls.WebParts;
|
|||
|
|
using System.Web.UI.HtmlControls;
|
|||
|
|
using WeiSha.Common;
|
|||
|
|
using Song.ServiceInterfaces;
|
|||
|
|
using Song.Entities;
|
|||
|
|
using WeiSha.WebControl;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
|
|||
|
|
namespace Song.Site.Manage.Student
|
|||
|
|
{
|
|||
|
|
public partial class Course_Study : Extend.CustomPage
|
|||
|
|
{
|
|||
|
|
private string _uppath = "Course";
|
|||
|
|
Song.Entities.Organization org;
|
|||
|
|
//ѧϰ<D1A7><CFB0>¼<EFBFBD><C2BC>datatable
|
|||
|
|
DataTable dtLog = null;
|
|||
|
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
Song.Entities.Accounts st = this.Master.Account;
|
|||
|
|
if (st == null) return;
|
|||
|
|
org = Business.Do<IOrganization>().OrganCurrent();
|
|||
|
|
dtLog = Business.Do<IStudent>().StudentStudyCourseLog(this.Master.Account.Ac_ID);
|
|||
|
|
if (!this.IsPostBack)
|
|||
|
|
{
|
|||
|
|
BindData(null, null);
|
|||
|
|
}
|
|||
|
|
//<2F><>ҳ<EFBFBD><D2B3><EFBFBD><EFBFBD>ajax<61>ύ<EFBFBD><E1BDBB>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>POST<53><54>ʽ
|
|||
|
|
if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
|
|||
|
|
{
|
|||
|
|
string action = WeiSha.Common.Request.Form["action"].String.ToLower();
|
|||
|
|
string couid = WeiSha.Common.Request.Form["couid"].String.ToLower();
|
|||
|
|
string json = string.Empty;
|
|||
|
|
switch (action)
|
|||
|
|
{
|
|||
|
|
case "getstc":
|
|||
|
|
Song.Entities.Student_Course stc = GetStc(couid);
|
|||
|
|
if (stc == null)
|
|||
|
|
{
|
|||
|
|
json = "{\"success\":\"0\"}";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
json = "{\"success\":\"1\",data:"+stc.ToJson()+"}";
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
Response.Write(json);
|
|||
|
|
Response.End();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
|||
|
|
/// </summary>
|
|||
|
|
protected void BindData(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//<2F><>ǰѧ<C7B0><D1A7><EFBFBD>Ŀγ<C4BF>
|
|||
|
|
Song.Entities.Accounts st = this.Master.Account;
|
|||
|
|
if (st == null) return;
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>Ŀγ<C4BF>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>õģ<C3B5>
|
|||
|
|
List<Song.Entities.Course> cous = Business.Do<ICourse>().CourseForStudent(st.Ac_ID, null, 0,null,-1);
|
|||
|
|
foreach (Song.Entities.Course c in cous)
|
|||
|
|
{
|
|||
|
|
//<2F>γ<EFBFBD>ͼƬ
|
|||
|
|
if (!string.IsNullOrEmpty(c.Cou_LogoSmall) && c.Cou_LogoSmall.Trim() != "")
|
|||
|
|
c.Cou_LogoSmall = Upload.Get[_uppath].Virtual + c.Cou_LogoSmall;
|
|||
|
|
c.Cou_IsStudy = true;
|
|||
|
|
}
|
|||
|
|
rptCourse.DataSource = cous;
|
|||
|
|
rptCourse.DataBind();
|
|||
|
|
plNoCourse.Visible = cous.Count < 1;
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡ<EFBFBD>γ̵Ĺ<CCB5><C4B9><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="id"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
protected string getBuyInfo(object id)
|
|||
|
|
{
|
|||
|
|
int couid = 0;
|
|||
|
|
int.TryParse(id.ToString(), out couid);
|
|||
|
|
Student_Course sc= Business.Do<ICourse>().StudentCourse(Extend.LoginState.Accounts.CurrentUser.Ac_ID, couid);
|
|||
|
|
if (sc == null) return "";
|
|||
|
|
if (sc.Stc_IsFree && sc.Stc_EndTime > sc.Stc_StartTime.AddYears(100)) return "<22><><EFBFBD>ѣ<EFBFBD><D1A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>";
|
|||
|
|
if (sc.Stc_IsFree && sc.Stc_EndTime < sc.Stc_StartTime.AddYears(100)) return string.Format("<22><><EFBFBD>ѵ<EFBFBD>{0}", sc.Stc_EndTime.ToString("yyyy<79><79>M<EFBFBD><4D>d<EFBFBD><64> HH:mm:ss"));
|
|||
|
|
if (sc.Stc_IsTry) return "<22><><EFBFBD><EFBFBD>";
|
|||
|
|
return sc.Stc_StartTime.ToString("yyyy<79><79>MM<4D><4D>dd<64><64>") + " - " + sc.Stc_EndTime.ToString("yyyy<79><79>MM<4D><4D>dd<64><64> HH:mm:ss");
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// ȡ<><C8A1><EFBFBD>γ<EFBFBD>ѧϰ
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
protected void lbSelected_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
LinkButton lb = (LinkButton)sender;
|
|||
|
|
int couid = Convert.ToInt32(lb.CommandArgument); //<2F>γ<EFBFBD>id
|
|||
|
|
Song.Entities.Accounts st = this.Master.Account; //<2F><>ǰѧ<C7B0><D1A7>
|
|||
|
|
//ȡ<><C8A1>
|
|||
|
|
Business.Do<ICourse>().DelteCourseBuy(st.Ac_ID, couid);
|
|||
|
|
//<2F><><EFBFBD>ص<EFBFBD>ǰ<EFBFBD><C7B0>
|
|||
|
|
this.BindData(null, null);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>ѧϰʱ<CFB0><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="studyTime"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
protected string CaleStudyTime(string studyTime)
|
|||
|
|
{
|
|||
|
|
int num = 0;
|
|||
|
|
int.TryParse(studyTime, out num);
|
|||
|
|
if (num < 60) return num + "<22><><EFBFBD><EFBFBD>";
|
|||
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
num = num / 60;
|
|||
|
|
int ss = num % 60;
|
|||
|
|
if (num < 60) return num + "<22><><EFBFBD><EFBFBD>";
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>Сʱ
|
|||
|
|
int hh = num / 60;
|
|||
|
|
int mm = num % 60;
|
|||
|
|
return string.Format("{0}Сʱ{1}<7D><><EFBFBD><EFBFBD>", hh, mm);
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡ<EFBFBD>ۼ<EFBFBD>ѧϰʱ<CFB0><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="studyTime"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
protected string GetstudyTime(string couid)
|
|||
|
|
{
|
|||
|
|
string studyTime = "0";
|
|||
|
|
if (dtLog != null)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow dr in dtLog.Rows)
|
|||
|
|
{
|
|||
|
|
if (dr["Cou_ID"].ToString() == couid)
|
|||
|
|
{
|
|||
|
|
studyTime = dr["studyTime"].ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return CaleStudyTime(studyTime);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return "";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ѧϰʱ<CFB0><CAB1>
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="couid"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
protected string GetLastTime(string couid)
|
|||
|
|
{
|
|||
|
|
DateTime? lastTime = null;
|
|||
|
|
if (dtLog != null)
|
|||
|
|
{
|
|||
|
|
foreach (DataRow dr in dtLog.Rows)
|
|||
|
|
{
|
|||
|
|
if (dr["Cou_ID"].ToString() == couid)
|
|||
|
|
{
|
|||
|
|
lastTime = Convert.ToDateTime(dr["LastTime"]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (lastTime == null) return "<22><><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ѧϰ<D1A7><CFB0>";
|
|||
|
|
return ((DateTime)lastTime).ToString();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// <20><>ȡѧԱѧϰ<D1A7>Ŀγ̼<CEB3>¼
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="couidstr"></param>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
protected Song.Entities.Student_Course GetStc(string couidstr)
|
|||
|
|
{
|
|||
|
|
int couid = 0;
|
|||
|
|
int.TryParse(couidstr, out couid);
|
|||
|
|
return Business.Do<ICourse>().StudentCourse(this.Master.Account.Ac_ID, couid);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|