//删除选择的岗位职责列
 protected void Delete_OnClick(object sender, EventArgs e)
 {
     CheckBox cb;
     LabMS.BLL.Responsibility responsibility = new LabMS.BLL.Responsibility();
     try
     {
         for (int i = 0; i < gvResponsList.Rows.Count; i++ )
         {
             cb = (CheckBox)gvResponsList.Rows[i].FindControl("ResponsCB");
             if (cb.Checked)
             {
                 string RID = gvResponsList.DataKeys[i].Value.ToString();
                 responsibility.Delete(int.Parse(RID));
             }
         }
         if (tbResKeyWord.Text.Trim().Equals(""))
         {
             BindGridViewList("");
         }
         else
         {
             BindGridViewList(SearchString());
         }
         LabMS.Common.JShelper.JSAlert(Page, "deleteSuccess", "删除成功!");
     }
     catch(Exception ex)
     {
         LabMS.Common.JShelper.JSAlert(Page, "err", "删除失败!");
     }
 }
        protected void Submit_OnClick(object sender, EventArgs e)
        {
            #region 验证
            if (int.Parse(RespLabDDL.SelectedValue.Trim()) == 0)
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "实验室名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(RespName.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "岗位职责名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(RespContent.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "职责内容不能为空!");
                return;
            }
            #endregion
            LabMS.Model.Responsibility responsibility = new LabMS.Model.Responsibility();
            LabMS.BLL.Responsibility responsibilityInfo = new LabMS.BLL.Responsibility();

            int RID = 0;
            if (!int.TryParse(Request.QueryString["ID"], out RID))
            {
                Common.JShelper.JSAlert(Page, "err", "参数错误!");
                return;
            }
            responsibility.ID = RID;
            responsibility.Resp_Lab = int.Parse(RespLabDDL.SelectedValue.Trim());
            responsibility.Resp_Name = RespName.Text.ToString().Trim();
            responsibility.Resp_Content = RespContent.Text.ToString().Trim();

            responsibilityInfo.Update(responsibility);
            LabMS.Common.JShelper.JSAlertAndRedirect(Page, "EditSuccess", "修改成功!", "ListResponsibility.aspx");
        }
Esempio n. 3
0
        protected void Submit_OnClick(object sender, EventArgs e)
        {
            #region 验证
            if (int.Parse(RespLabDDL.SelectedValue.Trim()) == 0)
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "实验室名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(RespName.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "岗位职责名称不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(RespContent.Text.Trim()))
            {
                LabMS.Common.JShelper.JSAlert(Page, "err", "职责内容不能为空!");
                return;
            }
            #endregion
            LabMS.Model.Responsibility responsibility = new LabMS.Model.Responsibility();
            Responsibility responsibilityInfo = new Responsibility();

            responsibility.Resp_Lab = int.Parse(RespLabDDL.SelectedValue.Trim());
            responsibility.Resp_Name = RespName.Text.ToString().Trim();
            responsibility.Resp_Content = RespContent.Text.ToString().Trim();

            responsibilityInfo.Add(responsibility);
            LabMS.Common.JShelper.JSAlertAndRedirect(Page, "AddSuccess", "添加成功!", "AddResponsibility.aspx");
        }