Example #1
0
        private void SaveAccount()
        {
            ShowShop.BLL.Member.MemberAccount bll = new ShowShop.BLL.Member.MemberAccount();
            ShowShop.Model.Member.MemberAccount model = new ShowShop.Model.Member.MemberAccount();

            model.UserGroup = ChangeHope.Common.StringHelper.StringToInt(this.ddlUserGroup.SelectedValue);
            model.UserId = this.txtUserId.Text;
            model.UserType = ChangeHope.Common.StringHelper.StringToInt(this.ddlUserType.SelectedValue);
            model.State = this.ckbState.Checked ? 1 : 0;
            model.Signed = this.txtSigned.Text;
            model.Question = this.txtQuestion.Text;
            model.PassWord = this.txtPassword.Text;
            model.Answer = txtAnswer.Text;
            model.Email = txtEmail.Text;

            if (ViewState["uid"] != null)
            {
                model.UID = Convert.ToInt32(ViewState["uid"].ToString());
                model.RegisterDate = Convert.ToDateTime(ViewState["RegisterDate"].ToString());
                model.RegisterIP = ViewState["RegisterIP"].ToString();
                model.LastLoginDate = Convert.ToDateTime(ViewState["LastLoginDate"].ToString());
                model.LastLoginIP = ViewState["LastLoginIP"].ToString();
                model.LoginTimes = Convert.ToInt32(ViewState["LoginTimes"].ToString());
                model.Capital = Convert.ToDecimal(ViewState["Capital"].ToString());
                model.Coupons = Convert.ToDecimal(ViewState["Coupons"].ToString());
                model.Points = Convert.ToDecimal(ViewState["Points"].ToString());
                model.PeriodOfValidity = Convert.ToDateTime(ViewState["PeriodOfValidity"].ToString());
                bll.Update(model);
            }
            else
            {
                model.RegisterDate = DateTime.Now;
                model.RegisterIP = Request.UserHostAddress;
                model.LastLoginDate = DateTime.Now;
                model.LastLoginIP = Request.UserHostAddress;
                model.LoginTimes = 0;
                model.Capital = 0;
                model.Coupons = 0;
                model.Points = 0;
                model.PeriodOfValidity = DateTime.Now;
                bll.Add(model);
            }
        }