示例#1
0
        /// <summary>
        /// 将已删除的用户恢复
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRestore_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelSYSTEM_USER modelSystemUser = PrepareModelSystemUser();
                //更新数据
                bool status = _bllSystemUser.Enabled(modelSystemUser.F_USER_ID);

                //获得当前rowhandle
                int rowhandle = gvList.FocusedRowHandle;

                //绑定数据
                BindGridview();

                //设置焦点行
                gvList.FocusedRowHandle = rowhandle;

                if (status)
                {
                    XtraMessageBox.Show("此数据已启用。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //刷新数据
                    gvList_RowClick(this, null);
                }
                else
                {
                    XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
示例#2
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");
                //禁用前判断
                DialogResult dialogResult = XtraMessageBox.Show("此操作可能导致其他关联数据出错,是否继续?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }


                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelSYSTEM_USER modelSystemUser = PrepareModelSystemUser();
                //更新数据
                bool status = _bllSystemUser.Delete(modelSystemUser.F_USER_ID);


                if (status)
                {
                    XtraMessageBox.Show("此数据已删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    //刷新数据
                    gvList_RowClick(this, null);
                }
                else
                {
                    XtraMessageBox.Show("没有数据被更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
示例#3
0
 public void ChagePassword(ModelSYSTEM_USER model)
 {
     try
     {
         Log.Info("BllSYSTEM_USER->ChagePassword---START");
         ConnectionOpen();
         dal.SetDBAccess(GetDBAccess());
         dal.ChagePassword(model);
     }
     catch (Exception ex)
     {
         Log.Error("BllSYSTEM_USER->ChagePassword---FAILED", ex);
         throw ex;
     }
     finally
     {
         ConnectionClose();
         Log.Info("BllSYSTEM_USER->ChagePassword---finally");
     }
 }
示例#4
0
        /// <summary>
        /// 准备数据
        /// </summary>
        /// <returns></returns>
        private ModelSYSTEM_USER PrepareModelSystemUser()
        {
            //创建操作类
            ModelSYSTEM_USER model = new ModelSYSTEM_USER();

            //登录名
            model.F_USER_ID = txtF_USER_ID.Text;

            //名称
            model.F_USER_NAME = txtF_USER_NAME.Text;

            //电话
            model.F_PHONE = txtF_PHONE.Text;

            //密码
            model.F_PASSWORD = Util.DBUtility.DESEncrypt.Encrypt(txtF_PASSWORD.Text);

            //是否是上位机用户
            model.F_ISSWJ = (decimal)chkF_ISSWJ.EditValue;

            //创建时间
            DateTime optDateTime = DateTime.Now;

            model.F_CREATE_TIME = optDateTime;

            //操作员
            model.F_OPERATOR_ID = AppGlobal.GUserId;


            //操作时间
            model.F_OPERATIONTIME = optDateTime;

            //是否删除
            model.F_DEL = 0;

            return(model);
        }
示例#5
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //判断必须输入项
                if (string.IsNullOrEmpty(txtOriginalPass.Text))
                {
                    XtraMessageBox.Show("请输入代码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //判断密码
                if (string.IsNullOrEmpty(txtPasswrod.Text) || string.IsNullOrEmpty(txtRepeatPassword.Text))
                {
                    XtraMessageBox.Show("请输入新密码并重复!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (txtPasswrod.Text != txtRepeatPassword.Text)
                {
                    XtraMessageBox.Show("两次输入的密码必须一致!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                //get original user info
                ModelSYSTEM_USER originalmodelXtuser = _bllSystemUser.GetModel(AppGlobal.GUserId);


                if (txtOriginalPass.Text != Util.DBUtility.DESEncrypt.Decrypt(originalmodelXtuser.F_PASSWORD))
                {
                    XtraMessageBox.Show("原密码输入错误!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                //创建操作类
                ModelSYSTEM_USER model = new ModelSYSTEM_USER();

                //登录名
                model.F_USER_ID = AppGlobal.GUserId;

                //密码
                model.F_PASSWORD = Util.DBUtility.DESEncrypt.Encrypt(txtPasswrod.Text);

                //创建时间
                DateTime optDateTime = DateTime.Now;

                //操作员
                model.F_OPERATOR_ID = AppGlobal.GUserId;


                //操作时间
                model.F_OPERATIONTIME = optDateTime;



                //是否删除
                model.F_DEL = 0;

                //判断是否已经有此数据
                if (_bllSystemUser.Exists(model.F_USER_ID))
                {
                    //保存数据
                    _bllSystemUser.ChagePassword(model);

                    //提示信息
                    XtraMessageBox.Show("用户数据已更新!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    XtraMessageBox.Show("此用户不存在!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log.Error(this.GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }
示例#6
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="model"></param>
        public void ChagePassword(ModelSYSTEM_USER model)
        {
            try
            {
                Log.Info("DalXUSER->ChagePassword---START");
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update T_XT_USER set ");

                strSql.Append(" F_PASSWORD = :F_PASSWORD , ");
                strSql.Append(" F_OPERATOR_ID = :F_OPERATOR_ID , ");
                strSql.Append(" F_OPERATIONTIME = :F_OPERATIONTIME , ");
                strSql.Append(" where F_USERID=:F_USER_ID  ");

                OracleParameter[] parameters =
                {
                    new OracleParameter(":F_PASSWORD",      OracleType.VarChar,   200),

                    new OracleParameter(":F_OPERATOR_ID",   OracleType.VarChar,    20),

                    new OracleParameter(":F_OPERATIONTIME", OracleType.DateTime),

                    new OracleParameter(":F_USERID",        OracleType.VarChar, 10)
                };


                if (model.F_PASSWORD == null)
                {
                    parameters[0].Value = DBNull.Value;
                }
                else
                {
                    parameters[0].Value = model.F_PASSWORD;
                }

                if (model.F_OPERATOR_ID == null)
                {
                    parameters[1].Value = DBNull.Value;
                }
                else
                {
                    parameters[1].Value = model.F_OPERATOR_ID;
                }
                if (model.F_OPERATIONTIME == null)
                {
                    parameters[2].Value = DBNull.Value;
                }
                else
                {
                    parameters[2].Value = model.F_OPERATIONTIME;
                }

                if (model.F_USER_ID == null)
                {
                    parameters[3].Value = DBNull.Value;
                }
                else
                {
                    parameters[3].Value = model.F_USER_ID;
                }

                int rows = ExecuteSql(strSql.ToString(), parameters);
            }
            catch (Exception ex)
            {
                Log.Error("DalXUSER->ChagePassword---FAILED", ex);
                throw ex;
            }
        }
示例#7
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                Log.Info(GetType() + "->" + ApplicationCommon.GetMethodName() + "---START");

                //检查必填字段
                bool isAllOk = CheckNotNullField();

                if (!isAllOk)
                {
                    return;
                }

                //准备要存储的数据
                ModelSYSTEM_USER modelSystemUser = PrepareModelSystemUser();


                //判断此数据是否已经存在
                bool isDataExist = _bllSystemUser.Exists(modelSystemUser.F_USER_ID);

                if (isDataExist)
                {
                    //已经存在判断是否更新
                    DialogResult dialogResult = XtraMessageBox.Show("当前数据已存在,是否更新?", "选择", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (dialogResult == DialogResult.No)
                    {
                        return;
                    }

                    //更新数据
                    bool status = _bllSystemUser.Update(modelSystemUser);

                    //获得当前rowhandle
                    int rowhandle = gvList.FocusedRowHandle;

                    //绑定数据
                    BindGridview();

                    //设置焦点行
                    gvList.FocusedRowHandle = rowhandle;


                    if (status)
                    {
                        XtraMessageBox.Show("此数据已更新。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        XtraMessageBox.Show("没有数据被更新,操作中断。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                else
                {
                    _bllSystemUser.Add(modelSystemUser);


                    //获得当前rowhandle
                    int rowhandle = gvList.FocusedRowHandle;

                    //绑定数据
                    BindGridview();

                    //设置焦点行
                    gvList.FocusedRowHandle = rowhandle + 1;


                    XtraMessageBox.Show("此数据已增加。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                Log.Error(GetType() + "->" + ApplicationCommon.GetMethodName() + "---FAILED", ex);
                throw ex;
            }
        }