protected void InitBind(int ID) { LabMS.BLL.Student BStudent = new LabMS.BLL.Student(); List<LabMS.Model.Student> list = new List<LabMS.Model.Student>(); list = BStudent.GetModelList("ID="+ID); textboxCode.Text = list[0].Student_Code; textboxName.Text = list[0].Student_Name; ddlSex.SelectedValue = list[0].Student_Sex;//性别 ddlLJ.SelectedValue = list[0].Student_Grade;//年级 ExtendBLL.Class EClass = new ExtendBLL.Class(); if (list[0].Student_Pro!= null&&!string.IsNullOrEmpty(list[0].Student_Pro.Value.ToString())) { textboxMajor.Text = EClass.ProessionalNameByID(int.Parse(list[0].Student_Pro.Value.ToString()));//专业 } if (list[0].ClassID!=null&&!string.IsNullOrEmpty(list[0].ClassID.Value.ToString())) { textboxClass.Text = EClass.GetClassNameByClassID(int.Parse(list[0].ClassID.Value.ToString()));//班级 } if (list[0].Student_EntryDate != null) { tbRXLY.Text = list[0].Student_EntryDate.Value.ToShortDateString(); } tbSum.Text = list[0].Student_Summary; //if (!string.IsNullOrEmpty(list[0].Student_Photo.ToString())) //{ // imgStudent.ImageUrl = list[0].Student_Photo.ToString(); //} }
/// <summary> /// 处理绑定数据 /// </summary> /// <param name="ds"></param> /// <returns></returns> protected DataSet HandleDS(DataSet ds) { //构造: 性别Sex 班级名称ClassName 专业名称ProName 三列 ds.Tables[0].Columns.Add("Sex"); ds.Tables[0].Columns.Add("ClassName"); ds.Tables[0].Columns.Add("ProName"); ExtendBLL.Dictionary EDictionary = new ExtendBLL.Dictionary(); ExtendBLL.Class EClass = new ExtendBLL.Class(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string Student_Sex = ds.Tables[0].Rows[i]["Student_Sex"].ToString(); if (!string.IsNullOrEmpty(Student_Sex)) { string str = "DClass='201' and Code='" + Student_Sex + "'"; ds.Tables[0].Rows[i]["Sex"] = EDictionary.GetModelList(str)[0].Name.ToString(); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["ClassID"].ToString())) { int ClassID = int.Parse(ds.Tables[0].Rows[i]["ClassID"].ToString()); ds.Tables[0].Rows[i]["ClassName"] = EClass.GetClassNameByClassID(ClassID); } if (!string.IsNullOrEmpty(ds.Tables[0].Rows[i]["Student_Pro"].ToString())) { int Student_Pro = int.Parse(ds.Tables[0].Rows[i]["Student_Pro"].ToString()); ds.Tables[0].Rows[i]["ProName"] = EClass.ProessionalNameByID(Student_Pro); } } return ds; }