//取消选择 protected void btnCalcel_Click(object sender, EventArgs e) { BLL.teacher bll = new BLL.teacher(); Model.teacher model = bll.GetModel(this.id); var selectList = new List <int>(); var unSelectList = new List <int>(); StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < rptList2.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList2.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList2.Items[i].FindControl("chkId"); if (cb.Checked) { selectList.Add(id); } else { unSelectList.Add(id); tempStr.Append(id + ","); } } if (selectList.Count == 0) { JscriptMsg("请选择研究生!", string.Empty); return; } model.students = Utils.DelLastComma(tempStr.ToString()); foreach (var item in selectList) { BLL.student studentBll = new BLL.student(); Model.student studentModel = studentBll.GetModel(Utils.ObjToInt(item)); //学术型研究生 if (studentModel.is_aca == "1") { model.resquota = (Utils.ObjToInt(model.resquota) + 1).ToString(); } else { model.pro_resquota = (Utils.ObjToInt(model.pro_resquota) + 1).ToString(); } studentModel.status = "导师未通过您的申请,请再次操作选择其他导师"; studentBll.Update(studentModel); } if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误啦!", string.Empty); return; } JscriptMsg("取消选择研究生成功!", Utils.CombUrlTxt("teacher_list.aspx", "keywords={0}&property={1}", this.keywords, this.property)); }
private void ShowInfo(int _id) { BLL.student bll = new BLL.student(); Model.student model = bll.GetModel(_id); txtNo.Text = model.no; txtName.Text = model.name; txtSchool.Text = model.school; txtScore.Text = model.score; txtReScore.Text = model.re_score; txtAttach.Text = model.attach; txtAddTime.Text = model.add_time.ToString("yyyy-MM-dd HH:mm:ss"); rblIsAca.SelectedValue = model.is_aca.ToString(); }
private void RptBind(string _strWhere, string _orderby) { BLL.teacher bll = new BLL.teacher(); if (this.action == DTEnums.ActionEnum.Edit.ToString()) { BLL.student studentBll = new BLL.student(); Model.student studentModel = studentBll.GetModel(this.id); txtIsAsa.Value = studentModel.is_aca; //如果是学术型研究生则只能看到学术型导师 if (studentModel.is_aca == "1") { _strWhere += " and is_aca='1' and resquota>0"; } else if (studentModel.is_aca == "0") { _strWhere += " and is_pro='1' and pro_resquota>0"; } //导师列表 this.rptList1.Visible = true; this.rptList1.DataSource = bll.GetList(0, _strWhere, _orderby); this.rptList1.DataBind(); } }
private bool DoEdit(int _id) { bool result = false; BLL.student bll = new BLL.student(); Model.student model = bll.GetModel(_id); model.no = txtNo.Text.Trim(); model.name = txtName.Text.Trim(); model.school = txtSchool.Text.Trim(); model.score = txtScore.Text.Trim(); model.re_score = txtReScore.Text.Trim(); model.attach = txtAttach.Text.Trim(); model.add_time = Utils.StrToDateTime(txtAddTime.Text.Trim()); model.is_aca = Utils.ObjectToStr(rblIsAca.SelectedValue); if (bll.Update(model)) { AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改研究生" + model.name); //记录日志 result = true; } return(result); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("student", DTEnums.ActionEnum.Delete.ToString()); //检查权限 int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.student bll = new BLL.student(); Repeater rptList = new Repeater(); rptList = this.rptList1; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { var model = bll.GetModel(id); if (model.status == "导师已通过您的申请") { JscriptMsg("学生【" + model.name + "】已经通过导师申请,无法删除!", "back"); return; } if (bll.Delete(id)) { sucCount++; } else { errorCount++; } } } AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "删除研究生资料成功" + sucCount + "条,失败" + errorCount + "条"); //记录日志 JscriptMsg("删除成功" + sucCount + "条,失败" + errorCount + "条!", Utils.CombUrlTxt("student_list.aspx", "keywords={0}&property={1}", this.keywords, this.property)); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { BLL.student bll = new BLL.student(); Model.student model = bll.GetModel(this.id); if (model.status == "导师已通过您的申请") { JscriptMsg("导师已通过您的申请 !", string.Empty); return; } var selectList = new List <int>(); var unSelectList = new List <int>(); StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < rptList1.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList1.Items[i].FindControl("chkId"); if (cb.Checked) { selectList.Add(id); tempStr.Append(id + ","); } else { unSelectList.Add(id); } } if (selectList.Count == 0) { JscriptMsg("请选择一名导师!", string.Empty); return; } if (selectList.Count > 1) { JscriptMsg("您只能选择一名导师!", string.Empty); return; } if (selectList.Count > 0) { BLL.teacher teacherBll = new BLL.teacher(); var requota = "0"; //学术型研究生 if (model.is_aca == "1") { requota = teacherBll.GetQuota(selectList[0]); } else { requota = teacherBll.GetProResQuota(selectList[0]); } if (Utils.ObjToInt(requota) == 0) { JscriptMsg("您选择的导师配额已满,请重新选择!", string.Empty); return; } model.teacher_id = selectList[0]; } else { JscriptMsg("请选择导师!", string.Empty); return; } model.status = "待导师确认"; if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误啦!", string.Empty); return; } JscriptMsg("选择导师成功!", Utils.CombUrlTxt("student_list.aspx", "keywords={0}&property={1}", "", "")); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { if (action == DTEnums.ActionEnum.Edit.ToString()) //修改 { int sucCount = 0; //成功数量 int errorCount = 0; //失败数量 BLL.teacher bll = new BLL.teacher(); Model.teacher model = bll.GetModel(this.id); if (Utils.ObjToInt(model.resquota) == 0 && Utils.ObjToInt(model.pro_resquota) == 0) { JscriptMsg("您的名额已满!", string.Empty); return; } var selectList = new List <int>(); var unSelectList = new List <int>(); StringBuilder tempStr = new StringBuilder(); for (int i = 0; i < rptList1.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList1.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList1.Items[i].FindControl("chkId"); if (cb.Checked) { selectList.Add(id); tempStr.Append(id + ","); } else { unSelectList.Add(id); } } if (selectList.Count == 0) { JscriptMsg("请选择研究生!", string.Empty); return; } if (selectList.Count > Utils.ObjToInt(model.resquota) + Utils.ObjToInt(model.pro_resquota)) { JscriptMsg("您选中学生过多,超出的您的配额!", string.Empty); btnCancel.Visible = false; return; } model.students = string.IsNullOrEmpty(model.students) ? Utils.DelLastComma(tempStr.ToString()) : model.students + "," + Utils.DelLastComma(tempStr.ToString()); var xsQuota = 0; var zsQuota = 0; foreach (var item in selectList) { BLL.student studentBll = new BLL.student(); Model.student studentModel = studentBll.GetModel(Utils.ObjToInt(item)); //学术型研究生 if (studentModel.is_aca == "1") { xsQuota++; } else { zsQuota++; } } if (xsQuota > Utils.StrToInt(model.resquota, 0)) { JscriptMsg("您选中学生过多,超出的您您的学硕配额!", string.Empty); btnCancel.Visible = false; return; } if (zsQuota > Utils.StrToInt(model.pro_resquota, 0)) { JscriptMsg("您选中学生过多,超出的您您的专硕配额!", string.Empty); btnCancel.Visible = false; return; } foreach (var item in selectList) { BLL.student studentBll = new BLL.student(); Model.student studentModel = studentBll.GetModel(Utils.ObjToInt(item)); //学术型研究生 if (studentModel.is_aca == "1") { model.resquota = (Utils.ObjToInt(model.resquota) - 1).ToString(); } else { model.pro_resquota = (Utils.ObjToInt(model.pro_resquota) - 1).ToString(); } studentModel.status = "导师已通过您的申请"; if (studentBll.Update(studentModel)) { sucCount++; } else { errorCount++; } } foreach (var item in unSelectList) { BLL.student studentBll = new BLL.student(); Model.student studentModel = studentBll.GetModel(Utils.ObjToInt(item)); studentModel.status = "导师未通过您的申请,请再次操作选择其他导师"; studentBll.Update(studentModel); } if (!bll.Update(model)) { JscriptMsg("保存过程中发生错误啦!", string.Empty); return; } JscriptMsg("选择研究生成功!", Utils.CombUrlTxt("teacher_list.aspx", "keywords={0}&property={1}", this.keywords, this.property)); } }