コード例 #1
0
        //取消选择
        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));
        }
コード例 #2
0
ファイル: student_edit.aspx.cs プロジェクト: ymh007/hyfp
        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);
        }
コード例 #3
0
 //保存
 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}",
                                                "", ""));
     }
 }
コード例 #4
0
        //保存
        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));
            }
        }