private void Initialize()
 {
     bo.SessionInstance = new Wicresoft.Session.Session();
     filter             = new BusinessFilter("User");
     filter.AddFilterItem("PKID", userid, Operation.Equal, FilterType.NumberType, AndOr.AND);
     bo.AddFilter(filter);
     bo.Load();
     if (bo.HaveRecord)
     {
         this.Info.Text = "您正在修改" + bo.ChineseName.Value.ToString() + "[" + bo.Alias.Value.ToString() + "]的个人信息<br/><br/>";
     }
 }
Exemple #2
0
        private void btnDel_Click(object sender, ImageClickEventArgs e)
        {
            string PKID;
            int    selectedIndex = -1;

            foreach (DataGridItem item in this.dgUser.Items)
            {
                if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                {
                    if (((System.Web.UI.WebControls.RadioButton)item.Cells[0].Controls[1]).Checked)
                    {
                        selectedIndex = item.ItemIndex;
                        break;
                    }
                }
            }

            if (selectedIndex != -1)
            {
                PKID = this.dgUser.Items[selectedIndex].Cells[1].Text;
                Wicresoft.Session.Session session = new Wicresoft.Session.Session();
                BusinessMapping.User      bo      = new BusinessMapping.User();
                bo.SessionInstance = session;

                BusinessFilter filter = new BusinessFilter("User");
                filter.AddFilterItem("PKID", PKID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
                bo.AddFilter(filter);
                bo.Load();

                if (bo.IsReserved.Value)
                {
                    GlobalFacade.Utils.ShowMessage(Enums.Constants.RecordReserved);
                }
                else
                {
                    bo.ModifyUser.Value = this.MyContext.UserID;
                    bo.ModifyTime.Value = DateTime.Now;
                    bo.IsValid.Value    = false;
                    bo.Update();

                    //BusinessRule.SystemManage.OperationLog rule = new BusinessRule.SystemManage.OperationLog();
                    //rule.WriteOperationLog("用户信息管理", "删除用户信息");

                    // Reload Data
                    ucCustomPaging.LoadData(ucCustomPaging.CurrentPage);
                }
            }
        }
Exemple #3
0
        public void LoadBaseInfo(int pkid)
        {
            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("PKID", pkid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                // 显示基本信息
                PresnetUI(bo);
            }
        }
Exemple #4
0
        /// <summary>
        /// 更新密码
        /// </summary>
        private void Save()
        {
            InputPwd           = GlobalFacade.EncryptionManager.EncrytPassword(this.tbxNewPassword.Text.Trim().ToString());
            bo.SessionInstance = new Wicresoft.Session.Session();
            filter             = new BusinessFilter("User");
            filter.AddFilterItem("PKID", GlobalFacade.SystemContext.GetContext().UserID.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();
            if (bo.HaveRecord)
            {
                bo.Password.Value = InputPwd;

                // 2006-11-20, Tony
                bo.LastModifyPasswordTime.Value = DateTime.Now;

                bo.Update();
            }
        }
Exemple #5
0
        private void validatorOldPwd_ServerValidate(object source, ServerValidateEventArgs args)
        {
            string Alias = GlobalFacade.SystemContext.GetContext().Alias.ToString();

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", Alias, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsActive", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            args.IsValid = GlobalFacade.EncryptionManager.VerifyPassword(this.tbxOldPassword.Text.Trim(), bo.Password.Value);
            this.validatorOldPwd.ErrorMessage = "旧密码输入错误";
        }
Exemple #6
0
        /// <summary>
        /// 更新用户主档信息
        /// </summary>
        /// <param name="session"></param>
        /// <param name="userid"></param>
        private void UpdateUserInfo(Wicresoft.Session.Session session, int userid)
        {
            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = session;

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("PKID", userid.ToString(), Operation.Equal, FilterType.NumberType, AndOr.AND);

            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                bo.Alias.Value       = this.tbxAlias.Text.Trim();
                bo.ChineseName.Value = this.tbxChineseName.Text.Trim();
                bo.EnglishName.Value = this.tbxEnglishName.Text.Trim();
                bo.Gender.Value      = Convert.ToBoolean(this.rbtnGender.SelectedValue);
                bo.IsActive.Value    = this.cbxIsActive.Checked;

                if (this.gpRole.SelectedValue != string.Empty && this.gpRole.SelectedValue != "0")
                {
                    bo.FK_Role.Value = Convert.ToInt32(this.gpRole.SelectedValue);
                }

                bo.Title.Value   = this.tbxTitle.Text.Trim();
                bo.Mobile.Value  = this.tbxMobile.Text.Trim();
                bo.Email.Value   = this.tbxEmail.Text.Trim();
                bo.Address.Value = this.tbxAddress.Text.Trim();

                if (this.tbxBirthday.Text.Trim() != string.Empty)
                {
                    bo.Birthday.Value = Convert.ToDateTime(this.tbxBirthday.Text.Trim());
                }

                bo.Memo.Value = this.tbxMemo.Text.Trim();

                bo.ModifyTime.Value = DateTime.Now;
                bo.ModifyUser.Value = GlobalFacade.SystemContext.GetContext().UserID;
                bo.Update();
            }
        }
        private void Save()
        {
            string InputPwd = EncryptionManager.EncrytPassword(this.tbxNewPassword.Text.Trim().ToString());

            bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            filter             = new BusinessFilter("User");
            filter.AddFilterItem("PKID", userid, Operation.Equal, FilterType.NumberType, AndOr.AND);
            bo.AddFilter(filter);
            bo.Load();
            if (bo.HaveRecord)
            {
                bo.Password.Value = InputPwd;

                // 2006-11-20, Tony
                bo.LastModifyPasswordTime.Value = DateTime.Now;

                bo.Update();
                GlobalFacade.Utils.ShowMessageUrl("提示:您的密码已经成功更新...", "UserList.aspx");
            }
        }
Exemple #8
0
        private void GetCurrentUser()
        {
            string id = System.Web.HttpContext.Current.User.Identity.Name;

            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", id, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord)
            {
                this.currentUser = bo;
            }
            else
            {
                throw new Exception("无法取得当前用户信息!");
            }
        }
Exemple #9
0
        /// <summary>
        /// Process User Login Flow
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        public bool ProcessLogin(string userid, string password)
        {
            BusinessFilter filter = new BusinessFilter("User");

            filter.AddFilterItem("Alias", userid, Operation.Equal, FilterType.StringType, AndOr.AND);
            filter.AddFilterItem("IsValid", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);
            filter.AddFilterItem("IsActive", "1", Operation.Equal, FilterType.NumberType, AndOr.AND);

            BusinessMapping.User bo = new BusinessMapping.User();
            bo.SessionInstance = new Wicresoft.Session.Session();
            bo.AddFilter(filter);
            bo.Load();

            if (bo.HaveRecord && GlobalFacade.EncryptionManager.VerifyPassword(password, bo.Password.Value))
            {
                GlobalFacade.SystemContext context = GlobalFacade.SystemContext.GetContext();
                context.CurrentUser = bo;
                GlobalFacade.SystemContext.SaveContext(context);

                if (NeedModifyPassword())
                {
                    System.Web.HttpContext.Current.Response.Redirect(System.Web.HttpContext.Current.Request.ApplicationPath + "/SystemManage/UserManage/CheckPassword.aspx");
                }
                else
                {
                    System.Web.Security.FormsAuthentication.SetAuthCookie(userid, false);
                    System.Web.HttpContext.Current.Response.Redirect(System.Web.HttpContext.Current.Request.ApplicationPath + "/" + Enums.Constants.DefaultUrl);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }