protected void ddlDay_SelectedIndexChanged(object sender, EventArgs e) { JiaJiao.BLL.Class c = new BLL.Class(); clist = c.GetModelList(""); this.ddlTime.DataSource = clist.Where(d => d.Day==ddlDay.SelectedValue) ; this.ddlTime.DataBind(); }
private void AddData(HttpContext context) { var classModel = new Models.Class(); SetModelValue(classModel, context); classModel.CreatedTime = DateTime.Now; var classBll = new BLL.Class(); var result = false; var msg = ""; try { result = classBll.Add(classModel); if (!result) { msg = "保存失败!"; } } catch (Exception ex) { LogHelper.WriteLogofExceptioin(ex); result = false; msg = ex.Message; } // var str = JsonConvert.SerializeObject(new { success = result, errorMsg = msg}); context.Response.Write(msg); }
public static int GetClassIdByName(string collegeName, string majorName, string className) { int majorId = GetMajorIdByName(collegeName, majorName); if (majorId > 0) { var list = new BLL.Class().GetModelList(" Name= '" + className + "'" + " and MajorId= " + majorId); return list.Count > 0 ? list[0].Id : -1; } else { return -1; } }
private void ShowInfo(int ID) { JiaJiao.BLL.ClassSetting bll = new JiaJiao.BLL.ClassSetting(); JiaJiao.Model.ClassSetting model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.lblTotal.Text = model.Total.ToString(); this.lblCount.Text = model.Count.ToString(); JiaJiao.BLL.Class bll1 = new BLL.Class(); var model1 = bll1.GetModel(model.DayId.Value); JiaJiao.BLL.Teacher bll2 = new BLL.Teacher(); var model2 = bll2.GetModel(model.TeacherId); this.lblDayId.Text = model1.Day + " " + model1.Time ; this.lblTeacherId.Text = model2.TeacherName; }
private void DelData(string id, HttpContext context) { var courBll = new BLL.Class(); var result = false; var msg = ""; try { result = courBll.Delete(int.Parse(id)); if (!result) { msg = "保存失败!"; } } catch (Exception ex) { LogHelper.WriteLogofExceptioin(ex); result = false; msg = ex.Message; } // var str = JsonConvert.SerializeObject(new { success = result, errorMsg = msg}); context.Response.Write(msg); }
private DataSet QueryDataResultForExp(HttpContext context) { var name = context.Request["Name"].Trim(); var description = context.Request["Description"].Trim(); var area = context.Request["Area"].Trim(); var type = context.Request["Type"].Trim(); var ds = new DataSet(); var classBll = new BLL.Class(); var strWhere = ""; if (!string.IsNullOrEmpty(name)) { strWhere = string.Format(" Name like '%" + name + "%' "); } if (!string.IsNullOrEmpty(description)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Description like '%" + description + "%' "); } else { strWhere = string.Format(" Description like '%" + description + "%' "); } } if (!string.IsNullOrEmpty(area)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Area like '%" + area + "%' "); } else { strWhere = string.Format(" Area like '%" + area + "%' "); } } if (!string.IsNullOrEmpty(type)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Type like '%" + type + "%' "); } else { strWhere = string.Format(" Type like '%" + type + "%' "); } } ds = classBll.GetDataForExport(strWhere); return ds; }
private void Query(HttpContext context) { var name = context.Request["Name"].Trim(); var description = context.Request["Description"].Trim(); var area = context.Request["Area"].Trim(); var type = context.Request["Type"].Trim(); var ds = new DataSet(); var classBll = new BLL.Class(); var strWhere = ""; if (!string.IsNullOrEmpty(name)) { strWhere = string.Format(" Name like '%" + name + "%' "); } if (!string.IsNullOrEmpty(description)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Description like '%" + description + "%' "); } else { strWhere = string.Format(" Description like '%" + description + "%' "); } } if (!string.IsNullOrEmpty(area)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Area like '%" + area + "%' "); } else { strWhere = string.Format(" Area like '%" + area + "%' "); } } if (!string.IsNullOrEmpty(type)) { if (!string.IsNullOrEmpty(strWhere)) { strWhere += string.Format(" and Type like '%" + type + "%' "); } else { strWhere = string.Format(" Type like '%" + type + "%' "); } } var page = Convert.ToInt32(context.Request["page"]); var rows = Convert.ToInt32(context.Request["rows"]); var sort = string.IsNullOrEmpty(context.Request["sort"]) ? "Name" : context.Request["sort"]; var order = string.IsNullOrEmpty(context.Request["order"]) ? "asc" : context.Request["order"]; var startIndex = (page - 1)*rows + 1; var endIndex = startIndex + rows - 1; var num = classBll.GetRecordCount(strWhere); ds = classBll.GetListByPage(strWhere, sort, startIndex, endIndex,order); var str = JsonConvert.SerializeObject(new {total = num, rows = ds.Tables[0]}); context.Response.Write(str); }
private void GetDataForCombobox(HttpContext context) { var ds = new DataSet(); var couBll = new BLL.Class(); ds = couBll.GetAllList(); // [{"SUBITEM_VALUE":"1","SUBITEM_NAME":"男"},{"SUBITEM_VALUE":"2","SUBITEM_NAME":"女"}] if (ds != null && ds.Tables.Count > 0) { var str = new StringBuilder("["); foreach (DataRow row in ds.Tables[0].Rows) { str.Append("{\"CourseId\": \"" + row["CourseId"] + "\","); str.Append("\"CourseName\": \"" + row["CourseName"] + "\"},"); } str.Remove(str.Length - 1, 1); str.Append("]"); context.Response.Write(str.ToString()); } // var str = JsonConvert.SerializeObject(new { total = ds.Tables[0].Rows.Count, rows = ds.Tables[0] }); }
private string GetData(HttpContext context) { var ds = new DataSet(); var classBll = new BLL.Class(); var page = Convert.ToInt32(context.Request["page"]); var rows = Convert.ToInt32(context.Request["rows"]); var sort = string.IsNullOrEmpty(context.Request["sort"]) ? "Name" : context.Request["sort"]; var order = string.IsNullOrEmpty(context.Request["order"]) ? "desc" : context.Request["order"]; var startIndex = (page - 1) * rows + 1; var endIndex = startIndex + rows - 1; var num = classBll.GetRecordCount(""); ds = classBll.GetListByPage("", sort, startIndex, endIndex, order); var str = JsonConvert.SerializeObject(new { total = num, rows = ds.Tables[0] }); return str; }
private void EditData(string id, HttpContext context) { var classBll = new BLL.Class(); var classModel = classBll.GetModel(int.Parse(id)); //courModel. = DateTime.Now; var result = false; var msg = ""; try { SetModelValue(classModel, context); result = classBll.Update(classModel); if (!result) { msg = "保存失败!"; } } catch (Exception ex) { LogHelper.WriteLogofExceptioin(ex); result = false; msg = ex.Message; } // var str = JsonConvert.SerializeObject(new { success = result, errorMsg = msg}); context.Response.Write(msg); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { txtCount.Text = "0"; JiaJiao.BLL.Teacher t = new BLL.Teacher(); var ds = t.GetAllList(); this.ddlTeacher.DataSource = ds.Tables[0]; this.ddlTeacher.DataBind(); JiaJiao.BLL.Class c = new BLL.Class(); clist= c.GetModelList(""); this.ddlDay.DataSource = clist.GroupBy(d => d.Day).Select(g => g.Key) ; this.ddlDay.DataBind(); this.ddlTime.DataSource = clist.Where(d => d.Day == "周一"); this.ddlTime.DataBind(); } }
private void ShowInfo(int ID) { JiaJiao.BLL.ClassSetting bll = new JiaJiao.BLL.ClassSetting(); JiaJiao.Model.ClassSetting model = bll.GetModel(ID); this.lblID.Text = model.ID.ToString(); this.txtTotal.Text = model.Total.ToString(); this.txtCount.Text = model.Count.ToString(); JiaJiao.BLL.Class bll1 = new BLL.Class(); var classModel1 = bll1.GetModel(model.DayId.Value); JiaJiao.BLL.Teacher bll2 = new BLL.Teacher(); var teacherModel2 = bll2.GetModel(model.TeacherId); JiaJiao.BLL.Teacher t = new BLL.Teacher(); var ds = t.GetAllList(); this.ddlTeacher.DataSource = ds.Tables[0]; this.ddlTeacher.DataBind(); ddlTeacher.SelectedValue = model.TeacherId.ToString(); JiaJiao.BLL.Class c = new BLL.Class(); var clist = c.GetModelList(""); this.ddlDay.DataSource = clist.GroupBy(d => d.Day).Select(g => g.Key); this.ddlDay.DataBind(); ddlDay.SelectedValue = classModel1.Day; this.ddlTime.DataSource = clist.Where(d => d.Day == classModel1.Day); this.ddlTime.DataBind(); }