private string getClassNumberJson(IList <ClassRecordInfo> classes) { int[,] result = new int[10, 2]; for (int i = 0; i < 10; i++) { result.SetValue(i + 1, i, 0); result.SetValue(0, i, 1); } for (int i = 0; i < classes.Count; i++) { ClassRecordInfo o = classes[i]; int off = DateTime.Now.Day - o.Cla_StartTime.Day; if (off >= 10 | off == 0) { continue; } result.SetValue(Int32.Parse(result.GetValue(off - 1, 1).ToString()) + 1, off - 1, 1); } System.Text.StringBuilder str = new System.Text.StringBuilder("["); for (int i = 0; i < 10; i++) { str.Append("["); for (int j = 0; j < 2; j++) { str.Append(result.GetValue(i, j) + ","); } str.Append("],"); } str.Append("]"); return(str.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { teaid = Request.QueryString["tid"]; teacher = bllTeacher.Get(Convert.ToInt32(teaid)); ImageT.ImageUrl = teacher.Tea_SImage; Tid.Text = teacher.Tea_ID.ToString(); LabelName.Text = teacher.Tea_Name; string act = Request.QueryString["act"]; if (null != act && "check".Equals(act)) { Check(); } HttpCookie cookie = Request.Cookies["usr"]; int stdID = Convert.ToInt32(cookie.Values["ID"]); var classRecord = new ClassRecordInfo(); classRecord.Cla_StartTime = DateTime.Now; classRecord.Cla_EndTime = DateTime.Now; classRecord.Stu_ID = stdID; classRecord.Tea_ID = Convert.ToInt32(teaid); bllClass.Add(classRecord); } }
void IBLL.IClassRecord.Modify(ClassRecordInfo classRecord) { if (classRecord == null) { throw new Exception(); } dal.Modify(classRecord); }
void IBLL.IClassRecord.Remove(ClassRecordInfo classRecord) { if (classRecord == null) { throw new Exception(); } dal.Remove(classRecord); }
void IDAL.IClassRecord.Add(ClassRecordInfo classRecord) { try { DataContext ctx = new DataContext(connection); ITable classRecords = ctx.GetTable <ClassRecordInfo>(); classRecords.InsertOnSubmit(classRecord); ctx.SubmitChanges(); } finally { } }
void IDAL.IClassRecord.Remove(ClassRecordInfo classRecord) { try { DataContext ctx = new DataContext(connection); ITable classRecords = ctx.GetTable <ClassRecordInfo>(); classRecords.Attach(classRecord); classRecords.DeleteOnSubmit(classRecord); ctx.SubmitChanges(); } finally { } }
void IDAL.IClassRecord.Modify(ClassRecordInfo classRecord) { try { DataContext ctx = new DataContext(connection); ITable <ClassRecordInfo> classRecords = ctx.GetTable <ClassRecordInfo>(); IQueryable <ClassRecordInfo> query = from o in classRecords where o.Cla_ID == classRecord.Cla_ID select o; foreach (ClassRecordInfo o in query) { o.Stu_ID = classRecord.Stu_ID; o.Tea_ID = classRecord.Tea_ID; o.Cla_StartTime = classRecord.Cla_StartTime; o.Cla_EndTime = classRecord.Cla_EndTime; } ctx.SubmitChanges(); } finally { } }