Example #1
0
        protected override bool OnSaveData()
        {
            try
            {
                SysMan item = new SysMan();

                item.ManID        = txtManID.Text;
                item.ManName      = txtManName.Text;
                item.CoID         = Program.ManInfo.Man.CoID;
                item.DeptID       = ectDept.SelectValue;
                item.ManType      = Convert.ToInt16(ddlManType.SelectedValue);
                item.CrtDate      = DateTime.Now;
                item.CrtOper      = Program.ManInfo.Man.ManID;
                item.ManTele      = txtManTele.Text;
                item.ManDate      = DateTime.Now;
                item.ManLevel     = Convert.ToInt16(ddlManLevel.SelectedValue);
                item.ManTitle     = Convert.ToInt16(ddlManTitle.SelectedValue);
                item.ManSex       = 1;
                item.ManStatus    = Convert.ToInt16(ddlManStatus.SelectedValue);
                item.OperPassword = Crypto.MD5Crypto(txtManID.Text);
                item.OperSerial   = 1;
                item.WorkDate     = DateTime.Now.ToString("yyyyMMdd");
                item.PreWorkDate  = item.WorkDate;

                if (String.IsNullOrEmpty(id))
                {
                    SqlBaseProvider.SaveSysMan(item, DataProviderAction.Create);
                    id = item.ManID;
                }
                else
                {
                    SqlBaseProvider.SaveSysMan(item, DataProviderAction.Update);
                }

                this.OnDisplayAllCtrls(false);
                Global.DisableComboxTree(ectDept);
                tsbSave.Visible   = false;
                tsbCancel.Visible = false;
                fState            = FormState.Detail;

                if (parentForm != null)
                {
                    parentForm.RefreshForm();
                }
            }
            catch (Exception ex)
            {
                Global.ShowSysError(ex);
                return(false);
            }

            return(true);
        }
Example #2
0
        protected void OnLoadData()
        {
            try
            {
                SysDept sd = SqlBaseProvider.GetSysDept(tvDept.SelectedValue.ToString());

                txtDeptID.Text      = sd.DeptID;
                txtDeptPID.Text     = sd.DeptPID;
                txtDeptAddress.Text = sd.DeptAddress;
                txtDeptName.Text    = sd.DeptName;
                if (!String.IsNullOrEmpty(sd.DeptMan))
                {
                    txtDeptMan.CodeText = sd.DeptMan;
                    SysMan sm = SqlBaseProvider.GetSysMan(sd.DeptMan);
                    txtDeptMan.NameText = sm.ManName;
                }
                else
                {
                    txtDeptMan.CodeText = String.Empty;
                    txtDeptMan.NameText = String.Empty;
                }
                txtDeptEMail.Text = sd.DeptEMail;
                txtDeptFax.Text   = sd.DeptFax;
                txtDeptPost.Text  = sd.DeptPost;
                txtDeptTele.Text  = sd.DeptTele;
                txtSortOrder.Text = sd.SortOrder.ToString();
                txtDeptShort.Text = sd.DeptShort;

                CtrlHelper.SelectDropDownList(ddlCoID, sd.CoID);
                CtrlHelper.SelectDropDownList(ddlDeptType, sd.DeptType.ToString());
                CtrlHelper.SelectDropDownList(ddlDeptStatus, sd.DeptStatus.ToString());
                CtrlHelper.SelectDropDownList(ddlDeptLevel, sd.DeptLevel.ToString());
            }
            catch (Exception ex)
            {
                Global.ShowSysError(ex);
            }
        }
Example #3
0
        private void btnUnlock_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtManID.Text))
            {
                Global.ShowSysInfo("需要进行解锁的员工工号不能为空!");
                return;
            }

            try
            {
                SysMan item = SqlBaseProvider.GetSysMan(txtManID.Text);

                if (String.IsNullOrEmpty(item.ManID))
                {
                    throw new Exception("未找到编号为[" + txtManID.Text + "]的员工信息!");
                }

                short ml = SqlBaseProvider.GetSetManLevel();

                if (Program.ManInfo.Man.ManLevel >= ml)
                {
                    if (Program.ManInfo.Man.DeptID != item.DeptID)
                    {
                        throw new Exception("只能对本部门的员工进行解锁!");
                    }
                }

                SqlBaseProvider.SetLockMan(txtManID.Text, false);

                Global.ShowSysInfo("员工[" + item.ManID + ":" + item.ManName + "]锁定状态解除成功!");
            }
            catch (Exception ex)
            {
                Global.ShowSysError(ex);
            }
        }
Example #4
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtManID.Text))
            {
                Global.ShowSysInfo("需要进行重置密码的员工工号不能为空!");
                return;
            }

            try
            {
                SysMan item = SqlBaseProvider.GetSysMan(txtManID.Text);

                if (String.IsNullOrEmpty(item.ManID))
                {
                    throw new Exception("未找到编号为[" + txtManID.Text + "]的员工信息!");
                }

                short ml = SqlBaseProvider.GetSetManLevel();

                if (Program.ManInfo.Man.ManLevel >= ml)
                {
                    if (Program.ManInfo.Man.DeptID != item.DeptID)
                    {
                        throw new Exception("只能对本部门的员工进行重置密码!");
                    }
                }

                SqlBaseProvider.ResetMan(txtManID.Text);

                Global.ShowSysInfo("员工[" + item.ManID + ":" + item.ManName + "]密码重置成功!" + StringHelper.WriteEnter(1) + "新密码为该员工的工号。");
            }
            catch (Exception ex)
            {
                Global.ShowSysError(ex);
            }
        }
Example #5
0
        protected override void OnInitData()
        {
            base.OnInitData();

            try
            {
                Global.EnableComboxTree(ectDept);

                if (String.IsNullOrEmpty(id))
                {
                    txtManID.Text   = String.Empty;
                    txtManName.Text = String.Empty;
                    txtManTele.Text = String.Empty;
                    CtrlHelper.SelectDropDownList(ddlManLevel, DropAddFlag.Select.ToString());
                    CtrlHelper.SelectDropDownList(ddlManStatus, DropAddFlag.Select.ToString());
                    CtrlHelper.SelectDropDownList(ddlManTitle, DropAddFlag.Select.ToString());
                    CtrlHelper.SelectDropDownList(ddlManType, DropAddFlag.Select.ToString());

                    if (Program.ManInfo.Man.ManLevel >= ml)
                    {
                        ectDept.SelectValue = Program.ManInfo.Man.DeptID;
                    }
                    else
                    {
                        ectDept.Text = String.Empty;
                    }
                    this.fState = FormState.Edit;
                }
                else
                {
                    SysMan item = SqlBaseProvider.GetSysMan(id);

                    if (String.IsNullOrEmpty(item.ManID))
                    {
                        throw new Exception("未找到编号为[" + id + "]的员工信息!");
                    }

                    txtManID.Text   = item.ManID;
                    txtManName.Text = item.ManName;
                    txtManTele.Text = item.ManTele;

                    CtrlHelper.SelectDropDownList(ddlManLevel, item.ManLevel.ToString());
                    CtrlHelper.SelectDropDownList(ddlManStatus, item.ManStatus.ToString());
                    CtrlHelper.SelectDropDownList(ddlManTitle, item.ManTitle.ToString());
                    CtrlHelper.SelectDropDownList(ddlManType, item.ManType.ToString());
                    ectDept.SelectValue = item.DeptID;

                    int mAuth = Program.ManInfo.Auths.FindAuthByCode(this.mCode);


                    if (!CoreCtrls.CheckAuth(mAuth, AuthType.Edit))
                    {
                        this.OnDisplayAllCtrls(false);
                        Global.DisableComboxTree(ectDept);
                        tsbCancel.Visible = false;
                        tsbSave.Visible   = false;
                        tsbEdit.Visible   = false;
                        this.fState       = FormState.Detail;
                    }
                    else
                    {
                        this.OnDisplayEditCtrls(false);
                        this.fState = FormState.Edit;
                    }
                }

                if (Program.ManInfo.Man.ManLevel >= ml)
                {
                    Global.DisableComboxTree(ectDept);
                }
            }
            catch (Exception ex)
            {
                Global.ShowSysError(ex);
                this.OnDisplayAllCtrls(false);
                Global.DisableComboxTree(ectDept);
                tsbCancel.Visible = false;
                tsbSave.Visible   = false;
                tsbEdit.Visible   = false;
                this.fState       = FormState.Detail;
            }
        }