Exemplo n.º 1
0
        private void OK()
        {
            IBLL.IOper bll = new BLL.OperBLL();
            if (oper == null || string.IsNullOrEmpty(oper.oper_id))
            {
                //添加
                sa_t_operator_i o = new sa_t_operator_i()
                {
                    oper_status = this.checkIsStop.Checked ? "0" : "1",
                    branch_no   = string.IsNullOrEmpty(this.txtBranch.Text) ? "" : this.txtBranch.Text.Split('/')[0],
                    is_branch   = this.cbIsBanch.Checked ? "1" : "0",
                    is_admin    = "0",
                    oper_id     = txtOperId.Text,
                    oper_name   = txtName.Text,
                    oper_pw     = sec.des(txtPw.Text),
                    update_time = DateTime.Now,
                    oper_type   = this.cbType.SelectedValue.ToString()
                };
                bll.Add(o);
            }
            else
            {
                //修改
                oper.oper_name   = txtName.Text;
                oper.oper_pw     = !txtPw.Text.Equals(oper.oper_pw) ? sec.des(txtPw.Text) : txtPw.Text;
                oper.update_time = DateTime.Now;
                oper.oper_type   = this.cbType.SelectedValue.ToString();
                oper.oper_status = this.checkIsStop.Checked ? "0" : "1";
                oper.branch_no   = string.IsNullOrEmpty(this.txtBranch.Text) ? "" : this.txtBranch.Text.Split('/')[0];
                oper.is_branch   = this.cbIsBanch.Checked ? "1" : "0";

                bll.Upload(oper);
            }
        }
Exemplo n.º 2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (Control c in this.Controls)
                {
                    if (c is TextBox)
                    {
                        var txt = c as TextBox;
                        if (!txt.Name.Equals(txtOldPwd.Name) && string.IsNullOrEmpty(c.Text))
                        {
                            txt.Focus();
                            MsgForm.ShowFrom("请补全信息!");
                            return;
                        }
                    }
                }

                if (!this.txtNewPwd.Text.Equals(this.txtNewPwd2.Text))
                {
                    MsgForm.ShowFrom("两次密码不一样!");
                    return;
                }

                IBLL.IOper bll = new BLL.OperBLL();
                bll.UploadPw(Program.oper.oper_id, this.txtOldPwd.Text, this.txtNewPwd2.Text);

                MsgForm.ShowFrom("修改成功,请重新登录");
                Application.Restart();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Exemplo n.º 3
0
        private void LoadType()
        {
            this.tvType.Nodes.Clear();

            IBLL.IOper bll  = new BLL.OperBLL();
            var        list = bll.GetOperTypeList();

            foreach (var type in list)
            {
                TreeNode n = new TreeNode(type.type_name + "[" + type.oper_type + "]");
                n.Tag = type;
                this.tvType.Nodes.Add(n);
            }
        }
Exemplo n.º 4
0
        public void LoadCb()
        {
            //角色
            IBLL.IOper bll = new BLL.OperBLL();
            var        lis = bll.GetOperTypeList();

            this.cbType.DisplayMember = "type_name";
            this.cbType.ValueMember   = "oper_type";
            this.cbType.DataSource    = lis;

            //机构
            IBLL.IBranch brbll  = new BLL.BranchBLL();
            var          branch = brbll.GetAllList("");

            this.txtBranch.Bind(branch, 300, 150, "branch_no", "branch_no:机构编码:80,branch_name:机构名称:150", "branch_no/branch_name->Text");
        }
Exemplo n.º 5
0
        private void LoadTv()
        {
            this.tv.Nodes.Clear();

            TreeNode tn = new TreeNode("全部操作员");

            tn.Tag = "";

            IBLL.IOper bll  = new BLL.OperBLL();
            var        list = bll.GetOperTypeList();

            foreach (var type in list)
            {
                TreeNode n = new TreeNode(type.type_name + "[" + type.oper_type + "]");
                n.Tag = type;
                tn.Nodes.Add(n);
            }

            this.tv.Nodes.Add(tn);
            this.tv.ExpandAll();
        }
Exemplo n.º 6
0
        private void tsbDelType_Click(object sender, EventArgs e)
        {
            try
            {
                if (!MyLove.PermissionsBalidation(this.Text, "02"))
                {
                    return;
                }
                if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes)
                {
                    IBLL.IOper bll = new BLL.OperBLL();
                    bll.DelOperType((sa_t_oper_type)this.tv.SelectedNode.Tag);

                    LoadTv();
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Exemplo n.º 7
0
        private void tsbDel_Click(object sender, EventArgs e)
        {
            if (!MyLove.PermissionsBalidation(this.Text, "02"))
            {
                return;
            }
            DataRow dr = this.dgvOper.CurrentRow();

            if (dr == null)
            {
                return;
            }

            if (YesNoForm.ShowFrom("确认要删除吗?") == DialogResult.Yes)
            {
                IBLL.IOper bll = new BLL.OperBLL();
                var        b   = DB.ReflectionHelper.DataRowToModel <sa_t_operator_i>(dr);
                bll.Del(b.oper_id);

                tv_AfterSelect(null, null);
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.txtGrout.Text))
                {
                    this.txtGrout.Focus();
                    return;
                }

                IBLL.IOper bll = new BLL.OperBLL();

                if (oper_type == null)
                {
                    oper_type = new sa_t_oper_type()
                    {
                        type_name   = this.txtGrout.Text,
                        update_time = DateTime.Now
                    };

                    bll.AddOperType(oper_type);
                }
                else
                {
                    oper_type.type_name   = this.txtGrout.Text;
                    oper_type.update_time = DateTime.Now;

                    bll.ChangeOperType(oper_type);
                }

                this.DialogResult = DialogResult.Yes;
                this.Close();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Exemplo n.º 9
0
        private void tsbIniPwd_Click(object sender, EventArgs e)
        {
            if (!MyLove.PermissionsBalidation(this.Text, "14"))
            {
                return;
            }
            if (this.dgvOper.CurrentRow() == null)
            {
                return;
            }

            sa_t_operator_i oper = DB.ReflectionHelper.DataRowToModel <sa_t_operator_i>(dgvOper.CurrentRow());

            if (YesNoForm.ShowFrom("确认要重置操作员:" + oper.oper_name + "的密码吗?") == DialogResult.Yes)
            {
                IBLL.IOper bll = new BLL.OperBLL();
                bll.ResetPWD(oper.oper_id, "1234");
                MsgForm.ShowFrom("重置完成,默认密码:1234");

                LoadOper();
                tv_AfterSelect(null, null);
            }
        }
Exemplo n.º 10
0
        public void LoadOper()
        {
            Thread th = new Thread(() =>
            {
                Helper.GlobalData.windows.ShowLoad(this);
                try
                {
                    Cursor.Current = Cursors.WaitCursor;

                    IBLL.IOper bll = new BLL.OperBLL();
                    tb             = bll.GetOpers();

                    tb.Columns.Add("密码");

                    foreach (DataRow dr in tb.Rows)
                    {
                        var i    = dr["oper_pw"].ToString().Length;
                        dr["密码"] = new string('*', i);
                    }

                    this.dgvOper.Invoke((MethodInvoker) delegate
                    {
                        this.dgvOper.DataSource = tb;
                    });

                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    LogHelper.writeLog("LoadOper", ex.ToString());
                    MsgForm.ShowFrom(ex);
                }
                Helper.GlobalData.windows.CloseLoad(this);
            });

            th.Start();
        }