Beispiel #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            try
            {
                DataRow dr = gv_User.GetDataRow(gv_User.FocusedRowHandle);

                if (dr != null)
                {
                    if (UserInfo.userID == dr["用户名"].ToString() && UserInfo.userID != "system")
                    {
                        MessageBox.Show("自己不能修改自己部门!");
                        return;
                    }

                    FrmSetDept frm = new FrmSetDept(dr["用户名"].ToString());
                    if (frm.ShowDialog() == DialogResult.OK)
                    {
                        ModTS_USER_DEPT model = bllTsUserDept.Get_Model(dr["用户名"].ToString());
                        if (model != null)
                        {
                            model.C_DEPT_ID = frm.strDeptID;
                            bllTsUserDept.Update(model);
                        }
                        else
                        {
                            model           = new ModTS_USER_DEPT();
                            model.C_DEPT_ID = frm.strDeptID;
                            model.C_USER_ID = dr["用户名"].ToString();

                            bllTsUserDept.Add(model);
                        }

                        BindList();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(txt_UserName.Text.Trim()))
                {
                    MessageBox.Show("姓名不能为空!");
                    return;
                }

                if (string.IsNullOrEmpty(txt_LoginName.Text.Trim()))
                {
                    MessageBox.Show("账号不能为空!");
                    return;
                }

                //if (string.IsNullOrEmpty(txt_Email.Text.Trim()))
                //{
                //    MessageBox.Show("邮箱不能为空!");
                //    return;
                //}

                //if (string.IsNullOrEmpty(txt_Tel.Text.Trim()))
                //{
                //    MessageBox.Show("电话不能为空!");
                //    return;
                //}

                ModTS_USER mod = bll.GetModel(strUserID);
                if (mod != null)
                {
                    mod.C_NAME     = txt_UserName.Text.Trim();              //姓名
                    mod.C_EMAIL    = txt_Email.Text.Trim();                 //邮箱
                    mod.C_MOBILE   = txt_Tel.Text.Trim();                   //电话
                    mod.N_STATUS   = Convert.ToInt32(icbo_State.EditValue); //状态(1正常,2,3,4冻结)
                    mod.C_EMP_ID   = UserInfo.userID;                       //系统操作人编号
                    mod.C_EMP_NAME = UserInfo.userName;                     //系统操作人姓名
                    mod.D_MOD_DT   = ServerTime.timeNow();                  //系系统操作时间

                    if (bll.Update(mod))
                    {
                        if (!string.IsNullOrEmpty(btnEdit_Dept.Text.Trim()))
                        {
                            BllTS_USER_DEPT bllUserDept = new BllTS_USER_DEPT();

                            ModTS_USER_DEPT model = bllUserDept.Get_Model(strUserID);
                            if (model != null)
                            {
                                model.C_DEPT_ID = strDeptID;
                                bllUserDept.Update(model);
                            }
                            else
                            {
                                model           = new ModTS_USER_DEPT();
                                model.C_DEPT_ID = strDeptID;
                                model.C_USER_ID = strUserID;

                                bllUserDept.Add(model);
                            }
                        }

                        MessageBox.Show("修改成功!");
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                BllTS_USER bll = new BllTS_USER();

                if (string.IsNullOrEmpty(txt_UserName.Text.Trim()))
                {
                    MessageBox.Show("姓名不能为空!");
                    return;
                }

                if (string.IsNullOrEmpty(txt_LoginName.Text.Trim()))
                {
                    MessageBox.Show("账号不能为空!");
                    return;
                }
                else
                {
                    if (bll.Exists(txt_LoginName.Text.Trim()))
                    {
                        MessageBox.Show("该账号已存在,不能重复添加!");
                        return;
                    }
                }

                //if (string.IsNullOrEmpty(txt_Email.Text.Trim()))
                //{
                //    MessageBox.Show("邮箱不能为空!");
                //    return;
                //}

                //if (string.IsNullOrEmpty(txt_Tel.Text.Trim()))
                //{
                //    MessageBox.Show("电话不能为空!");
                //    return;
                //}

                ModTS_USER mod = new ModTS_USER();
                mod.C_NAME     = txt_UserName.Text.Trim();  //姓名
                mod.C_ACCOUNT  = txt_LoginName.Text.Trim(); //登录名
                mod.C_PASSWORD = Common.MD5("123456");      //密码
                mod.C_EMAIL    = txt_Email.Text.Trim();     //邮箱
                mod.C_MOBILE   = txt_Tel.Text.Trim();       //电话
                mod.N_TYPE     = 3;                         //用户类型(1内部,2新用户,3PCI用户)
                mod.N_STATUS   = 1;                         //状态(1正常,2,3,4冻结)
                mod.C_EMP_ID   = UserInfo.userID;           //系统操作人编号
                mod.C_EMP_NAME = UserInfo.userName;         //系统操作人姓名
                mod.D_MOD_DT   = ServerTime.timeNow();      //系系统操作时间

                if (bll.Add(mod))
                {
                    txt_UserName.Text  = "";
                    txt_LoginName.Text = "";
                    txt_Email.Text     = "";
                    txt_Tel.Text       = "";

                    if (!string.IsNullOrEmpty(btnEdit_Dept.Text.Trim()))
                    {
                        BllTS_USER_DEPT bllUserDept = new BllTS_USER_DEPT();

                        ModTS_USER_DEPT model = new ModTS_USER_DEPT();
                        model.C_DEPT_ID = strDeptID;
                        model.C_USER_ID = mod.C_ACCOUNT;
                        bllUserDept.Add(model);
                    }

                    MessageBox.Show("添加成功!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }