public bool UpdateCheckByTeacher(InDeptFellingModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update GP_InDept_Felling set "); strSql.Append("teacher_status=@teacher_status"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@teacher_status", SqlDbType.NVarChar, 50), new SqlParameter("@id", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.teacher_status; parameters[1].Value = model.id; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public bool InsertDeptFelling(InDeptFellingModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into GP_InDept_Felling("); strSql.Append("id,name,real_name,training_base_code,training_base_name,professional_base_code,professional_base_name,rotary_dept_code,rotary_dept_name,indept_felling,register_date,writor,teacher_status,kzr_status,base_status,manager_status,TeacherId,TeacherName)"); strSql.Append(" values ("); strSql.Append("@id,@name,@real_name,@training_base_code,@training_base_name,@professional_base_code,@professional_base_name,@rotary_dept_code,@rotary_dept_name,@indept_felling,@register_date,@writor,@teacher_status,@kzr_status,@base_status,@manager_status,@TeacherId,@TeacherName)"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.NVarChar, 50), new SqlParameter("@name", SqlDbType.NVarChar, 50), new SqlParameter("@real_name", SqlDbType.NVarChar, 50), new SqlParameter("@training_base_code", SqlDbType.NVarChar, 50), new SqlParameter("@training_base_name", SqlDbType.NVarChar, 50), new SqlParameter("@professional_base_code", SqlDbType.NVarChar, 50), new SqlParameter("@professional_base_name", SqlDbType.NVarChar, 50), new SqlParameter("@rotary_dept_code", SqlDbType.NVarChar, 50), new SqlParameter("@rotary_dept_name", SqlDbType.NVarChar, 50), new SqlParameter("@indept_felling", SqlDbType.NVarChar, 1000), new SqlParameter("@register_date", SqlDbType.NVarChar, 50), new SqlParameter("@writor", SqlDbType.NVarChar, 50), new SqlParameter("@teacher_status", SqlDbType.NVarChar, 50), new SqlParameter("@kzr_status", SqlDbType.NVarChar, 50), new SqlParameter("@base_status", SqlDbType.NVarChar, 50), new SqlParameter("@manager_status", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherId", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.id; parameters[1].Value = model.name; parameters[2].Value = model.real_name; parameters[3].Value = model.training_base_code; parameters[4].Value = model.training_base_name; parameters[5].Value = model.professional_base_code; parameters[6].Value = model.professional_base_name; parameters[7].Value = model.rotary_dept_code; parameters[8].Value = model.rotary_dept_name; parameters[9].Value = model.indept_felling; parameters[10].Value = model.register_date; parameters[11].Value = model.writor; parameters[12].Value = model.teacher_status; parameters[13].Value = model.kzr_status; parameters[14].Value = model.base_status; parameters[15].Value = model.manager_status; parameters[16].Value = model.TeacherId; parameters[17].Value = model.TeacherName; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public List <Model.InDeptFellingModel> CommonGetPagedList(string StudentsRealName, string TrainingBaseCode, string ProfessionalBaseCode, string DeptCode, string TeachersName, string ProfessionalBaseName, string DeptName, string TeachersRealName, int start, int end) { string sql = "select * from (select row_number() over(order by register_date desc) as num,* from GP_InDept_Felling where training_base_code like '%" + TrainingBaseCode + "%'"; if (!string.IsNullOrEmpty(StudentsRealName)) { sql += "and real_name like '%" + StudentsRealName + "%'"; } if (!string.IsNullOrEmpty(ProfessionalBaseCode)) { sql += "and professional_base_code like '%" + ProfessionalBaseCode + "%'"; } if (!string.IsNullOrEmpty(DeptCode)) { sql += "and rotary_dept_code like '%" + DeptCode + "%'"; } if (!string.IsNullOrEmpty(TeachersName)) { sql += "and TeacherId like '%" + TeachersName + "%'"; } if (!string.IsNullOrEmpty(ProfessionalBaseName)) { sql += "and professional_base_name like '%" + ProfessionalBaseName + "%'"; } if (!string.IsNullOrEmpty(DeptName)) { sql += "and rotary_dept_name like '%" + DeptName + "%'"; } if (!string.IsNullOrEmpty(TeachersRealName)) { sql += "and TeacherName like '%" + TeachersRealName + "%'"; } sql += ")as t where t.num>=@start and t.num<=@end"; SqlParameter[] pars = { new SqlParameter("@start", SqlDbType.Int), new SqlParameter("@end", SqlDbType.Int) }; pars[0].Value = start; pars[1].Value = end; DataTable dt = db.RunDataTable(sql, pars); List <InDeptFellingModel> list = null; if (dt.Rows.Count > 0) { list = new List <InDeptFellingModel>(); InDeptFellingModel model = null; foreach (DataRow row in dt.Rows) { model = new InDeptFellingModel(); model = DataRowToModel(row); list.Add(model); } } return(list); }
public bool UpdateDeptFelling(InDeptFellingModel model, string id) { StringBuilder strSql = new StringBuilder(); strSql.Append("update GP_InDept_Felling set "); strSql.Append("rotary_dept_code=@rotary_dept_code,"); strSql.Append("rotary_dept_name=@rotary_dept_name,"); strSql.Append("indept_felling=@indept_felling,"); strSql.Append("writor=@writor,"); strSql.Append("register_date=@register_date,"); strSql.Append("TeacherId=@TeacherId,"); strSql.Append("TeacherName=@TeacherName"); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@rotary_dept_code", SqlDbType.NVarChar, 50), new SqlParameter("@rotary_dept_name", SqlDbType.NVarChar, 50), new SqlParameter("@indept_felling", SqlDbType.NVarChar, 1000), new SqlParameter("@writor", SqlDbType.NVarChar, 50), new SqlParameter("@register_date", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherId", SqlDbType.NVarChar, 50), new SqlParameter("@TeacherName", SqlDbType.NVarChar, 50), new SqlParameter("@id", SqlDbType.NVarChar, 50) }; parameters[0].Value = model.rotary_dept_code; parameters[1].Value = model.rotary_dept_name; parameters[2].Value = model.indept_felling; parameters[3].Value = model.writor; parameters[4].Value = model.register_date; parameters[5].Value = model.TeacherId; parameters[6].Value = model.TeacherName; parameters[7].Value = id; int rows = db.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
public List <Model.InDeptFellingModel> GetPagedList(string students_name, string training_base_code, string rotary_dept, int start, int end) { string sql = "select * from (select row_number() over(order by register_date desc) as num,* from GP_InDept_Felling where name='" + students_name + "' and training_base_code='" + training_base_code + "'"; if (!string.IsNullOrEmpty(rotary_dept)) { sql += "and rotary_dept_name like '%" + rotary_dept + "%')as t where t.num>=@start and t.num<=@end"; } else { sql += ")as t where t.num>=@start and t.num<=@end"; } SqlParameter[] pars = { new SqlParameter("@start", SqlDbType.Int), new SqlParameter("@end", SqlDbType.Int) }; pars[0].Value = start; pars[1].Value = end; DataTable dt = db.RunDataTable(sql, pars); List <InDeptFellingModel> list = null; if (dt.Rows.Count > 0) { list = new List <InDeptFellingModel>(); InDeptFellingModel model = null; foreach (DataRow row in dt.Rows) { model = new InDeptFellingModel(); model = DataRowToModel(row); list.Add(model); } } return(list); }
public Model.InDeptFellingModel GetModelById(string id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select id,name,real_name,training_base_code,training_base_name,professional_base_code,professional_base_name,rotary_dept_code,rotary_dept_name,indept_felling,register_date,writor,teacher_status,kzr_status,base_status,manager_status,TeacherId,TeacherName from GP_InDept_Felling "); strSql.Append(" where id=@id "); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.NVarChar, 50) }; parameters[0].Value = id; InDeptFellingModel model = new InDeptFellingModel(); DataSet ds = db.RunDataSet(strSql.ToString(), parameters, "tbName"); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
public bool UpdateCheckByTeacher(InDeptFellingModel model) { return(inDeptFellingDAL.UpdateCheckByTeacher(model)); }
public bool InsertDeptFelling(InDeptFellingModel model) { return(inDeptFellingDAL.InsertDeptFelling(model)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["loginModel"] == null) { Response.Write("<script>alert('请重新登录');opener.top.location.href='../../Default.aspx';window.close();</script>"); return; } id = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["id"])); pi = CommonFunc.FilterSpecialString(CommonFunc.SafeGetStringFromObj(Request.QueryString["pi"])); if (!IsPostBack) { loginModel = new LoginModel(); studentsPersonalInformationModel = new StudentsPersonalInformation2Model(); studentsPersonalInformationBLL = new StudentsPersonalInformation2BLL(); dt = new DataTable(); professionalBaseDeptBLL = new ProfessionalBaseDeptBLL(); loginModel = (LoginModel)Session["loginModel"]; writor.Text = loginModel.real_name; real_name.Text = loginModel.real_name; real_name.ReadOnly = true; if (string.IsNullOrEmpty(id)) { register_date.Text = DateTime.Now.Date.ToString("yyyy-MM-dd"); } na = loginModel.name; name.Value = na; tbcode = loginModel.training_base_code; studentsPersonalInformationModel = studentsPersonalInformationBLL.GetModelByNameTBCode(na, tbcode); if (studentsPersonalInformationModel == null) { Response.Write("<script> alert('请完善个人基本信息');window.close();</script>"); return; } else { TrainingBaseCode.Value = studentsPersonalInformationModel.TrainingBaseCode.ToString(); training_base_name.Text = studentsPersonalInformationModel.TrainingBaseName.ToString(); training_base_name.ReadOnly = true; ProfessionalBaseCode.Value = studentsPersonalInformationModel.ProfessionalBaseCode.ToString(); professional_base_name.Text = studentsPersonalInformationModel.ProfessionalBaseName.ToString(); professional_base_name.ReadOnly = true; dt = professionalBaseDeptBLL.GetDeptDataTableByCode(studentsPersonalInformationModel.ProfessionalBaseCode.ToString()); RotaryDept.DataSource = dt; RotaryDept.DataTextField = "dept_name"; RotaryDept.DataValueField = "dept_code"; RotaryDept.DataBind(); RotaryDept.Items.Insert(0, new ListItem("==请选择==", "0")); } if (!string.IsNullOrEmpty(id)) {//如果不是表单提交,并且带了id值来做修改操作,则在界面上把值都呈现出来 inDeptFellingModel = new InDeptFellingModel(); inDeptFellingBLL = new InDeptFellingBLL(); inDeptFellingModel = inDeptFellingBLL.GetModelById(id); real_name.Text = inDeptFellingModel.real_name.ToString(); training_base_name.Text = inDeptFellingModel.training_base_name.ToString(); professional_base_name.Text = inDeptFellingModel.professional_base_name.ToString(); //RotaryDept.SelectedItem.Text = inDeptFellingModel.rotary_dept_name.ToString(); RotaryDept.SelectedValue = inDeptFellingModel.rotary_dept_code.ToString(); dt = new LoginBLL().GetTeachersDtByDeptCode(inDeptFellingModel.training_base_code, inDeptFellingModel.professional_base_code, inDeptFellingModel.rotary_dept_code, "teachers"); Teacher.DataSource = dt; Teacher.DataTextField = "real_name"; Teacher.DataValueField = "name"; Teacher.DataBind(); Teacher.Items.Insert(0, new ListItem("==请选择==", "0")); Teacher.SelectedValue = inDeptFellingModel.TeacherId; //Teacher.SelectedValue = inDeptFellingModel.TeacherId.ToString(); //Teacher.SelectedItem.Text = inDeptFellingModel.TeacherName.ToString(); dept_felling.Text = inDeptFellingModel.indept_felling.ToString(); writor.Text = inDeptFellingModel.writor.ToString(); register_date.Text = inDeptFellingModel.register_date.ToString(); } } }
protected void save_Click(object sender, EventArgs e) { inDeptFellingModel = new InDeptFellingModel(); inDeptFellingBLL = new InDeptFellingBLL(); inDeptFellingModel.rotary_dept_code = CommonFunc.FilterSpecialString(RotaryDept.SelectedItem.Value); inDeptFellingModel.rotary_dept_name = CommonFunc.FilterSpecialString(RotaryDept.SelectedItem.Text); inDeptFellingModel.TeacherId = CommonFunc.FilterSpecialString(Teacher.SelectedItem.Value); inDeptFellingModel.TeacherName = CommonFunc.FilterSpecialString(Teacher.SelectedItem.Text); inDeptFellingModel.indept_felling = CommonFunc.FilterSpecialString(dept_felling.Text); inDeptFellingModel.writor = CommonFunc.FilterSpecialString(writor.Text); inDeptFellingModel.register_date = CommonFunc.FilterSpecialString(register_date.Text.Trim()); if (string.IsNullOrEmpty(id)) { id = Guid.NewGuid().ToString(); inDeptFellingModel.id = id; inDeptFellingModel.name = name.Value.ToString(); inDeptFellingModel.real_name = CommonFunc.FilterSpecialString(real_name.Text.Trim()); inDeptFellingModel.training_base_code = CommonFunc.FilterSpecialString(TrainingBaseCode.Value); inDeptFellingModel.training_base_name = CommonFunc.FilterSpecialString(training_base_name.Text); inDeptFellingModel.professional_base_code = CommonFunc.FilterSpecialString(ProfessionalBaseCode.Value); inDeptFellingModel.professional_base_name = CommonFunc.FilterSpecialString(professional_base_name.Text); inDeptFellingModel.teacher_status = teacher_status; inDeptFellingModel.kzr_status = kzr_status; inDeptFellingModel.base_status = base_status; inDeptFellingModel.manager_status = manage_status; if (inDeptFellingModel.rotary_dept_code == "0" || inDeptFellingModel.rotary_dept_name == "==请选择==") { ShowMessageBox.Showmessagebox(this, "轮转科室不能为空", null); return; } if (inDeptFellingModel.TeacherId == "0" || inDeptFellingModel.TeacherName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "指导医师不能为空", null); return; } if (string.IsNullOrEmpty(inDeptFellingModel.indept_felling)) { ShowMessageBox.Showmessagebox(this, "入科感想不能为空", null); return; } if (inDeptFellingModel.indept_felling.Length > 1000) { ShowMessageBox.Showmessagebox(this, "入科感想字数不能超过1000字", null); return; } if (inDeptFellingBLL.InsertDeptFelling(inDeptFellingModel)) { try { Response.Write("<script language='javascript'> alert('入科感想添加成功');window.opener.parent.frames.bodyFrame.frames.frmright.window.loadPageList(1);window.close();</script>"); } catch (Exception ex) { Response.Write(ex.Message); } } } else { if (inDeptFellingModel.rotary_dept_code == "0" || inDeptFellingModel.rotary_dept_name == "==请选择==") { ShowMessageBox.Showmessagebox(this, "轮转科室不能为空", null); return; } if (inDeptFellingModel.TeacherId == "0" || inDeptFellingModel.TeacherName == "==请选择==") { ShowMessageBox.Showmessagebox(this, "指导医师不能为空", null); return; } if (string.IsNullOrEmpty(inDeptFellingModel.indept_felling)) { ShowMessageBox.Showmessagebox(this, "入科感想不能为空", null); return; } if (inDeptFellingModel.indept_felling.Length > 1000) { ShowMessageBox.Showmessagebox(this, "入科感想字数不能超过1000字", null); return; } if (inDeptFellingBLL.UpdateDeptFelling(inDeptFellingModel, id)) { try { Response.Write("<script language='javascript'> alert('入科感想修改成功');window.opener.window.loadPageList('" + pi + "');window.close();</script>"); } catch (Exception ex) { Response.Write(ex.Message); } } } }