コード例 #1
0
 private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
 {
     //确定修改密码
     try
     {
         if (txtOldPwd.Text.Length == 0 || txtNewPwd.Text.Length == 0 || txtConfirmPwd.Text.Length == 0)
         {
             throw new BusinessException("UpdatePwd", "不能为空!");
         }
         if (txtOldPwd.Text.Equals(txtNewPwd.Text))
         {
             throw new BusinessException("UpdatePwd", "新老密码一样!");
         }
         if (!txtNewPwd.Text.Equals(txtConfirmPwd.Text))
         {
             throw new BusinessException("UpdatePwd", "确认密码和新密码不一致!");
         }
         if (!txtOldPwd.Text.Equals(DataSecurity.Decrypt(oper.cnvcOperPwd)))
         {
             throw new BusinessException("UpdatePwd", "输入的旧密码错误!");
         }
         oper.cnvcOperPwd = DataSecurity.Encrypt(txtNewPwd.Text);
         SysManageFacade.UpdatePwd(oper);
         Popup("密码修改成功!");
         //更新会话
         Session[ConstApp.S_OPER] = oper;
     }
     catch (Exception ex)
     {
         Popup(ex.Message);
     }
 }
コード例 #2
0
 private void btnAddOper_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (txtOperName.Text == "admin")
         {
             throw new BusinessException("操作员管理", "操作员添加错误!");
         }
         Oper opers = new Oper();
         opers.cnvcOperName = txtOperName.Text;
         opers.cnvcPwd      = DataSecurity.Encrypt(txtPwd.Text);
         opers.cnnDeptID    = int.Parse(cmbDept.SelectedItem.DataValue.ToString());
         SecurityManage security = new SecurityManage();
         security.AddOper(opers);
         MessageBox.Show(this, "操作员添加成功!", "操作员管理", MessageBoxButtons.OK, MessageBoxIcon.Information);
         BindDept();
     }
     catch (BusinessException bex)
     {
         MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
コード例 #3
0
ファイル: User.cs プロジェクト: kikiwisaka/cashflowKW-API
 public void Update(string userName, string password, bool status, string expiryDate = "")
 {
     this.UserName   = userName;
     this.Password   = DataSecurity.Encrypt(password);
     this.Status     = status;
     this.ExpiryDate = expiryDate;
 }
コード例 #4
0
ファイル: User.cs プロジェクト: kikiwisaka/cashflowKW-API
 public User(string userName, string password, bool status, string expiryDate, string date, string time) : this()
 {
     this.UserName   = userName;
     this.Password   = DataSecurity.Encrypt(password);
     this.CreateDate = date;
     this.CreateTime = time;
     this.Status     = status;
     this.ExpiryDate = expiryDate;
 }
コード例 #5
0
        bool UpdatePwd()
        {
            if (txtPwd.Value.Length == 0)
            {
                alertControl.Enable = true;
                alertControl.Msg    = "请输入操作员初始化密码";
                return(false);
            }

            if (!txtPwd.Value.Equals(txtConfirmPwd.Value))
            {
                alertControl.Enable = true;
                alertControl.Msg    = "密码和确认密码不同,请重新输入";
                return(false);
            }

            try
            {
//				dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnnOperID = "+this.txtOperID.Text);
//				if(dtCount.Rows.Count == 0 ) throw new Exception("操作员信息获取错误!");
//				Oper oper = new Oper(dtCount);
                Oper oper = new Oper();
                oper.cnnOperID = int.Parse(this.txtOperID.Text);
                oper.cnvcPwd   = DataSecurity.Encrypt(this.txtPwd.Value);

                Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                BusiLog busiLog = new BusiLog();
                busiLog.cndOperDate  = DateTime.Now;
                busiLog.cnnSerial    = Guid.NewGuid();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcComments = "修改密码:" + this.txtOperName.Text;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;
                busiLog.cnvcOperType = "BS006";
                busiLog.cnvcSource   = "网站";

                OperFacade.UpdatePwd(oper, busiLog);
            }
            catch (Exception ex)
            {
                alertControl.Enable = true;
                alertControl.Msg    = ex.Message;
                return(false);
            }
            alertControl.Enable = true;
            alertControl.Action = AlertControl.ACTION.Script;
            alertControl.Msg    = "成功更新操作员密码";
            alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');",
                                                "oper_" + txtOperID.Text, txtOperName.Text);
            return(true);
        }
コード例 #6
0
        private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //确定修改密码
            try
            {
                if (txtOldPwd.Text.Length == 0 || txtNewPwd.Text.Length == 0 || txtConfirmPwd.Text.Length == 0)
                {
                    throw new BusinessException("UpdatePwd", "不能为空!");
                }
                if (txtOldPwd.Text.Equals(txtNewPwd.Text))
                {
                    throw new BusinessException("UpdatePwd", "新老密码一样!");
                }
                if (!txtNewPwd.Text.Equals(txtConfirmPwd.Text))
                {
                    throw new BusinessException("UpdatePwd", "确认密码和新密码不一致!");
                }
                if (Session[ConstValue.LOGIN_USER_SESSION] == null)
                {
                    throw new BusinessException("UpdatePwd", "请先登录!");
                }
                Oper oper = (Oper)Session[ConstValue.LOGIN_USER_SESSION];
                if (!txtOldPwd.Text.Equals(DataSecurity.Decrypt(oper.cnvcPwd)))
                {
                    throw new BusinessException("UpdatePwd", "输入的旧密码错误!");
                }
                oper.cnvcPwd = DataSecurity.Encrypt(txtNewPwd.Text);

                Dept    curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept;
                Oper    curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper;
                BusiLog busiLog = new BusiLog();
                busiLog.cndOperDate  = DateTime.Now;
                busiLog.cnnSerial    = Guid.NewGuid();
                busiLog.cnvcOperName = curOper.cnvcOperName;
                busiLog.cnvcComments = "修改密码:" + oper.cnvcOperName;
                busiLog.cnvcDeptID   = curDept.cnvcDeptID;
                busiLog.cnvcDeptName = curDept.cnvcDeptName;
                busiLog.cnvcOperType = "BS006";
                busiLog.cnvcSource   = "网站";

                OperFacade.UpdatePwd(oper, busiLog);
                Session[ConstValue.LOGIN_USER_SESSION] = oper;
                Popup("密码修改成功!");
            }
            catch (Exception ex)
            {
                Popup(ex.Message);
            }
        }
コード例 #7
0
        private async void btnActualizarPerfil_Clicked(object sender, EventArgs e)
        {
            detailLoading = "Actualizando perfil...";
            LoadingPage loading = new LoadingPage(detailLoading);
            await PopupNavigation.PushAsync(loading);

            await Task.Delay(1000);

            try
            {
                var usuarioExiste = usuarios.Where(x => x.UsuarioNombre == txtUsuarioPerfil.Text && x.UsuarioID != userID)
                                    .Select(y => y.UsuarioNombre).FirstOrDefault();

                if (usuarioExiste != null)
                {
                    await PopupNavigation.RemovePageAsync(loading);

                    titleError  = "Usuario incorrecto";
                    detailError = "El nombre de usuario es incorrecto. Intente nuevamente.";
                    await results.Unsuccess(titleError, detailError);
                }
                else
                {
                    claveEncriptada = DataSecurity.Encrypt(txtClavePerfil.Text, "sblw-3hn8-sqoy19");
                    await data.UpdateUsuario(userID, txtNombreRealPerfil.Text, txtCorreoPerfil.Text, txtUsuarioPerfil.Text, claveEncriptada,
                                             perfilUsuario.UsuarioRol, perfilUsuario.Acceso, perfilUsuario.UsuarioEstado);

                    refreshUsuario = txtNombreRealPerfil.Text;
                    await SecureStorage.SetAsync("nombreUsuario", txtNombreRealPerfil.Text);

                    MasterMenuHabitantePage.usuarioRefresh = txtNombreRealPerfil.Text;
                    MasterMenuPage.usuarioRefresh          = txtNombreRealPerfil.Text;
                    await PopupNavigation.RemovePageAsync(loading);

                    titleCorrect  = "Perfil actualizado";
                    detailCorrect = "Se ha actualizado su perfl correctamente.";
                    await results.Success(titleCorrect, detailCorrect);
                }
            }
            catch (Exception)
            {
                await PopupNavigation.RemovePageAsync(loading);

                titleError  = "Error";
                detailError = "Ha ocurrido un error procesando la actualización de datos. Intente nuevamente.";
                await results.Unsuccess(titleError, detailError);
            }
        }
コード例 #8
0
ファイル: LoginFacade.cs プロジェクト: zhenghua75/VIPCust
        public static Oper IsUser(string strOperID, string strOperPwd)
        {
            SqlConnection conn = ConnectionPool.BorrowConnection();
            Oper          oper = null;

            try
            {
                oper            = new Oper();
                oper.cnvcOperID = strOperID;
                oper            = EntityMapping.Get(oper, conn) as Oper;
                if (null == oper)
                {
                    throw new Exception("无此用户");
                }
                if (oper.cndInvalidDate <= DateTime.MinValue)
                {
                    throw new Exception("用户已失效");
                }
                if (oper.cnvcOperPwd != DataSecurity.Encrypt(strOperPwd))
                {
                    throw new Exception("密码无效");
                }
                //写登录日志
                BusiLog loginLog = new BusiLog();
                loginLog.cndOperDate     = Helper.GetSysTime(conn);
                loginLog.cnnBusiSerialNo = Helper.GetSerialNo(conn);
                loginLog.cnvcFuncCode    = "登录";
                loginLog.cnvcOperID      = oper.cnvcOperID;
                loginLog.cnvcComments    = "登录";
                EntityMapping.Create(loginLog, conn);
            }
            catch (Exception ex)
            {
                LogAdapter.WriteFeaturesException(ex);
                throw ex;
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
            return(oper);
        }
コード例 #9
0
        public int AddOper(Oper oper, BusiLog busiLog)
        {
            int iRet = 0;

            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    iRet           = OperIDAccess.GetOperID(trans);
                    oper.cnnOperID = iRet;
                    oper.cnvcPwd   = DataSecurity.Encrypt(oper.cnvcPwd);
                    OperAccess.AddOper(trans, oper);

                    BusiLogAccess.AddBusiLog(trans, busiLog);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
            return(iRet);
        }
コード例 #10
0
        public static void InitPwd(Oper oldOper, Oper oper)
        {
            using (SqlConnection conn = ConnectionPool.BorrowConnection())
            {
                //conn.Open();

                SqlTransaction trans = conn.BeginTransaction();
                try
                {
                    string   strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString();
                    DateTime dtSysTime  = DateTime.Parse(strSysTime);

                    //EntityMapping.Delete(oldOper,trans);

                    SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "update tbOper set cnvcOperPwd='" + DataSecurity.Encrypt("123456") + "' where cnvcOperID='" + oldOper.cnvcOperID + "'");

                    BusiLog busiLog = new BusiLog();
                    busiLog.cndOperDate     = dtSysTime;
                    busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans);
                    //busiLog.cnvcComments = oldOper.cnvcOperName;
                    busiLog.cnvcFuncCode  = "初始密码";
                    busiLog.cnvcOperID    = oper.cnvcOperID;
                    busiLog.cnvcIPAddress = "";
                    EntityMapping.Create(busiLog, trans);
                    trans.Commit();
                }
                catch (SqlException sex)
                {
                    trans.Rollback();
                    LogAdapter.WriteDatabaseException(sex);
                    throw sex;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    LogAdapter.WriteFeaturesException(ex);
                    throw ex;
                }
                finally
                {
                    ConnectionPool.ReturnConnection(conn);
                }
            }
        }
コード例 #11
0
ファイル: OperLogin.cs プロジェクト: zhenghua75/ynhnOilManage
        /// <summary>
        /// 执行登录
        /// </summary>
        /// <returns></returns>
        public Oper Login(out ArrayList lstPurview, out ArrayList lstPage)
        {
            SqlConnection conn = ConnectionPool.BorrowConnection();

            try
            {
                #region 取操作员实体

                DataTable dtOper = OperAccess.GetOperByName(conn, strOperName);
                if (dtOper.Rows.Count > 1)
                {
                    throw new BusinessException("操作员登录", "有同名操作员存在,登录失败!");
                }
                // 取操作员实体
                Oper operLogin = new Oper(dtOper);

                if (null == operLogin)
                {
                    throw new BusinessException("操作员登录", "操作员不存在,登录失败!");
                }
                if (!operLogin.cnbValidate)
                {
                    throw new BusinessException("操作员登录", "账号已失效,登录失败!");
                }
                if (operLogin.cnvcPwd != DataSecurity.Encrypt(strPassword))
                {
                    throw new BusinessException("操作员登录", "操作员密码不正确,登录失败!");
                }

                #endregion


                #region 处理操作人员权限

                // 处理操作人员权限
                lstPurview = new ArrayList();
                lstPage    = new ArrayList();
                DataTable dtOperFunc = OperFuncAccess.GetOneOperFuncList(conn, operLogin.cnnOperID.ToString());
                foreach (DataRow row in dtOperFunc.Rows)
                {
                    OperFunc operFunc = new OperFunc(row);
                    lstPurview.Add(operFunc.cnvcFuncName);
                    lstPage.Add(operFunc.cnvcFuncAddress);
                }

                #endregion

                #region 写登录日志

                // 写登录日志
                LoginLog loginLog = new LoginLog();
                loginLog.cnvcOperName  = strOperName;
                loginLog.cnvcIPAddress = strLoginIP;
                loginLog.cnvcBrowser   = strBrowser;
                loginLog.cndLoginTime  = DateTime.Now;
                EntityMapping.Create(loginLog, conn);

                #endregion

                return(operLogin);
            }
            finally
            {
                ConnectionPool.ReturnConnection(conn);
            }
        }
コード例 #12
0
ファイル: wfmNewUser.aspx.cs プロジェクト: zhenghua75/VIPCust
        private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            //添加用户
            try
            {
                if (this.JudgeIsNull(txtOperID.Text, "操作员编码"))
                {
                    return;
                }
                if (this.JudgeIsNull(txtOperName.Text, "操作员名称"))
                {
                    return;
                }
                if (this.JudgeIsNull(this.txtPwd.Text, "密码"))
                {
                    return;
                }
                if (this.JudgeIsNull(txtPwdConfirm.Text, "密码确认"))
                {
                    return;
                }
                if (GetLength(txtOperID.Text) > 50)
                {
                    throw new Exception("操作员ID过长!");
                }
                if (GetLength(txtOperName.Text) > 50)
                {
                    throw new Exception("操作员姓名过长!");
                }
                if (txtPwd.Text != txtPwdConfirm.Text)
                {
                    throw new Exception("密码不一致");
                }
                Oper newOper = new Oper();
                newOper.cnvcOperID = txtOperID.Text;
                DataTable dtOper = Helper.Query("select * from tbOper where cnvcOperID='" + newOper.cnvcOperID + "'");
                if (dtOper.Rows.Count == 0)
                {
                    newOper.cnvcOperName = txtOperName.Text;
                    newOper.cnvcOperPwd  = DataSecurity.Encrypt(txtPwd.Text);
                    newOper.cnvcDeptID   = ddlDept.SelectedValue;

                    if (txtInvalidDate.Text.Trim() == "")
                    {
                        newOper.cndInvalidDate = DateTime.Parse("9999-12-31");
                    }
                    else
                    {
                        newOper.cndInvalidDate = DateTime.Parse(txtInvalidDate.Text);
                    }
                    newOper.cnvcRoleCode = ddlRoleCode.SelectedValue;
                    if (newOper.cnvcRoleCode == "customer")
                    {
                        newOper.cnvcManager = ddlManager.SelectedValue;
                    }
                    newOper.cnvcComments = txtComments.Text;
                    SysManageFacade.AddOper(newOper, oper);

                    DataTable dtOper2 = Helper.Query("select *,cnvcOperID as cnvcID,cnvcOperName as cnvcName from tbOper");
                    Application[ConstApp.A_OPER] = dtOper2;

                    Popup("新建用户成功!");
                    Clear();
                }
                else
                {
                    Popup("用户已存在!");
                }
            }
            catch (Exception bex)
            {
                Popup(bex.Message);
            }
        }
コード例 #13
0
ファイル: User.cs プロジェクト: kikiwisaka/cashflowKW-API
 public void ChangePassword(string oldPassword, string newPassword)
 {
     //Validate.IsOldPasswordValid(Security.Decrypt(this.password), oldPassword);
     this.Password = DataSecurity.Encrypt(newPassword);
 }
コード例 #14
0
ファイル: User.cs プロジェクト: kikiwisaka/cashflowKW-API
 public string EncodePassword(string password)
 {
     return(DataSecurity.Encrypt(password).ToString());
 }