protected void Page_Load(object sender, EventArgs e) { userEntity = GetSession(SysConfigConst.FrontLoginUser) as MEDIA.Model.User; if (!Page.IsPostBack) { BindDropDownListData(); } }
private User ConstructModel() { string strPwd = Request.Form["txtPwd"]; string strGender = Request.Form["gender"]; DateTime birthday = System.DateTime.Parse(string.Format("{0}-{1}-{2}",Request.Form["txtYear"], Request.Form["txtMonth"],Request.Form["txtDay"])); Guid activeKey = Guid.NewGuid(); User newModel = new User { CreateDate = System.DateTime.Now, FirstName = this.txtFirstName.Text, LastName = this.txtLastName.Text, EmailAddress = this.txtEmail.Text, LoginPwd = EncryptUtil.Encrypt(strPwd), Birthday = birthday, Zip = this.txtZIP.Text, Town = this.txtTown.Text, CountryName = this.ddlCountry.SelectedItem.Text, CountryId = int.Parse(this.ddlCountry.SelectedItem.Value), Address = this.txtAddress.Text, Gender = strGender == "1" ? true : false, IsCheck = false, ActiveKey = activeKey }; return newModel; }
/// <summary> /// Create a new User object. /// </summary> /// <param name="userId">Initial value of the UserId property.</param> public static User CreateUser(global::System.Int32 userId) { User user = new User(); user.UserId = userId; return user; }
/// <summary> /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsers(User user) { base.AddObject("Users", user); }
private void FixupUser(User previousValue, bool skipKeys = false) { if (IsDeserializing) { return; } if (previousValue != null && previousValue.DonateRecords.Contains(this)) { previousValue.DonateRecords.Remove(this); } if (User != null) { if (!User.DonateRecords.Contains(this)) { User.DonateRecords.Add(this); } UserId = User.UserId; } else if (!skipKeys) { UserId = null; } if (ChangeTracker.ChangeTrackingEnabled) { if (ChangeTracker.OriginalValues.ContainsKey("User") && (ChangeTracker.OriginalValues["User"] == User)) { ChangeTracker.OriginalValues.Remove("User"); } else { ChangeTracker.RecordOriginalValue("User", previousValue); } if (User != null && !User.ChangeTracker.ChangeTrackingEnabled) { User.StartTracking(); } } }
/// <summary> /// Regist a new user /// </summary> /// <param name="model">user entity</param> /// <returns>is regist success</returns> public bool Regist(User model) { if (null != model) { IUserRepository iUserRepos = IoCContext.Container.Resolve<IUserRepository>(); int count = iUserRepos.Add(model, false); return count > 0; } else { return false; } }
/// <summary> /// Modify User Profile Information /// </summary> /// <param name="model">User Entity</param> /// <returns>is modify success</returns> public bool Modify(User model) { IUserRepository iUserRepos = IoCContext.Container.Resolve<IUserRepository>(); User oldModel = iUserRepos.GetSingle(m => m.UserId == model.UserId); oldModel.LoginPwd = model.LoginPwd; oldModel.FirstName = model.FirstName; oldModel.LastName = model.LastName; oldModel.Address = model.Address; oldModel.CountryName = model.CountryName; oldModel.CountryId = model.CountryId; oldModel.Town = model.Town; oldModel.Birthday = model.Birthday; oldModel.Zip = model.Zip; return iUserRepos.Update(oldModel, false) > 0; }
protected void Page_Load(object sender, EventArgs e) { model = GetSession(SysConfigConst.FrontLoginUser) as User; frameNum = Request.QueryString["frame"] == null ? "0" : Request.QueryString["frame"]; if (!Page.IsPostBack) { this.lblUserName.Text = model.FirstName; IDonationProjectService iProjectSec = GetBusinessInterface<IDonationProjectService>(); this.RepFoundedPro.DataSource = iProjectSec.GetFoundedProjectsByUserId(model.UserId); this.RepFoundedPro.DataBind(); IDonateRecordService iRecordSec = GetBusinessInterface<IDonateRecordService>(); this.RepDonatedPro.DataSource = iRecordSec.GetDonationProsByUserID(model.UserId); this.RepDonatedPro.DataBind(); BindCountryData(); } }