예제 #1
0
        /// 添加构造函数
        /// </summary>
        /// <param name="gridTable">要添加的对象集合</param>
        public frmPassWordTmpEdit(IList <XModelBase> modelList)
        {
            InitializeComponent();
            this.m_ModelList  = modelList;
            this.m_EditStatus = XEditStatus.AddNew;

            this.txtUseIP.Text = XNetHelper.GetLocalIP4Address();
        }
예제 #2
0
        private void btnApplyPassword_Click(object sender, EventArgs e)
        {
            if (this.txtPassword.Text.Trim() == string.Empty)
            {
                XMessageBox.ShowError("请输入要申请的密码!");
                return;
            }

            XPassWordTmpBusiness business        = this.m_Business as XPassWordTmpBusiness;
            XPassWordTmpInfo     passwordTmpInfo = business.GetTempPasswordInfo(XCommon.LoginUsersInfo.RID)
                                                   as XPassWordTmpInfo;

            if (passwordTmpInfo != null)
            {
                XMessageBox.ShowError("已存在有效期内的密码,请不要重复申请!");
                return;
            }

            int validDays = XHelper.GetInt(ConfigurationManager.AppSettings["PassworkValidDays"]);

            XPassWordTmpInfo newInfo = new XPassWordTmpInfo();

            newInfo.RID          = Guid.NewGuid().ToString();
            newInfo.Password     = this.txtPassword.Text.Trim();
            newInfo.UseStartTime = XHelper.GetFormatedTime(DateTime.Now);
            newInfo.UseEndTime   = XHelper.GetFormatedTime(DateTime.Now.AddDays(validDays));
            newInfo.UserId       = XCommon.LoginUsersInfo.RID;
            newInfo.UserName     = XCommon.LoginUsersInfo.UserName;
            newInfo.UseIP        = XNetHelper.GetLocalIP4Address();
            if (business.Insert(newInfo))
            {
                XMessageBox.ShowRemindMessage("密码申请成功,请等待审核!");
            }
            else
            {
                XMessageBox.ShowError("密码申请失败!");
            }
        }