コード例 #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);
            }
        }
コード例 #2
0
        public void Add(sa_t_operator_i oper)
        {
            JsonRequest r = new JsonRequest();

            r.Write <sa_t_operator_i>(oper);

            r.request("/oper?t=add");

            if (!r.ReadSuccess())
            {
                throw new Exception(r.ReadMessage());
            }
        }
コード例 #3
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);
            }
        }
コード例 #4
0
        private void Login()
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;
                sa_t_operator_i oper = new sa_t_operator_i()
                {
                    oper_id = this.txtOperId.Text,
                    oper_pw = this.txtPwd.Text
                };

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

                if (bll.Login(oper))
                {
                    Program.oper = oper;

                    InI.Writue("app", "oper_id", oper.oper_id);

                    this.DialogResult = DialogResult.Yes;
                    this.Close();
                }
                else
                {
                    new MsgForm("账号/密码错误").ShowDialog();
                }
            }
            catch (Exception e)
            {
                LogHelper.writeLog("frmLogin", e.ToString());
                MsgForm.ShowFrom(e);
            }
            finally
            {
                Cursor.Current = Cursors.Default;
            }
        }