コード例 #1
0
ファイル: wfmAddDept.aspx.cs プロジェクト: zhenghua75/VIPCust
 private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     try
     {
         if (this.JudgeIsNull(txtDeptID.Text, "部门ID"))
         {
             return;
         }
         if (this.JudgeIsNull(txtDeptName.Text, "部门名称"))
         {
             return;
         }
         DataTable dtDept = Helper.Query("select * from tbDept where cnvcDeptID='" + txtDeptID.Text + "'");
         if (dtDept.Rows.Count > 0)
         {
             throw new Exception("相同部门ID已存在");
         }
         Dept newDept = new Dept();
         newDept.cnvcAreaCode     = ddlAreaCode.SelectedValue;
         newDept.cnvcComments     = txtComments.Text;
         newDept.cnvcDeptID       = txtDeptID.Text;
         newDept.cnvcDeptName     = txtDeptName.Text;
         newDept.cnvcParentDeptID = ddlDept.SelectedValue;
         SysManageFacade.AddDept(newDept, oper);
         Popup("部门添加成功");
     }
     catch (Exception ex)
     {
         Popup(ex.Message);
     }
 }
コード例 #2
0
 private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     //确定修改密码
     try
     {
         if (txtOldPwd.Text.Length == 0 || txtNewPwd.Text.Length == 0 || txtConfirmPwd.Text.Length == 0)
         {
             throw new BusinessException("UpdatePwd", "不能为空!");
         }
         if (txtOldPwd.Text.Equals(txtNewPwd.Text))
         {
             throw new BusinessException("UpdatePwd", "新老密码一样!");
         }
         if (!txtNewPwd.Text.Equals(txtConfirmPwd.Text))
         {
             throw new BusinessException("UpdatePwd", "确认密码和新密码不一致!");
         }
         if (!txtOldPwd.Text.Equals(DataSecurity.Decrypt(oper.cnvcOperPwd)))
         {
             throw new BusinessException("UpdatePwd", "输入的旧密码错误!");
         }
         oper.cnvcOperPwd = DataSecurity.Encrypt(txtNewPwd.Text);
         SysManageFacade.UpdatePwd(oper);
         Popup("密码修改成功!");
         //更新会话
         Session[ConstApp.S_OPER] = oper;
     }
     catch (Exception ex)
     {
         Popup(ex.Message);
     }
 }
コード例 #3
0
 private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
 {
     try
     {
         Dept oldDept = new Dept();
         oldDept.cnvcDeptID = e.Item.Cells[0].Text;
         SysManageFacade.DeleteDept(oldDept, oper);
         Popup("删除部门成功");
         BindGrid();
     }
     catch (Exception ex)
     {
         Popup(ex.Message);
     }
 }
コード例 #4
0
        private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                DataTable dtOper = Helper.Query("select * from tbOper where cnvcOperID='" + txtOperID.Text + "'");
                if (dtOper.Rows.Count == 0)
                {
                    Popup("无此用户信息");
                    return;
                }
                if (this.JudgeIsNull(txtOperName.Text, "操作员名称"))
                {
                    return;
                }
                if (this.JudgeIsNull(txtInvalidDate.Text, "失效时间"))
                {
                    return;
                }
                Oper newOper = new Oper(dtOper);
                newOper.cnvcOperName   = txtOperName.Text;
                newOper.cndInvalidDate = DateTime.Parse(txtInvalidDate.Text);
                newOper.cnvcDeptID     = ddlDept.SelectedValue;

                newOper.cnvcRoleCode = ddlRoleCode.SelectedValue;
                if (newOper.cnvcRoleCode == "customer")
                {
                    newOper.cnvcManager = ddlManager.SelectedValue;
                }
                else
                {
                    newOper.cnvcManager = "";
                }
                newOper.cnvcComments = txtComments.Text;
                SysManageFacade.UpdateOper(newOper, oper);

                DataTable dtOper2 = Helper.Query("select *,cnvcOperID as cnvcID,cnvcOperName as cnvcName from tbOper");
                Application[ConstApp.A_OPER] = dtOper2;

                Popup("操作员信息修改成功");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
コード例 #5
0
        private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
        {
            try
            {
                Oper oldOper = new Oper();
                oldOper.cnvcOperID = e.Item.Cells[0].Text;
                SysManageFacade.DeleteOper(oldOper, oper);

                DataTable dtOper2 = Helper.Query("select *,cnvcOperID as cnvcID,cnvcOperName as cnvcName from tbOper");
                Application[ConstApp.A_OPER] = dtOper2;

                Popup("操作员已删除成功");
                BindGrid();
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
コード例 #6
0
        private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                //更新功能列表
//				if (rblOper.SelectedValue == "")
//				{
//					throw new BusinessException("tbOper","请选择操作员!");
//				}
                string strOperID = txtOperID.Text;                //rblOper.SelectedValue;
                //查询某操作员已具有的功能
                DataTable dtHaveOperFunction = Helper.Query("select * from tbOperFunc where cnvcOperID='" + strOperID + "'");

                foreach (ListItem liOperFunction in cblFunctionList.Items)
                {
                    if (liOperFunction.Selected)
                    {
                        OperFunc operFunc = new OperFunc();
                        operFunc.cnvcOperID   = strOperID;
                        operFunc.cnvcFuncCode = liOperFunction.Value;
                        bool bIsAdd = true;

                        if (dtHaveOperFunction.Rows.Count > 0)
                        {
                            foreach (DataRow drHaveOperFunction in dtHaveOperFunction.Rows)
                            {
                                //已有的不做操作
                                if (drHaveOperFunction["cnvcFuncCode"].ToString().Equals(liOperFunction.Value))
                                {
                                    bIsAdd = false;
                                }
                            }
                        }
                        if (bIsAdd)
                        {
                            SysManageFacade.AddOperFunc(operFunc, oper);
                        }
                    }
                    else
                    {
                        //已有的取消了的删除
                        foreach (DataRow drHaveOperFunction in dtHaveOperFunction.Rows)
                        {
                            if (dtHaveOperFunction.Rows.Count > 0)
                            {
                                if (drHaveOperFunction["cnvcFuncCode"].ToString().Equals(liOperFunction.Value))
                                {
                                    OperFunc operFunc = new OperFunc();
                                    operFunc.cnvcOperID   = strOperID;
                                    operFunc.cnvcFuncCode = liOperFunction.Value;

                                    SysManageFacade.DeleteOperFunc(operFunc, oper);
                                }
                            }
                        }
                    }
                }
                Popup("权限修改成功!");
            }
            catch (BusinessException bex)
            {
                Popup(bex.Message);
            }
        }
コード例 #7
0
ファイル: wfmNewUser.aspx.cs プロジェクト: zhenghua75/VIPCust
        private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //添加用户
            try
            {
                if (this.JudgeIsNull(txtOperID.Text, "操作员编码"))
                {
                    return;
                }
                if (this.JudgeIsNull(txtOperName.Text, "操作员名称"))
                {
                    return;
                }
                if (this.JudgeIsNull(this.txtPwd.Text, "密码"))
                {
                    return;
                }
                if (this.JudgeIsNull(txtPwdConfirm.Text, "密码确认"))
                {
                    return;
                }
                if (GetLength(txtOperID.Text) > 50)
                {
                    throw new Exception("操作员ID过长!");
                }
                if (GetLength(txtOperName.Text) > 50)
                {
                    throw new Exception("操作员姓名过长!");
                }
                if (txtPwd.Text != txtPwdConfirm.Text)
                {
                    throw new Exception("密码不一致");
                }
                Oper newOper = new Oper();
                newOper.cnvcOperID = txtOperID.Text;
                DataTable dtOper = Helper.Query("select * from tbOper where cnvcOperID='" + newOper.cnvcOperID + "'");
                if (dtOper.Rows.Count == 0)
                {
                    newOper.cnvcOperName = txtOperName.Text;
                    newOper.cnvcOperPwd  = DataSecurity.Encrypt(txtPwd.Text);
                    newOper.cnvcDeptID   = ddlDept.SelectedValue;

                    if (txtInvalidDate.Text.Trim() == "")
                    {
                        newOper.cndInvalidDate = DateTime.Parse("9999-12-31");
                    }
                    else
                    {
                        newOper.cndInvalidDate = DateTime.Parse(txtInvalidDate.Text);
                    }
                    newOper.cnvcRoleCode = ddlRoleCode.SelectedValue;
                    if (newOper.cnvcRoleCode == "customer")
                    {
                        newOper.cnvcManager = ddlManager.SelectedValue;
                    }
                    newOper.cnvcComments = txtComments.Text;
                    SysManageFacade.AddOper(newOper, oper);

                    DataTable dtOper2 = Helper.Query("select *,cnvcOperID as cnvcID,cnvcOperName as cnvcName from tbOper");
                    Application[ConstApp.A_OPER] = dtOper2;

                    Popup("新建用户成功!");
                    Clear();
                }
                else
                {
                    Popup("用户已存在!");
                }
            }
            catch (Exception bex)
            {
                Popup(bex.Message);
            }
        }