Exemplo n.º 1
0
        /// <summary>
        /// 数据加载
        /// </summary>
        public void LoadData()
        {
            try
            {
                AppAccountMgn info = new AppAccountMgn();

                //info.ProjectName = this.projectNo.Text;

                pageInfo.ParamsSearch = info;

                //需要这个把 组件的分页信息赋值当前页面全局变量
                ObjectUtil.CopyPop(this.kenPage1.pageInfo, ref pageInfo);

                pageInfo = projectInfoBLL.SelectPage(pageInfo, null, $" SOURCE like '%{this.keyWord.Text}%'", WhereType.SQL);

                listData = pageInfo.Records;


                //this.showStrip.Text = string.Format("共{0}页({1}条记录)", pageInfo.CurrentPage, pageInfo.TotalPage);
                this.listDataGriddView.DataSource = listData;

                //分页部分
                var item = new MyWfControls.dto.PageInfo()
                {
                    CurrentPage = pageInfo.CurrentPage > 0? pageInfo.CurrentPage:1, CurrentCount = pageInfo.CurrentCount, PageSize = pageInfo.PageSize, TotalPage = pageInfo.TotalPage
                };
                this.kenPage1.pageInfo = item;
                this.kenPage1.SetShowText();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///  验证
        /// </summary>
        /// <param name="codeProjectInfo"></param>
        /// <returns></returns>
        private VerifyMessage VeriyData(AppAccountMgn saveItem)
        {
            VerifyMessage verifyMessage = new VerifyMessage();

            verifyMessage.ExistError = false;

            string pre      = "新增";
            string whereCon = $" SOURCE='{saveItem.SOURCE}'  and ACCOUNT='{saveItem.ACCOUNT}'";

            if (saveItem.ID > 0)
            {
                whereCon += $" AND ID !='{saveItem.ID}' ";
                pre       = "修改";
            }

            List <AppAccountMgn> lists = SelectList(saveItem, "ID", whereCon, WhereType.SQL);

            if (lists != null && lists.Count > 0)
            {
                verifyMessage.ExistError = true;
                verifyMessage.ErrorInfo  = $"{pre}失败,该来源的账号已存在";
            }

            return(verifyMessage);
        }
Exemplo n.º 3
0
        public void LoadData()
        {
            try
            {
                AppAccountMgn selectItem = new AppAccountMgn();
                selectItem.ID = appAccountMgn.ID;

                List <AppAccountMgn> lists = appAccountMgnBLL.SelectList(selectItem, null, "ID", WhereType.Columns);

                if (lists != null && lists.Count > 0)
                {
                    appAccountMgn = lists[0];
                    //加密码和管理密码不对外展示
                    ObjectUtil.CopyPop(appAccountMgn, ref selectItem, "ENCPWD", "MGNPWD");
                    FormHelp.SetControlsByEntity(selectItem, this.panel1);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 密码加密
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            try
            {
                AppAccountMgn saveItem = FormHelp.GetEntityByControls <AppAccountMgn>(this.panel1);
                if (!string.IsNullOrEmpty(appAccountMgn.MGNPWD))
                {
                    DialogResult dialogResult = MessageBox.Show("是否以原管理密码保存", "温馨提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning);
                    if (dialogResult == DialogResult.OK)
                    {
                        saveItem.MGNPWD = appAccountMgn.MGNPWD;
                    }
                }

                VerifyMessage verifyMessage = VerifyUtil.Verify(saveItem);


                if (saveItem.JiaoyanPwd != saveItem.InputPwd)
                {
                    verifyMessage.ExistError = true;
                    verifyMessage.ErrorInfo += "\n两次输入密码不一致,请重新输入";
                }


                if (verifyMessage.ExistError)
                {
                    MessageBox.Show(verifyMessage.ErrorInfo, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                //string iv = saveItem.ACCOUNT.ToString().PadLeft(8, 'u');
                string enc = DesHelper.DESEncrypt(saveItem.InputPwd, key, iv);
                this.ENCPWD.Text = enc;                  //真实密码
                saveItem.ENCPWD  = enc;                  //真实密码

                saveItem.PSEUDOCODE  = Md5Util.Md5(enc); //掩码
                this.PSEUDOCODE.Text = saveItem.PSEUDOCODE;

                R r = appAccountMgnBLL.SaveOrUpdateBySelf(saveItem, null, false);

                if (r.Successful)
                {
                    string msg = saveItem.ID <= 0 ? "新增" : "修改";
                    MessageBox.Show($"{msg}成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    LoadData();

                    //更新列表页
                    if (this.Owner is AccoutEncFrmList)
                    {
                        ((AccoutEncFrmList)this.Owner).LoadData();
                    }
                    this.Hide();
                    this.Dispose(true);
                }
                else
                {
                    MessageBox.Show(r.ResultHint, "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageHelper.ShowError(ex);
            }
        }
Exemplo n.º 5
0
 public AccoutEncFrm(AppAccountMgn appAccountMgn)
 {
     this.appAccountMgn = appAccountMgn;
     InitializeComponent();
 }
Exemplo n.º 6
0
 public R SaveOrUpdateBySelf(AppAccountMgn saveItem, string cols, bool needReturn)
 {
     return(SaveOrUpdate(saveItem, cols, needReturn, VeriyData));
 }