コード例 #1
0
 private void LoadMemberInfo()
 {
     Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.currentUserId);
     if (member == null)
     {
         base.GotoResourceNotFound();
         return;
     }
     this.drpMemberRankList.SelectedValue = new int?(member.GradeId);
     this.lblLoginNameValue.Text          = member.Username;
     this.lblRegsTimeValue.Time           = member.CreateDate;
     this.lblLastLoginTimeValue.Time      = member.LastLoginDate;
     this.lblTotalAmountValue.Text        = Globals.FormatMoney(member.Expenditure);
     this.txtRealName.Text         = member.RealName;
     this.calBirthday.SelectedDate = member.BirthDate;
     this.rsddlRegion.SetSelectedRegionId(new int?(member.RegionId));
     this.txtAddress.Text           = Globals.HtmlDecode(member.Address);
     this.txtQQ.Text                = member.QQ;
     this.txtMSN.Text               = member.MSN;
     this.txtTel.Text               = member.TelPhone;
     this.txtCellPhone.Text         = member.CellPhone;
     this.txtprivateEmail.Text      = member.Email;
     this.gender.SelectedValue      = member.Gender;
     this.ddlApproved.SelectedValue = new bool?(member.IsApproved);
     this.txtWangwang.Text          = Globals.HtmlDecode(member.Wangwang);
 }
コード例 #2
0
        private void Notify_Finished(object sender, FinishedEventArgs e)
        {
            System.DateTime now = System.DateTime.Now;
            Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(this.InpourRequest.UserId, false) as Hidistro.Membership.Context.Member;
            decimal           balance           = member.Balance + this.InpourRequest.InpourBlance;
            BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo();

            balanceDetailInfo.UserId    = this.InpourRequest.UserId;
            balanceDetailInfo.UserName  = member.Username;
            balanceDetailInfo.TradeDate = now;
            balanceDetailInfo.TradeType = TradeTypes.SelfhelpInpour;
            balanceDetailInfo.Income    = new decimal?(this.InpourRequest.InpourBlance);
            balanceDetailInfo.Balance   = balance;
            balanceDetailInfo.InpourId  = this.InpourRequest.InpourId;
            if (this.paymode != null)
            {
                balanceDetailInfo.Remark = "充值支付方式:" + this.paymode.Name;
            }
            if (PersonalHelper.Recharge(balanceDetailInfo))
            {
                Hidistro.Membership.Context.Users.ClearUserCache(member);
                this.ResponseStatus(true, "success");
            }
            else
            {
                PersonalHelper.RemoveInpourRequest(this.InpourId);
                this.ResponseStatus(false, "fail");
            }
        }
コード例 #3
0
ファイル: ProductData.cs プロジェクト: uvbs/eshopSanQiang
        public override System.Data.DataTable GetSubjectList(SubjectListQuery query)
        {
            StringBuilder stringBuilder = new StringBuilder();

            if (HiContext.Current.User.UserRole == UserRole.Member)
            {
                Hidistro.Membership.Context.Member member = HiContext.Current.User as Hidistro.Membership.Context.Member;
                int memberDiscount = MemberProvider.Instance().GetMemberDiscount(member.GradeId);
                stringBuilder.AppendFormat("SELECT TOP {0} ProductId,ProductName,ProductCode,ShowSaleCounts AS SaleCounts,ShortDescription,", query.MaxNum);
                stringBuilder.Append(" ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160,ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice,");
                stringBuilder.AppendFormat(" CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) = 1 ", member.GradeId);
                stringBuilder.AppendFormat(" THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END AS RankPrice", member.GradeId, memberDiscount);
            }
            else
            {
                stringBuilder.AppendFormat("SELECT TOP {0} ProductId,ProductName,ProductCode,ShowSaleCounts AS SaleCounts,ShortDescription,", query.MaxNum);
                stringBuilder.Append(" ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160,ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,MarketPrice,SalePrice,SalePrice AS RankPrice");
            }
            stringBuilder.Append(" FROM vw_Hishop_BrowseProductList p WHERE ");
            stringBuilder.Append(ProductMasterProvider.BuildProductSubjectQuerySearch(query));
            if (!string.IsNullOrEmpty(query.SortBy))
            {
                stringBuilder.AppendFormat(" ORDER BY {0} {1}", DataHelper.CleanSearchString(query.SortBy), DataHelper.CleanSearchString(query.SortOrder.ToString()));
            }
            System.Data.DataTable        result           = null;
            System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand(stringBuilder.ToString());
            using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand))
            {
                result = DataHelper.ConverDataReaderToDataTable(dataReader);
            }
            return(result);
        }
コード例 #4
0
 private void btnEditUser_Click(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Context.Member member = MemberHelper.GetMember(this.currentUserId);
     if (!member.IsOpenBalance)
     {
         this.ShowMsg("该会员没有开启预付款账户,无法修改交易密码", false);
         return;
     }
     if (string.IsNullOrEmpty(this.txtTransactionPassWord.Text) || this.txtTransactionPassWord.Text.Length > 20 || this.txtTransactionPassWord.Text.Length < 6)
     {
         this.ShowMsg("交易密码不能为空,长度限制在6-20个字符之间", false);
         return;
     }
     if (this.txtTransactionPassWord.Text != this.txtTransactionPassWordCompare.Text)
     {
         this.ShowMsg("输入的两次密码不一致", false);
         return;
     }
     if (member.ChangeTradePassword(this.txtTransactionPassWord.Text))
     {
         Messenger.UserDealPasswordChanged(member, this.txtTransactionPassWord.Text);
         member.OnDealPasswordChanged(new Hidistro.Membership.Context.UserEventArgs(member.Username, null, this.txtTransactionPassWord.Text));
         this.ShowMsg("交易密码修改成功", true);
         return;
     }
     this.ShowMsg("交易密码修改失败", false);
 }
コード例 #5
0
ファイル: BizActorData.cs プロジェクト: davinx/himedi
 public override bool CreateMember(Member member)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO aspnet_Members (UserId, GradeId,ReferralUserId, TradePassword, TradePasswordSalt, TradePasswordFormat, OrderNumber, Expenditure, Points, Balance, TopRegionId, RegionId, RealName, Address, Zipcode, TelPhone, CellPhone, QQ, Wangwang, MSN) VALUES (@UserId, @GradeId, @ReferralUserId, @TradePassword, @TradePasswordSalt, @TradePasswordFormat, @OrderNumber, @Expenditure, @Points, @Balance, @TopRegionId, @RegionId, @RealName, @Address, @Zipcode, @TelPhone, @CellPhone, @QQ, @Wangwang, @MSN)");
     string salt = UserHelper.CreateSalt();
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId);
     this.database.AddInParameter(sqlStringCommand, "GradeId", DbType.Int32, member.GradeId);
     this.database.AddInParameter(sqlStringCommand, "ReferralUserId", DbType.Int32, member.ReferralUserId);
     this.database.AddInParameter(sqlStringCommand, "TradePassword", DbType.String, UserHelper.EncodePassword(member.TradePasswordFormat, member.TradePassword, salt));
     this.database.AddInParameter(sqlStringCommand, "TradePasswordSalt", DbType.String, salt);
     this.database.AddInParameter(sqlStringCommand, "TradePasswordFormat", DbType.Int32, member.TradePasswordFormat);
     this.database.AddInParameter(sqlStringCommand, "OrderNumber", DbType.Int32, member.OrderNumber);
     this.database.AddInParameter(sqlStringCommand, "Expenditure", DbType.Currency, member.Expenditure);
     this.database.AddInParameter(sqlStringCommand, "Points", DbType.Int32, member.Points);
     this.database.AddInParameter(sqlStringCommand, "Balance", DbType.Currency, member.Balance);
     this.database.AddInParameter(sqlStringCommand, "TopRegionId", DbType.Int32, member.TopRegionId);
     this.database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, member.RegionId);
     this.database.AddInParameter(sqlStringCommand, "RealName", DbType.String, member.RealName);
     this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, member.Address);
     this.database.AddInParameter(sqlStringCommand, "Zipcode", DbType.String, member.Zipcode);
     this.database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, member.TelPhone);
     this.database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, member.CellPhone);
     this.database.AddInParameter(sqlStringCommand, "QQ", DbType.String, member.QQ);
     this.database.AddInParameter(sqlStringCommand, "Wangwang", DbType.String, member.Wangwang);
     this.database.AddInParameter(sqlStringCommand, "MSN", DbType.String, member.MSN);
     return (this.database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
コード例 #6
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.LoadParameters();
     if (!this.Page.IsPostBack)
     {
         if (this.userId != 0)
         {
             Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.userId);
             if (member != null)
             {
                 this.litBalance.Text     = member.Balance.ToString("F2");
                 this.litDrawBalance.Text = member.RequestBalance.ToString("F2");
                 this.litUserBalance.Text = (member.Balance - member.RequestBalance).ToString("F2");
                 MemberGradeInfo memberGrade = UnderlingHelper.GetMemberGrade(member.GradeId);
                 if (memberGrade != null)
                 {
                     this.litUser.Text = member.Username + "(" + memberGrade.Name + ")";
                 }
                 else
                 {
                     this.litUser.Text = member.Username;
                 }
             }
         }
         this.BindBalanceDetails();
     }
 }
コード例 #7
0
		protected override void AttachChildControls()
		{
			if (string.IsNullOrEmpty(this.Page.Request["UserId"]) || !int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId))
			{
				base.GotoResourceNotFound();
			}
			this.txtTradeKey = (System.Web.UI.WebControls.TextBox)this.FindControl("txtTradeKey");
			this.txtTradeKey2 = (System.Web.UI.WebControls.TextBox)this.FindControl("txtTradeKey2");
			this.txtQuestion = (System.Web.UI.WebControls.TextBox)this.FindControl("txtQuestion");
			this.txtAnswer = (System.Web.UI.WebControls.TextBox)this.FindControl("txtAnswer");
			this.txtRealName = (System.Web.UI.WebControls.TextBox)this.FindControl("txtRealName");
			this.dropRegions = (RegionSelector)this.FindControl("dropRegions");
			this.txtAddress = (System.Web.UI.WebControls.TextBox)this.FindControl("txtAddress");
			this.txtQQ = (System.Web.UI.WebControls.TextBox)this.FindControl("txtQQ");
			this.txtMSN = (System.Web.UI.WebControls.TextBox)this.FindControl("txtMSN");
			this.txtTel = (System.Web.UI.WebControls.TextBox)this.FindControl("txtTel");
			this.txtHandSet = (System.Web.UI.WebControls.TextBox)this.FindControl("txtHandSet");
			this.btnSaveUser = ButtonManager.Create(this.FindControl("btnSaveUser"));
			this.btnSaveUser.Click += new System.EventHandler(this.btnSaveUser_Click);
			if (!this.Page.IsPostBack)
			{
				this.dropRegions.DataBind();
				Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(this.userId) as Hidistro.Membership.Context.Member;
				this.txtHandSet.Text = member.CellPhone;
			}
		}
コード例 #8
0
 protected void btnEditUser_Click(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.currentUserId);
     member.IsApproved = this.ddlApproved.SelectedValue.Value;
     member.GradeId    = this.drpMemberRankList.SelectedValue.Value;
     member.Wangwang   = Globals.HtmlEncode(this.txtWangwang.Text.Trim());
     member.RealName   = this.txtRealName.Text.Trim();
     if (this.rsddlRegion.GetSelectedRegionId().HasValue)
     {
         member.RegionId    = this.rsddlRegion.GetSelectedRegionId().Value;
         member.TopRegionId = RegionHelper.GetTopRegionId(member.RegionId);
     }
     member.Address   = Globals.HtmlEncode(this.txtAddress.Text);
     member.QQ        = this.txtQQ.Text;
     member.MSN       = this.txtMSN.Text;
     member.TelPhone  = this.txtTel.Text;
     member.CellPhone = this.txtCellPhone.Text;
     if (this.calBirthday.SelectedDate.HasValue)
     {
         member.BirthDate = new System.DateTime?(this.calBirthday.SelectedDate.Value);
     }
     member.Email  = this.txtprivateEmail.Text;
     member.Gender = this.gender.SelectedValue;
     if (!this.ValidationMember(member))
     {
         return;
     }
     if (UnderlingHelper.Update(member))
     {
         this.ShowMsg("成功修改了当前会员的个人资料", true);
         return;
     }
     this.ShowMsg("当前会员的个人信息修改失败", false);
 }
コード例 #9
0
        private void btnAddBalance_Click(object sender, System.EventArgs e)
        {
            int num = 0;

            if (this.txtReCharge.Text.Trim().IndexOf(".") > 0)
            {
                num = this.txtReCharge.Text.Trim().Substring(this.txtReCharge.Text.Trim().IndexOf(".") + 1).Length;
            }
            decimal num2;

            if (!decimal.TryParse(this.txtReCharge.Text.Trim(), out num2) || num > 2)
            {
                this.ShowMsg("本次充值要给当前客户加款的金额只能是数值,且不能超过2位小数", false);
                return;
            }
            if (num2 < -10000000m || num2 > 10000000m)
            {
                this.ShowMsg("金额大小必须在正负1000万之间", false);
                return;
            }
            int userId = int.Parse(this.currentUserId.Value);

            Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(userId, false) as Hidistro.Membership.Context.Member;
            if (member == null || !member.IsOpenBalance)
            {
                this.ShowMsg("本次充值已失败,该用户的预付款还没有开通", false);
                return;
            }
            decimal           balance           = num2 + member.Balance;
            BalanceDetailInfo balanceDetailInfo = new BalanceDetailInfo();

            balanceDetailInfo.UserId    = userId;
            balanceDetailInfo.UserName  = member.Username;
            balanceDetailInfo.TradeDate = System.DateTime.Now;
            balanceDetailInfo.TradeType = TradeTypes.BackgroundAddmoney;
            balanceDetailInfo.Income    = new decimal?(num2);
            balanceDetailInfo.Balance   = balance;
            balanceDetailInfo.Remark    = Globals.HtmlEncode(this.txtRemark.Text.Trim());
            ValidationResults validationResults = Validation.Validate <BalanceDetailInfo>(balanceDetailInfo, new string[]
            {
                "ValBalanceDetail"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMsg(text, false);
                return;
            }
            if (UnderlingHelper.AddUnderlingBalanceDetail(balanceDetailInfo))
            {
                this.txtReCharge.Text = "";
                this.ReBind(false);
            }
        }
コード例 #10
0
ファイル: ForgotPassword.cs プロジェクト: uvbs/eshopSanQiang
 private void btnSetPassword_Click(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.FindUserByUsername(this.txtUserName.Text.Trim());
     if (string.IsNullOrEmpty(this.txtPassword.Text.Trim()) || string.IsNullOrEmpty(this.txtRePassword.Text.Trim()))
     {
         this.ShowMessage("密码不允许为空!", false);
     }
     else
     {
         if (this.txtPassword.Text.Trim() != this.txtRePassword.Text.Trim())
         {
             this.ShowMessage("两次输入的密码需一致", false);
         }
         else
         {
             if (this.txtPassword.Text.Length < System.Web.Security.Membership.Provider.MinRequiredPasswordLength || this.txtPassword.Text.Length > HiConfiguration.GetConfig().PasswordMaxLength)
             {
                 this.ShowMessage(string.Format("密码的长度只能在{0}和{1}个字符之间", System.Web.Security.Membership.Provider.MinRequiredPasswordLength, HiConfiguration.GetConfig().PasswordMaxLength), false);
             }
             else
             {
                 bool flag = false;
                 if (this.dropType.SelectedIndex == 0)
                 {
                     flag = user.ChangePasswordWithAnswer(this.txtUserAnswer.Text, this.txtPassword.Text);
                 }
                 else
                 {
                     if (user is Hidistro.Membership.Context.Member)
                     {
                         Hidistro.Membership.Context.Member member = user as Hidistro.Membership.Context.Member;
                         flag = member.ChangePasswordWithoutAnswer(this.txtPassword.Text);
                     }
                     else
                     {
                         if (user is Hidistro.Membership.Context.Distributor)
                         {
                             Hidistro.Membership.Context.Distributor distributor = user as Hidistro.Membership.Context.Distributor;
                             //flag = distributor.ChangePasswordWithoutAnswer(this.txtPassword.Text);
                         }
                         else
                         {
                             flag = user.ChangePassword(this.txtPassword.Text);
                         }
                     }
                 }
                 if (flag)
                 {
                     Messenger.UserPasswordForgotten(user, this.txtPassword.Text);
                     this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("ForgotPasswordSuccess") + string.Format("?UserName={0}", user.Username));
                 }
                 else
                 {
                     this.ShowMessage("登录密码修改失败,请重试", false);
                 }
             }
         }
     }
 }
コード例 #11
0
ファイル: MemberProcessor.cs プロジェクト: davinx/himedi
 public static LoginUserStatus ValidLogin(Member member)
 {
     if (member == null)
     {
         return LoginUserStatus.InvalidCredentials;
     }
     return Users.ValidateUser(member);
 }
コード例 #12
0
ファイル: MemberProcessor.cs プロジェクト: davinx/himedi
 public static CreateUserStatus CreateMember(Member member)
 {
     if (HiContext.Current.SiteSettings.IsDistributorSettings)
     {
         return Users.CreateUser(member, HiContext.Current.Config.RolesConfiguration.Underling);
     }
     return Users.CreateUser(member, HiContext.Current.Config.RolesConfiguration.Member);
 }
コード例 #13
0
ファイル: ForgotPassword.cs プロジェクト: uvbs/eshopSanQiang
 private void btnSendMobile_Click(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.HiContext.Current.SiteSettings;
     Hidistro.Membership.Core.IUser           user         = Hidistro.Membership.Context.Users.FindUserByUsername(this.txtUserName.Text.Trim());
     if (user is Hidistro.Membership.Context.Member)
     {
         Hidistro.Membership.Context.Member member = user as Hidistro.Membership.Context.Member;
         ForgotPassword.mobileCode = Hidistro.Membership.Context.HiContext.Current.CreateVerifyCode(6);
         string     text;
         SendStatus sendStatus = Messenger.SendSMS(member.CellPhone, "您本次的验证码是:" + ForgotPassword.mobileCode, siteSettings, out text);
         if (sendStatus == SendStatus.NoProvider || sendStatus == SendStatus.ConfigError)
         {
             this.ShowMessage("后台设置错误,请自行联系后台管理员", false);
         }
         else
         {
             if (sendStatus == SendStatus.Fail)
             {
                 this.ShowMessage("发送失败", false);
             }
             else
             {
                 if (sendStatus == SendStatus.Success)
                 {
                     this.ShowMessage("发送成功", true);
                 }
             }
         }
     }
     else
     {
         if (user is Hidistro.Membership.Context.Distributor)
         {
             Hidistro.Membership.Context.Distributor distributor = user as Hidistro.Membership.Context.Distributor;
             ForgotPassword.mobileCode = Hidistro.Membership.Context.HiContext.Current.CreateVerifyCode(6);
             string     text;
             SendStatus sendStatus = Messenger.SendSMS(distributor.CellPhone, "您本次的验证码是:" + ForgotPassword.mobileCode, siteSettings, out text);
             if (sendStatus == SendStatus.NoProvider || sendStatus == SendStatus.ConfigError)
             {
                 this.ShowMessage("后台设置错误,请自行联系后台管理员", false);
             }
             else
             {
                 if (sendStatus == SendStatus.Fail)
                 {
                     this.ShowMessage("发送失败", false);
                 }
                 else
                 {
                     if (sendStatus == SendStatus.Success)
                     {
                         this.ShowMessage("发送成功", true);
                     }
                 }
             }
         }
     }
 }
コード例 #14
0
 private Hidistro.Membership.Context.Member GetMember(string name)
 {
     Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.FindUserByUsername(name) as Hidistro.Membership.Context.Member;
     if (member != null && member.UserRole == Hidistro.Membership.Core.Enums.UserRole.Underling && member.ParentUserId.Value == Hidistro.Membership.Context.HiContext.Current.User.UserId)
     {
         return(member);
     }
     return(null);
 }
コード例 #15
0
 private Hidistro.Membership.Context.Member GetMember(string name)
 {
     Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.FindUserByUsername(name) as Hidistro.Membership.Context.Member;
     if (member != null && member.UserRole == Hidistro.Membership.Core.Enums.UserRole.Member)
     {
         return(member);
     }
     return(null);
 }
コード例 #16
0
 private void btnSendToRank_Click(object sender, System.EventArgs e)
 {
     System.Collections.Generic.IList <MessageBoxInfo> list = new System.Collections.Generic.List <MessageBoxInfo>();
     if (this.rdoName.Checked && !string.IsNullOrEmpty(this.txtMemberNames.Text.Trim()))
     {
         string   text  = this.txtMemberNames.Text.Trim().Replace("\r\n", "\n");
         string[] array = text.Replace("\n", "*").Split(new char[]
         {
             '*'
         });
         for (int i = 0; i < array.Length; i++)
         {
             Hidistro.Membership.Context.Member member = this.GetMember(array[i]);
             if (member != null)
             {
                 list.Add(new MessageBoxInfo
                 {
                     Accepter = array[i],
                     Sernder  = Hidistro.Membership.Context.HiContext.Current.User.Username,
                     Title    = this.MessageTitle,
                     Content  = this.Content
                 });
             }
         }
         if (list.Count <= 0)
         {
             this.ShowMsg("没有要发送的对象", false);
             return;
         }
         SubsiteCommentsHelper.SendMessageToMember(list);
         this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
     }
     if (this.rdoRank.Checked)
     {
         System.Collections.Generic.IList <Hidistro.Membership.Context.Member> list2 = new System.Collections.Generic.List <Hidistro.Membership.Context.Member>();
         list2 = SubsitePromoteHelper.GetMembersByRank(this.rankList.SelectedValue);
         foreach (Hidistro.Membership.Context.Member current in list2)
         {
             list.Add(new MessageBoxInfo
             {
                 Accepter = current.Username,
                 Sernder  = Hidistro.Membership.Context.HiContext.Current.User.Username,
                 Title    = this.MessageTitle,
                 Content  = this.Content
             });
         }
         if (list.Count > 0)
         {
             SubsiteCommentsHelper.SendMessageToMember(list);
             this.ShowMsg(string.Format("成功给{0}个用户发送了消息.", list.Count), true);
             return;
         }
         this.ShowMsg("没有要发送的对象", false);
     }
 }
コード例 #17
0
 private void BindUserAddress()
 {
     if (!Hidistro.Membership.Context.HiContext.Current.User.IsAnonymous)
     {
         Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.HiContext.Current.User as Hidistro.Membership.Context.Member;
         this.txtShipTo.Text = member.RealName;
         this.dropRegions.SetSelectedRegionId(new int?(member.RegionId));
         this.dropRegions.DataBind();
         this.txtAddress.Text   = member.Address;
         this.txtTelPhone.Text  = member.TelPhone;
         this.txtCellPhone.Text = member.CellPhone;
     }
 }
コード例 #18
0
        public static LoginUserStatus ValidLogin(Hidistro.Membership.Context.Member member)
        {
            LoginUserStatus result;

            if (member == null)
            {
                result = LoginUserStatus.InvalidCredentials;
            }
            else
            {
                result = Users.ValidateUser(member);
            }
            return(result);
        }
コード例 #19
0
        public static CreateUserStatus CreateMember(Hidistro.Membership.Context.Member member)
        {
            CreateUserStatus result;

            if (HiContext.Current.SiteSettings.IsDistributorSettings)
            {
                result = Users.CreateUser(member, HiContext.Current.Config.RolesConfiguration.Underling);
            }
            else
            {
                result = Users.CreateUser(member, HiContext.Current.Config.RolesConfiguration.Member);
            }
            return(result);
        }
コード例 #20
0
ファイル: ShoppingData.cs プロジェクト: davinx/himedi
 public override AddCartItemStatus AddLineItem(Member member, int productId, string skuId, int quantity)
 {
     if ((((member == null) || !HiContext.Current.SiteSettings.IsDistributorSettings) || (member.UserRole != UserRole.Underling)) || (member.ParentUserId.Value != HiContext.Current.SiteSettings.UserId.Value))
     {
         return AddCartItemStatus.InvalidUser;
     }
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_distro_ShoppingCart_AddLineItem");
     this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, member.UserId);
     this.database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId);
     this.database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity);
     this.database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     this.database.ExecuteNonQuery(storedProcCommand);
     return AddCartItemStatus.Successed;
 }
コード例 #21
0
ファイル: MemberDetails.cs プロジェクト: uvbs/eshopSanQiang
        private void LoadMemberInfo()
        {
            Hidistro.Membership.Context.Member member = MemberHelper.GetMember(this.currentUserId);
            if (member == null)
            {
                base.GotoResourceNotFound();
                return;
            }
            System.Uri url  = System.Web.HttpContext.Current.Request.Url;
            string     text = (url.Port == 80) ? string.Empty : (":" + url.Port.ToString(System.Globalization.CultureInfo.InvariantCulture));

            this.lblUserLink.Text = string.Concat(new object[]
            {
                string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}://{1}{2}", new object[]
                {
                    url.Scheme,
                    Hidistro.Membership.Context.HiContext.Current.SiteSettings.SiteUrl,
                    text
                }),
                Globals.ApplicationPath,
                "/?ReferralUserId=",
                member.UserId
            });
            this.litUserName.Text      = member.Username;
            this.litIsApproved.Text    = (member.IsApproved ? "通过" : "禁止");
            this.litGrade.Text         = MemberHelper.GetMemberGrade(member.GradeId).Name;
            this.litCreateDate.Text    = member.CreateDate.ToString();
            this.litLastLoginDate.Text = member.LastLoginDate.ToString();
            this.litRealName.Text      = member.RealName;
            this.litBirthDate.Text     = member.BirthDate.ToString();
            this.litAddress.Text       = RegionHelper.GetFullRegion(member.RegionId, "") + member.Address;
            this.litQQ.Text            = member.QQ;
            this.litMSN.Text           = member.MSN;
            this.litTelPhone.Text      = member.TelPhone;
            this.litCellPhone.Text     = member.CellPhone;
            this.litEmail.Text         = member.Email;
            if (member.Gender == Hidistro.Membership.Core.Enums.Gender.Female)
            {
                this.litGender.Text = "女";
                return;
            }
            if (member.Gender == Hidistro.Membership.Core.Enums.Gender.Male)
            {
                this.litGender.Text = "男";
                return;
            }
            this.litGender.Text = "保密";
        }
コード例 #22
0
		private void btnSaveUser_Click(object sender, System.EventArgs e)
		{
			if ((!string.IsNullOrEmpty(this.txtQuestion.Text) && string.IsNullOrEmpty(this.txtAnswer.Text)) || (string.IsNullOrEmpty(this.txtQuestion.Text) && !string.IsNullOrEmpty(this.txtAnswer.Text)))
			{
				this.ShowMessage("密码问题和问题答案要设置的话就两者都必须填写", false);
			}
			else
			{
				Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(this.userId, false) as Hidistro.Membership.Context.Member;
				if (!string.IsNullOrEmpty(this.txtTradeKey.Text))
				{
					if (this.txtTradeKey.Text.Length < 6 || this.txtTradeKey.Text.Length > 20)
					{
						this.ShowMessage("交易密码长度必须为6-20个字符", false);
						return;
					}
					if (string.Compare(this.txtTradeKey.Text, this.txtTradeKey2.Text) != 0)
					{
						this.ShowMessage("两次输入的交易密码不一致", false);
						return;
					}
					member.IsOpenBalance = true;
					member.TradePassword = this.txtTradeKey.Text;
				}
				if (!string.IsNullOrEmpty(this.txtQuestion.Text) && !string.IsNullOrEmpty(this.txtAnswer.Text))
				{
					member.ChangePasswordQuestionAndAnswer("", Globals.HtmlEncode(this.txtQuestion.Text), Globals.HtmlEncode(this.txtAnswer.Text));
				}
				member.RealName = this.txtRealName.Text;
				if (this.dropRegions.GetSelectedRegionId().HasValue)
				{
					member.RegionId = this.dropRegions.GetSelectedRegionId().Value;
					member.TopRegionId = RegionHelper.GetTopRegionId(member.RegionId);
				}
				member.Address = Globals.HtmlEncode(this.txtAddress.Text);
				member.QQ = this.txtQQ.Text;
				member.MSN = this.txtMSN.Text;
				member.TelPhone = this.txtTel.Text;
				member.CellPhone = this.txtHandSet.Text;
				if (Hidistro.Membership.Context.Users.UpdateUser(member))
				{
					string oldPassword = member.ResetTradePassword(member.Username);
					member.ChangeTradePassword(oldPassword, member.TradePassword);
					this.Page.Response.Redirect(Globals.ApplicationPath + "/user/MyAccountSummary.aspx");
				}
			}
		}
コード例 #23
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.LoadParameters();
     if (!this.Page.IsPostBack)
     {
         int userId;
         if (int.TryParse(this.Page.Request.QueryString["userId"], out userId))
         {
             Hidistro.Membership.Context.Member member = MemberHelper.GetMember(userId);
             if (member != null)
             {
                 this.txtUserName.Text = member.Username;
             }
         }
         this.BindBalanceDrawRequest();
     }
 }
コード例 #24
0
        protected void btnAcceptRefund_Click(object sender, System.EventArgs e)
        {
            OrderInfo orderInfo = SubsiteSalesHelper.GetOrderInfo(this.hidOrderId.Value);

            if (SubsiteSalesHelper.CheckRefund(orderInfo, this.txtAdminRemark.Value, int.Parse(this.hidRefundType.Value), true))
            {
                this.BindOrders();
                decimal amount = orderInfo.GetTotal();
                if (orderInfo.GroupBuyId > 0 && orderInfo.GroupBuyStatus != GroupBuyStatus.Failed)
                {
                    amount = orderInfo.GetTotal() - orderInfo.NeedPrice;
                }
                Hidistro.Membership.Context.Member user = Hidistro.Membership.Context.Users.GetUser(orderInfo.UserId) as Hidistro.Membership.Context.Member;
                Messenger.OrderRefund(user, orderInfo.OrderId, amount);
                this.ShowMsg("成功的确认了订单退款", true);
            }
        }
コード例 #25
0
ファイル: ProductData.cs プロジェクト: uvbs/eshopSanQiang
        public override DbQueryResult GetUnSaleProductList(ProductBrowseQuery query)
        {
            string filter = ProductMasterProvider.BuildUnSaleProductBrowseQuerySearch(query);
            string text   = "ProductId,ProductName,ProductCode,ShowSaleCounts AS SaleCounts, ShortDescription,MarketPrice, ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,SalePrice,Stock";

            if (HiContext.Current.User.UserRole == UserRole.Member)
            {
                Hidistro.Membership.Context.Member member = HiContext.Current.User as Hidistro.Membership.Context.Member;
                int memberDiscount = MemberProvider.Instance().GetMemberDiscount(member.GradeId);
                text += string.Format(",CASE WHEN (SELECT COUNT(*) FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) = 1 ", member.GradeId);
                text += string.Format("THEN (SELECT MemberSalePrice FROM Hishop_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0}) ELSE SalePrice*{1}/100 END AS RankPrice", member.GradeId, memberDiscount);
            }
            else
            {
                text += ",SalePrice as RankPrice";
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_Hishop_BrowseProductList p", "ProductId", filter, text));
        }
コード例 #26
0
        private bool ValidationMember(Hidistro.Membership.Context.Member member)
        {
            ValidationResults validationResults = Validation.Validate <Hidistro.Membership.Context.Member>(member, new string[]
            {
                "ValMember"
            });
            string text = string.Empty;

            if (!validationResults.IsValid)
            {
                foreach (ValidationResult current in (System.Collections.Generic.IEnumerable <ValidationResult>)validationResults)
                {
                    text += Formatter.FormatErrorMessage(current.Message);
                }
                this.ShowMsg(text, false);
            }
            return(validationResults.IsValid);
        }
コード例 #27
0
ファイル: UserProfile.cs プロジェクト: davinx/himedi
 void BindData(Member user)
 {
     this.txtRealName.Text = Globals.HtmlDecode(user.RealName);
     this.txtEmail.Text = Globals.HtmlDecode(user.Email);
     this.gender.SelectedValue = user.Gender;
     DateTime? birthDate = user.BirthDate;
     DateTime minValue = DateTime.MinValue;
     if (birthDate.HasValue ? (birthDate.GetValueOrDefault() > minValue) : false)
     {
         this.calendDate.SelectedDate = user.BirthDate;
     }
     this.dropRegionsSelect.SetSelectedRegionId(new int?(user.RegionId));
     this.txtAddress.Text = Globals.HtmlDecode(user.Address);
     this.txtQQ.Text = Globals.HtmlDecode(user.QQ);
     this.txtMSN.Text = Globals.HtmlDecode(user.MSN);
     this.txtTel.Text = Globals.HtmlDecode(user.TelPhone);
     this.txtHandSet.Text = Globals.HtmlDecode(user.CellPhone);
 }
コード例 #28
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     this.btnQueryBalanceDrawRequest.Click += new System.EventHandler(this.btnQueryBalanceDrawRequest_Click);
     this.grdBalanceDrawRequest.RowCommand += new System.Web.UI.WebControls.GridViewCommandEventHandler(this.grdBalanceDrawRequest_RowCommand);
     this.GetBalanceDrawRequestQuery();
     if (!this.Page.IsPostBack)
     {
         if (int.TryParse(this.Page.Request.QueryString["userId"], out this.userId))
         {
             Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.userId);
             if (member != null)
             {
                 this.txtUserName.Text = member.Username;
             }
         }
         this.BindBalanceDrawRequest();
     }
 }
コード例 #29
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!int.TryParse(this.Page.Request.QueryString["userId"], out this.currentUserId))
     {
         base.GotoResourceNotFound();
         return;
     }
     this.btnEditUser.Click += new System.EventHandler(this.btnEditUser_Click);
     if (!this.Page.IsPostBack)
     {
         Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.currentUserId);
         if (member == null)
         {
             base.GotoResourceNotFound();
             return;
         }
         this.litlUserName.Text = member.Username;
     }
 }
コード例 #30
0
 private void LoadMemberInfo()
 {
     Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.currentUserId);
     if (member == null)
     {
         base.GotoResourceNotFound();
         return;
     }
     Hidistro.Membership.Context.SiteSettings siteSettings = Hidistro.Membership.Context.SettingsManager.GetSiteSettings(Hidistro.Membership.Context.HiContext.Current.User.UserId);
     this.lblUserLink.Text = string.Concat(new object[]
     {
         "http://",
         siteSettings.SiteUrl,
         Globals.ApplicationPath,
         "/?ReferralUserId=",
         member.UserId
     });
     this.litUserName.Text      = member.Username;
     this.litIsApproved.Text    = (member.IsApproved ? "通过" : "禁止");
     this.litGrade.Text         = UnderlingHelper.GetMemberGrade(member.GradeId).Name;
     this.litCreateDate.Text    = member.CreateDate.ToString();
     this.litLastLoginDate.Text = member.LastLoginDate.ToString();
     this.litRealName.Text      = member.RealName;
     this.litBirthDate.Text     = member.BirthDate.ToString();
     this.litAddress.Text       = RegionHelper.GetFullRegion(member.RegionId, "") + member.Address;
     this.litQQ.Text            = member.QQ;
     this.litMSN.Text           = member.MSN;
     this.litTelPhone.Text      = member.TelPhone;
     this.litCellPhone.Text     = member.CellPhone;
     this.litEmail.Text         = member.Email;
     if (member.Gender == Hidistro.Membership.Core.Enums.Gender.Female)
     {
         this.litGender.Text = "女";
         return;
     }
     if (member.Gender == Hidistro.Membership.Core.Enums.Gender.Male)
     {
         this.litGender.Text = "男";
         return;
     }
     this.litGender.Text = "保密";
 }
コード例 #31
0
 private void btnEditUser_Click(object sender, System.EventArgs e)
 {
     Hidistro.Membership.Context.Member member = UnderlingHelper.GetMember(this.currentUserId);
     if (string.IsNullOrEmpty(this.txtNewPassWord.Text) || this.txtNewPassWord.Text.Length > 20 || this.txtNewPassWord.Text.Length < 6)
     {
         this.ShowMsg("登录密码不能为空,长度限制在6-20个字符之间", false);
         return;
     }
     if (this.txtNewPassWord.Text != this.txtPassWordCompare.Text)
     {
         this.ShowMsg("输入的两次密码不一致", false);
         return;
     }
     if (member.ChangePassword(this.txtNewPassWord.Text))
     {
         this.ShowMsg("登录密码修改成功", true);
         return;
     }
     this.ShowMsg("登录密码修改失败", false);
 }
コード例 #32
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Page.Request.QueryString["UserId"]) && !int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId))
     {
         base.GotoResourceNotFound();
         return;
     }
     this.btnSendToRank.Click += new System.EventHandler(this.btnSendToRank_Click);
     if (!this.Page.IsPostBack)
     {
         this.rankList.DataBind();
         if (this.userId > 0)
         {
             Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(this.userId) as Hidistro.Membership.Context.Member;
             if (member == null)
             {
                 base.GotoResourceNotFound();
                 return;
             }
             this.txtMemberNames.Text = member.Username;
         }
     }
 }
コード例 #33
0
ファイル: ProductData.cs プロジェクト: uvbs/eshopSanQiang
        public override DbQueryResult GetUnSaleProductList(ProductBrowseQuery query)
        {
            int    value = HiContext.Current.SiteSettings.UserId.Value;
            string text  = ProductSubsiteProvider.BuildUnSaleProductBrowseQuerySearch(query);

            text += string.Format(" AND DistributorUserId = {0} ", HiContext.Current.SiteSettings.UserId.Value);
            string text2 = "ProductId,ProductName,ProductCode,ShowSaleCounts AS SaleCounts, ShortDescription,MarketPrice, ThumbnailUrl60,ThumbnailUrl100,ThumbnailUrl160, ThumbnailUrl180,ThumbnailUrl220,ThumbnailUrl310,Stock";

            if (HiContext.Current.User.UserRole == UserRole.Underling)
            {
                Hidistro.Membership.Context.Member member = HiContext.Current.User as Hidistro.Membership.Context.Member;
                int memberDiscount = MemberProvider.Instance().GetMemberDiscount(member.GradeId);
                text2 += string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", value);
                text2 += string.Format(",CASE WHEN (SELECT COUNT(*) FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1}) = 1 ", member.GradeId, value);
                text2 += string.Format(" THEN (SELECT MemberSalePrice FROM distro_SKUMemberPrice WHERE SkuId = p.SkuId AND GradeId = {0} AND DistributoruserId = {1})", member.GradeId, value);
                text2 += string.Format(" ELSE (SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0})*{1}/100 END AS RankPrice", value, memberDiscount);
            }
            else
            {
                text2 += string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS SalePrice", value);
                text2 += string.Format(",(SELECT SalePrice FROM vw_distro_SkuPrices WHERE SkuId = p.SkuId AND DistributoruserId = {0}) AS RankPrice", value);
            }
            return(DataHelper.PagingByRownumber(query.PageIndex, query.PageSize, query.SortBy, query.SortOrder, query.IsCount, "vw_distro_BrowseProductList p", "ProductId", text, text2));
        }
コード例 #34
0
ファイル: ForgotPassword.cs プロジェクト: uvbs/eshopSanQiang
        private void btnCheckUserName_Click(object sender, System.EventArgs e)
        {
            string pattern = "[\\u4e00-\\u9fa5a-zA-Z0-9]+[\\u4e00-\\u9fa5_a-zA-Z0-9]*";

            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern);
            if (!regex.IsMatch(this.txtUserName.Text.Trim()) || this.txtUserName.Text.Trim().Length < 2 || this.txtUserName.Text.Trim().Length > 20)
            {
                this.ShowMessage("用户名不能为空,必须以汉字或是字母开头,且在2-20个字符之间", false);
            }
            else
            {
                if (this.txtUserName.Text.Contains(","))
                {
                    this.ShowMessage("用户名不能包含逗号", false);
                }
                else
                {
                    Hidistro.Membership.Core.IUser user = Hidistro.Membership.Context.Users.FindUserByUsername(this.txtUserName.Text.Trim());
                    if (user != null && user.UserRole != Hidistro.Membership.Core.Enums.UserRole.SiteManager && user.UserRole != Hidistro.Membership.Core.Enums.UserRole.Anonymous)
                    {
                        Hidistro.Membership.Core.IUser user2 = Hidistro.Membership.Context.Users.GetUser(0, this.txtUserName.Text.Trim(), false, true);
                        if (user.UserRole == Hidistro.Membership.Core.Enums.UserRole.Distributor)
                        {
                            if (Hidistro.Membership.Context.HiContext.Current.SiteSettings.IsDistributorSettings && user2.UserId != Hidistro.Membership.Context.HiContext.Current.SiteSettings.UserId.Value)
                            {
                                this.ShowMessage("分销商只能在自己的站点或主站上登录", false);
                                return;
                            }
                        }
                        else
                        {
                            if (Hidistro.Membership.Context.HiContext.Current.SiteSettings.IsDistributorSettings)
                            {
                                Hidistro.Membership.Context.Member member = user2 as Hidistro.Membership.Context.Member;
                                if (!member.ParentUserId.HasValue || member.ParentUserId.Value != Hidistro.Membership.Context.HiContext.Current.SiteSettings.UserId)
                                {
                                    this.ShowMessage("您不是本站会员,请您进行注册", false);
                                    return;
                                }
                            }
                            else
                            {
                                Hidistro.Membership.Context.Member member = user2 as Hidistro.Membership.Context.Member;
                                if (member.ParentUserId.HasValue && member.ParentUserId.Value != 0)
                                {
                                    this.ShowMessage("您不是本站会员,请您进行注册", false);
                                    return;
                                }
                            }
                        }
                        if (this.dropType.SelectedIndex == 0)
                        {
                            if (!string.IsNullOrEmpty(user.PasswordQuestion))
                            {
                                if (this.litUserQuestion != null)
                                {
                                    this.litUserQuestion.Text = user.PasswordQuestion.ToString();
                                }
                                this.panelShow("InputAnswer");
                            }
                            else
                            {
                                this.ShowMessage("您没有设置密保问题,无法找回密码,请自行联系管理员修改密码", false);
                            }
                        }
                        else
                        {
                            if (this.dropType.SelectedIndex == 1)
                            {
                                if (user is Hidistro.Membership.Context.Member)
                                {
                                    Hidistro.Membership.Context.Member member = user as Hidistro.Membership.Context.Member;
                                    if (!string.IsNullOrEmpty(member.CellPhone))
                                    {
                                        if (this.litMobile != null)
                                        {
                                            this.litMobile.Text = member.CellPhone.Substring(0, 3) + "****" + member.CellPhone.Substring(7);
                                        }
                                        this.panelShow("CellPhone");
                                    }
                                    else
                                    {
                                        this.ShowMessage("没有设置手机号码", false);
                                    }
                                }
                                else
                                {
                                    if (user is Hidistro.Membership.Context.Distributor)
                                    {
                                        Hidistro.Membership.Context.Distributor distributor = user as Hidistro.Membership.Context.Distributor;
                                        if (!string.IsNullOrEmpty(distributor.CellPhone))
                                        {
                                            if (this.litMobile != null)
                                            {
                                                this.litMobile.Text = distributor.CellPhone.Substring(0, 3) + "****" + distributor.CellPhone.Substring(7);
                                            }
                                            this.panelShow("CellPhone");
                                        }
                                        else
                                        {
                                            this.ShowMessage("没有设置手机号码", false);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (this.dropType.SelectedIndex == 2)
                                {
                                    if (!string.IsNullOrEmpty(user.Email))
                                    {
                                        if (this.litEmail != null)
                                        {
                                            this.litEmail.Text = user.Email;
                                        }
                                        this.panelShow("Email");
                                    }
                                    else
                                    {
                                        this.ShowMessage("没有设置电子邮箱", false);
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        this.ShowMessage("该用户不存在", false);
                    }
                }
            }
        }
コード例 #35
0
ファイル: SubsiteSalesHelper.cs プロジェクト: davinx/himedi
 static void ReducedPoint(OrderInfo order, Member member)
 {
     UserPointInfo point = new UserPointInfo();
     point.OrderId = order.OrderId;
     point.UserId = member.UserId;
     point.TradeDate = DateTime.Now;
     point.TradeType = UserPointTradeType.Refund;
     SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
     point.Reduced = new int?(Convert.ToInt32((decimal)(order.RefundAmount / masterSettings.PointsRate)));
     point.Points = member.Points - point.Reduced.Value;
     SubsiteSalesProvider.Instance().AddMemberPoint(point);
 }
コード例 #36
0
ファイル: BizActorData.cs プロジェクト: davinx/himedi
 public override bool UpdateUnderling(Member underling)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE distro_Members SET GradeId = @GradeId,IsOpenBalance = @IsOpenBalance, TopRegionId=@TopRegionId, RegionId = @RegionId, RealName = @RealName, Address = @Address, Zipcode = @Zipcode, TelPhone = @TelPhone, CellPhone = @CellPhone, QQ = @QQ, Wangwang = @Wangwang, MSN = @MSN WHERE UserId = @UserId");
     string str = UserHelper.CreateSalt();
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, underling.UserId);
     this.database.AddInParameter(sqlStringCommand, "GradeId", DbType.Int32, underling.GradeId);
     this.database.AddInParameter(sqlStringCommand, "IsOpenBalance", DbType.Boolean, underling.IsOpenBalance);
     this.database.AddInParameter(sqlStringCommand, "TopRegionId", DbType.Int32, underling.TopRegionId);
     this.database.AddInParameter(sqlStringCommand, "RegionId", DbType.Int32, underling.RegionId);
     this.database.AddInParameter(sqlStringCommand, "RealName", DbType.String, underling.RealName);
     this.database.AddInParameter(sqlStringCommand, "Address", DbType.String, underling.Address);
     this.database.AddInParameter(sqlStringCommand, "Zipcode", DbType.String, underling.Zipcode);
     this.database.AddInParameter(sqlStringCommand, "TelPhone", DbType.String, underling.TelPhone);
     this.database.AddInParameter(sqlStringCommand, "CellPhone", DbType.String, underling.CellPhone);
     this.database.AddInParameter(sqlStringCommand, "QQ", DbType.String, underling.QQ);
     this.database.AddInParameter(sqlStringCommand, "Wangwang", DbType.String, underling.Wangwang);
     this.database.AddInParameter(sqlStringCommand, "MSN", DbType.String, underling.MSN);
     return (this.database.ExecuteNonQuery(sqlStringCommand) == 1);
 }
コード例 #37
0
ファイル: MemberHelper.cs プロジェクト: davinx/himedi
 public static bool Update(Member member)
 {
     bool flag = Users.UpdateUser(member);
     if (flag)
     {
         EventLogs.WriteOperationLog(Privilege.EditMember, string.Format(CultureInfo.InvariantCulture, "修改了编号为 “{0}” 的会员", new object[] { member.UserId }));
     }
     return flag;
 }
コード例 #38
0
        private string UserLogin(string userName, string password)
        {
            string text = string.Empty;

            Hidistro.Membership.Context.Member member = Hidistro.Membership.Context.Users.GetUser(0, userName, false, true) as Hidistro.Membership.Context.Member;
            string result;

            if (member == null || member.IsAnonymous)
            {
                result = "用户名或密码错误";
            }
            else
            {
                if (Hidistro.Membership.Context.HiContext.Current.SiteSettings.IsDistributorSettings)
                {
                    if (!member.ParentUserId.HasValue || member.ParentUserId.Value != Hidistro.Membership.Context.HiContext.Current.SiteSettings.UserId)
                    {
                        result = "您不是本站会员,请您进行注册";
                        return(result);
                    }
                }
                else
                {
                    if (member.ParentUserId.HasValue && member.ParentUserId.Value != 0)
                    {
                        result = "您不是本站会员,请您进行注册";
                        return(result);
                    }
                }
                member.Password = password;
                Hidistro.Membership.Core.Enums.LoginUserStatus loginUserStatus = MemberProcessor.ValidLogin(member);
                if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.Success)
                {
                    System.Web.HttpCookie authCookie = System.Web.Security.FormsAuthentication.GetAuthCookie(member.Username, false);
                    Hidistro.Membership.Core.IUserCookie userCookie = member.GetUserCookie();
                    userCookie.WriteCookie(authCookie, 30, false);
                    ShoppingCartInfo       shoppingCart           = ShoppingCartProcessor.GetShoppingCart();
                    CookieShoppingProvider cookieShoppingProvider = CookieShoppingProvider.Instance();
                    bool flag = false;
                    if (cookieShoppingProvider.GetShoppingCart() != null && cookieShoppingProvider.GetShoppingCart().GetQuantity() > 0)
                    {
                        flag = true;
                    }
                    cookieShoppingProvider.ClearShoppingCart();
                    Hidistro.Membership.Context.HiContext.Current.User = member;
                    if (shoppingCart != null && flag)
                    {
                        ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart);
                    }
                    member.OnLogin();
                }
                else
                {
                    if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.AccountPending)
                    {
                        text = "用户账号还没有通过审核";
                    }
                    else
                    {
                        if (loginUserStatus == Hidistro.Membership.Core.Enums.LoginUserStatus.InvalidCredentials)
                        {
                            text = "用户名或密码错误";
                        }
                        else
                        {
                            text = "未知错误";
                        }
                    }
                }
                result = text;
            }
            return(result);
        }
コード例 #39
0
ファイル: Distributor.cs プロジェクト: davinx/himedi
 public static void OnFindPassword(Member member, UserEventArgs args)
 {
     if (FindPassword != null)
     {
         FindPassword(member, args);
     }
 }
コード例 #40
0
ファイル: EditUnderling.aspx.cs プロジェクト: davinx/himedi
 private bool ValidationMember(Member member)
 {
     ValidationResults results = Hishop.Components.Validation.Validation.Validate<Member>(member, new string[] { "ValMember" });
     string msg = string.Empty;
     if (!results.IsValid)
     {
         foreach (ValidationResult result in (IEnumerable<ValidationResult>)results)
         {
             msg = msg + Formatter.FormatErrorMessage(result.Message);
         }
         ShowMsg(msg, false);
     }
     return results.IsValid;
 }
コード例 #41
0
ファイル: ShoppingProvider.cs プロジェクト: davinx/himedi
 public abstract bool GetShoppingProductInfo(Member member, int productId, string skuId, out ProductSaleStatus saleStatus, out int stock, out int totalQuantity);
コード例 #42
0
ファイル: ShoppingProvider.cs プロジェクト: davinx/himedi
 public abstract ShoppingCartItemInfo GetCartItemInfo(Member member, int productId, string skuId, int quantity);
コード例 #43
0
ファイル: PromotionData.cs プロジェクト: davinx/himedi
 public override IList<Member> GetMembersByRank(int? gradeId)
 {
     DbCommand sqlStringCommand;
     IList<Member> list = new List<Member>();
     if (gradeId > 0)
     {
         sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM vw_distro_Members WHERE GradeId=@GradeId AND ParentUserId=@ParentUserId");
         database.AddInParameter(sqlStringCommand, "GradeId", DbType.Int32, gradeId);
         database.AddInParameter(sqlStringCommand, "ParentUserId", DbType.Int32, HiContext.Current.User.UserId);
     }
     else
     {
         sqlStringCommand = database.GetSqlStringCommand("SELECT * FROM vw_distro_Members WHERE ParentUserId=@ParentUserId");
         database.AddInParameter(sqlStringCommand, "ParentUserId", DbType.Int32, HiContext.Current.User.UserId);
     }
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             Member item = new Member(UserRole.Member);
             item.UserId = (int)reader["UserId"];
             item.Email = reader["Email"].ToString();
             item.Username = reader["UserName"].ToString();
             list.Add(item);
         }
     }
     return list;
 }
コード例 #44
0
ファイル: Distributor.cs プロジェクト: davinx/himedi
 public static void OnRegister(Member member, UserEventArgs args)
 {
     if (Register != null)
     {
         Register(member, args);
     }
 }
コード例 #45
0
ファイル: Register.cs プロジェクト: davinx/himedi
        void btnRegister_Click(object sender, EventArgs e)
        {
            if (!this.chkAgree.Checked)
            {
                this.ShowMessage("您必须先阅读并同意注册协议", false);
            }
            else if (string.Compare(this.txtUserName.Text.Trim().ToLower(CultureInfo.InvariantCulture), "anonymous", false, CultureInfo.InvariantCulture) == 0)
            {
                this.ShowMessage("已经存在相同的用户名", false);
            }
            else
            {
                string pattern = @"[\u4e00-\u9fa5a-zA-Z]+[\u4e00-\u9fa5_a-zA-Z0-9]*";
                Regex regex = new Regex(pattern);
                if ((!regex.IsMatch(this.txtUserName.Text.Trim()) || (this.txtUserName.Text.Trim().Length < 2)) || (this.txtUserName.Text.Trim().Length > 20))
                {
                    this.ShowMessage("用户名不能为空,必须以汉字或是字母开头,且在2-20个字符之间", false);
                }
                else if (string.Compare(this.txtPassword.Text, this.txtPassword2.Text) != 0)
                {
                    this.ShowMessage("两次输入的密码不相同", false);
                }
                else if (this.txtPassword.Text.Length == 0)
                {
                    this.ShowMessage("密码不能为空", false);
                }
                else if ((this.txtPassword.Text.Length < Membership.Provider.MinRequiredPasswordLength) || (this.txtPassword.Text.Length > HiConfiguration.GetConfig().PasswordMaxLength))
                {
                    this.ShowMessage(string.Format("密码的长度只能在{0}和{1}个字符之间", Membership.Provider.MinRequiredPasswordLength, HiConfiguration.GetConfig().PasswordMaxLength), false);
                }
                else
                {
                    Member member = null;
                    if (HiContext.Current.SiteSettings.IsDistributorSettings)
                    {
                        member = new Member(UserRole.Underling);
                        member.ParentUserId = HiContext.Current.SiteSettings.UserId;
                    }
                    else
                    {
                        member = new Member(UserRole.Member);
                    }
                    if (HiContext.Current.ReferralUserId > 0)
                    {
                        member.ReferralUserId = new int?(HiContext.Current.ReferralUserId);
                    }
                    member.GradeId = MemberProcessor.GetDefaultMemberGrade();
                    member.Username = Globals.HtmlEncode(this.txtUserName.Text.Trim());
                    member.Email = this.txtEmail.Text;
                    member.Password = this.txtPassword.Text;
                    member.PasswordFormat = MembershipPasswordFormat.Hashed;
                    member.TradePasswordFormat = MembershipPasswordFormat.Hashed;
                    member.TradePassword = this.txtPassword.Text;
                    member.IsApproved = true;
                    member.RealName = string.Empty;
                    member.Address = string.Empty;
                    if (this.ValidationMember(member))
                    {
                        if (!HiContext.Current.CheckVerifyCode(this.txtNumber.Text))
                        {
                            this.ShowMessage("验证码输入错误", false);
                        }
                        else
                        {
                            switch (MemberProcessor.CreateMember(member))
                            {
                                case CreateUserStatus.UnknownFailure:
                                    this.ShowMessage("未知错误", false);
                                    return;

                                case CreateUserStatus.Created:
                                {
                                    Messenger.UserRegister(member, this.txtPassword.Text);
                                    member.OnRegister(new UserEventArgs(member.Username, this.txtPassword.Text, null));
                                    IUser user = Users.GetUser(0, member.Username, false, true);
                                    ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart();
                                    CookieShoppingProvider.Instance().ClearShoppingCart();
                                    HiContext.Current.User = user;
                                    if (shoppingCart != null)
                                    {
                                        ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart);
                                    }
                                    HttpCookie authCookie = FormsAuthentication.GetAuthCookie(member.Username, false);
                                    user.GetUserCookie().WriteCookie(authCookie, 30, false);
                                    this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("registerUserSave") + "?UserId=" + user.UserId);
                                    return;
                                }
                                case CreateUserStatus.DuplicateUsername:
                                    this.ShowMessage("已经存在相同的用户名", false);
                                    return;

                                case CreateUserStatus.DuplicateEmailAddress:
                                    this.ShowMessage("电子邮件地址已经存在", false);
                                    return;

                                case CreateUserStatus.InvalidFirstCharacter:
                                case CreateUserStatus.Updated:
                                case CreateUserStatus.Deleted:
                                case CreateUserStatus.InvalidQuestionAnswer:
                                    return;

                                case CreateUserStatus.DisallowedUsername:
                                    this.ShowMessage("用户名禁止注册", false);
                                    return;

                                case CreateUserStatus.InvalidPassword:
                                    this.ShowMessage("无效的密码", false);
                                    return;

                                case CreateUserStatus.InvalidEmail:
                                    this.ShowMessage("无效的电子邮件地址", false);
                                    return;
                            }
                        }
                    }
                }
            }
        }
コード例 #46
0
ファイル: ShoppingProvider.cs プロジェクト: davinx/himedi
 public abstract AddCartItemStatus AddLineItem(Member member, int productId, string skuId, int quantity);
コード例 #47
0
ファイル: OrderHelper.cs プロジェクト: davinx/himedi
 static void ReduceDeduct(OrderInfo order, Member member)
 {
     int referralDeduct = HiContext.Current.SiteSettings.ReferralDeduct;
     if (((referralDeduct > 0) && member.ReferralUserId.HasValue) && (member.ReferralUserId.Value > 0))
     {
         IUser user = Users.GetUser(member.ReferralUserId.Value, false);
         if ((user != null) && (user.UserRole == UserRole.Member))
         {
             Member member2 = user as Member;
             if ((member.ParentUserId == member2.ParentUserId) && member2.IsOpenBalance)
             {
                 decimal num2 = member2.Balance - ((order.RefundAmount * referralDeduct) / 100M);
                 BalanceDetailInfo balanceDetail = new BalanceDetailInfo();
                 balanceDetail.UserId = member2.UserId;
                 balanceDetail.UserName = member2.Username;
                 balanceDetail.TradeDate = DateTime.Now;
                 balanceDetail.TradeType = TradeTypes.ReferralDeduct;
                 balanceDetail.Expenses = new decimal?((order.RefundAmount * referralDeduct) / 100M);
                 balanceDetail.Balance = num2;
                 balanceDetail.Remark = string.Format("退回提成因为'{0}'的订单{1}已退款", order.Username, order.OrderId);
                 MemberProvider.Instance().InsertBalanceDetail(balanceDetail);
             }
         }
     }
 }
コード例 #48
0
ファイル: ShoppingProvider.cs プロジェクト: davinx/himedi
 public abstract ShoppingCartItemInfo GetCartItemInfo(Member member, int productId, string skuId, string skuContent, int quantity, out ProductSaleStatus saleStatus, out string sku, out int stock, out int totalQuantity);
コード例 #49
0
ファイル: OrderHelper.cs プロジェクト: davinx/himedi
 static void ReducedPoint(OrderInfo order, Member member)
 {
     UserPointInfo point = new UserPointInfo();
     point.OrderId = order.OrderId;
     point.UserId = member.UserId;
     point.TradeDate = DateTime.Now;
     point.TradeType = UserPointTradeType.Refund;
     point.Reduced = new int?(Convert.ToInt32((decimal)(order.RefundAmount / HiContext.Current.SiteSettings.PointsRate)));
     point.Points = member.Points - point.Reduced.Value;
     SalesProvider.Instance().AddMemberPoint(point);
 }
コード例 #50
0
ファイル: ShoppingProvider.cs プロジェクト: davinx/himedi
 public abstract void UpdateLineItemQuantity(Member member, int productId, string skuId, int quantity);
コード例 #51
0
ファイル: OpenIdEntry.aspx.cs プロジェクト: davinx/himedi
        protected void SkipAlipayOpenId()
        {
            Member member = null;

            if (HiContext.Current.SiteSettings.IsDistributorSettings)
            {
                Member member2 = new Member(UserRole.Underling);
                member2.ParentUserId = HiContext.Current.SiteSettings.UserId;
                member = member2;
            }
            else
            {
                member = new Member(UserRole.Member);
            }
            if (HiContext.Current.ReferralUserId > 0)
            {
                member.ReferralUserId = new int?(HiContext.Current.ReferralUserId);
            }
            member.GradeId = MemberProcessor.GetDefaultMemberGrade();
            member.Username = parameters["real_name"];
            if (string.IsNullOrEmpty(member.Username))
            {
                member.Username = "******" + parameters["user_id"];
            }
            member.Email = parameters["email"];
            if (string.IsNullOrEmpty(member.Email))
            {
                member.Email = GenerateUsername() + "@localhost.com";
            }
            string str = GeneratePassword();
            member.Password = str;
            member.PasswordFormat = MembershipPasswordFormat.Hashed;
            member.TradePasswordFormat = MembershipPasswordFormat.Hashed;
            member.TradePassword = str;
            member.IsApproved = true;
            member.RealName = string.Empty;
            member.Address = string.Empty;
            if (MemberProcessor.CreateMember(member) != CreateUserStatus.Created)
            {
                member.Username = "******" + parameters["user_id"];
                member.Password = member.TradePassword = str;
                if (MemberProcessor.CreateMember(member) != CreateUserStatus.Created)
                {
                    member.Username = GenerateUsername();
                    member.Email = GenerateUsername() + "@localhost.com";
                    member.Password = member.TradePassword = str;
                    if (MemberProcessor.CreateMember(member) != CreateUserStatus.Created)
                    {
                        Response.Write("为您创建随机账户时失败,请重试。");
                        return;
                    }
                }
            }
            UserHelper.BindOpenId(member.Username, parameters["CurrentOpenId"], parameters["HIGW"]);
            HttpCookie authCookie = FormsAuthentication.GetAuthCookie(member.Username, false);
            member.GetUserCookie().WriteCookie(authCookie, 30, false);
            ShoppingCartInfo shoppingCart = ShoppingCartProcessor.GetShoppingCart();
            CookieShoppingProvider.Instance().ClearShoppingCart();
            HiContext.Current.User = member;
            if (shoppingCart != null)
            {
                ShoppingCartProcessor.ConvertShoppingCartToDataBase(shoppingCart);
            }
            if (!string.IsNullOrEmpty(parameters["token"]))
            {
                HttpCookie cookie3 = new HttpCookie("Token_" + HiContext.Current.User.UserId.ToString());
                cookie3.Expires = DateTime.Now.AddMinutes(30.0);
                cookie3.Value = parameters["token"];
                HttpCookie cookie = cookie3;
                HttpContext.Current.Response.Cookies.Add(cookie);
            }
            if (!string.IsNullOrEmpty(parameters["target_url"]))
            {
                Page.Response.Redirect(parameters["target_url"]);
            }
            Page.Response.Redirect(Globals.GetSiteUrls().Home);
        }
コード例 #52
0
ファイル: Distributor.cs プロジェクト: davinx/himedi
 public static void OnLogin(Member member)
 {
     if (Login != null)
     {
         Login(member, new EventArgs());
     }
 }
コード例 #53
0
ファイル: ShoppingData.cs プロジェクト: davinx/himedi
 public override ShoppingCartItemInfo GetCartItemInfo(Member member, int productId, string skuId, string skuContent, int quantity, out ProductSaleStatus saleStatus, out string sku, out int stock, out int totalQuantity)
 {
     saleStatus = ProductSaleStatus.Delete;
     sku = string.Empty;
     stock = 0;
     totalQuantity = quantity;
     ShoppingCartItemInfo info = null;
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_distro_ShoppingCart_GetItemInfo");
     this.database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId);
     this.database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity);
     this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, (member != null) ? member.UserId : 0);
     this.database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(storedProcCommand, "GradeId", DbType.Int32, (member != null) ? member.GradeId : 0);
     this.database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     using (IDataReader reader = this.database.ExecuteReader(storedProcCommand))
     {
         if (!reader.Read())
         {
             return info;
         }
         saleStatus = (ProductSaleStatus) ((int) reader["SaleStatus"]);
         if (reader["SKU"] != DBNull.Value)
         {
             sku = (string) reader["SKU"];
         }
         stock = (int) reader["Stock"];
         int num = (int) reader["AlertStock"];
         if (stock <= num)
         {
             saleStatus = ProductSaleStatus.UnSale;
         }
         if (reader["TotalQuantity"].ToString() != "")
         {
             totalQuantity = (int) reader["TotalQuantity"];
         }
         string name = reader["ProductName"].ToString();
         int categoryId = 0;
         if (DBNull.Value != reader["CategoryId"])
         {
             categoryId = (int) reader["CategoryId"];
         }
         int weight = 0;
         if (DBNull.Value != reader["Weight"])
         {
             weight = (int) reader["Weight"];
         }
         decimal memberPrice = (decimal) reader["SalePrice"];
         string str2 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl40"])
         {
             str2 = reader["ThumbnailUrl40"].ToString();
         }
         string str3 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl60"])
         {
             str3 = reader["ThumbnailUrl60"].ToString();
         }
         string str4 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl100"])
         {
             str4 = reader["ThumbnailUrl100"].ToString();
         }
         int purchaseGiftId = 0;
         int giveQuantity = 0;
         int wholesaleDiscountId = 0;
         string purchaseGiftName = null;
         string wholesaleDiscountName = null;
         decimal? discountRate = null;
         if (member != null)
         {
             if (reader.NextResult() && reader.Read())
             {
                 if (DBNull.Value != reader["ActivityId"])
                 {
                     purchaseGiftId = (int) reader["ActivityId"];
                 }
                 if (DBNull.Value != reader["Name"])
                 {
                     purchaseGiftName = reader["Name"].ToString();
                 }
                 if ((DBNull.Value != reader["BuyQuantity"]) && (DBNull.Value != reader["GiveQuantity"]))
                 {
                     giveQuantity = (totalQuantity / ((int) reader["BuyQuantity"])) * ((int) reader["GiveQuantity"]);
                 }
             }
             if (reader.NextResult() && reader.Read())
             {
                 if (DBNull.Value != reader["ActivityId"])
                 {
                     wholesaleDiscountId = (int) reader["ActivityId"];
                 }
                 if (DBNull.Value != reader["Name"])
                 {
                     wholesaleDiscountName = reader["Name"].ToString();
                 }
                 if (DBNull.Value != reader["DiscountValue"])
                 {
                     discountRate = new decimal?(Convert.ToDecimal(reader["DiscountValue"]));
                 }
             }
         }
         return new ShoppingCartItemInfo(skuId, productId, sku, name, memberPrice, skuContent, totalQuantity, weight, purchaseGiftId, purchaseGiftName, giveQuantity, wholesaleDiscountId, wholesaleDiscountName, discountRate, categoryId, str2, str3, str4);
     }
 }
コード例 #54
0
ファイル: Distributor.cs プロジェクト: davinx/himedi
 public static void OnPasswordChanged(Member member, UserEventArgs args)
 {
     if (PasswordChanged != null)
     {
         PasswordChanged(member, args);
     }
 }
コード例 #55
0
ファイル: ShoppingData.cs プロジェクト: davinx/himedi
 public override bool GetShoppingProductInfo(Member member, int productId, string skuId, out ProductSaleStatus saleStatus, out int stock, out int totalQuantity)
 {
     saleStatus = ProductSaleStatus.Delete;
     stock = 0;
     totalQuantity = 0;
     bool flag = false;
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT Stock,SaleStatus,AlertStock FROM Hishop_Skus s INNER JOIN distro_Products p ON s.ProductId=p.ProductId WHERE s.ProductId=@ProductId AND s.SkuId=@SkuId AND p.DistributorUserId=@DistributorUserId;SELECT Quantity FROM distro_ShoppingCarts sc WHERE sc.ProductId=@ProductId AND sc.SkuId=@SkuId AND sc.UserId=@UserId AND sc.DistributorUserId=@DistributorUserId");
     this.database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId);
     this.database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         if (reader.Read())
         {
             saleStatus = (ProductSaleStatus) ((int) reader["SaleStatus"]);
             stock = (int) reader["Stock"];
             int num = (int) reader["AlertStock"];
             if (stock <= num)
             {
                 saleStatus = ProductSaleStatus.UnSale;
             }
             flag = true;
         }
         if (reader.NextResult() && reader.Read())
         {
             totalQuantity = (int) reader["Quantity"];
         }
     }
     return flag;
 }
コード例 #56
0
ファイル: UnderlingHelper.cs プロジェクト: davinx/himedi
 public static bool Update(Member underling)
 {
     return Users.UpdateUser(underling);
 }
コード例 #57
0
ファイル: ShoppingData.cs プロジェクト: davinx/himedi
 public override void UpdateLineItemQuantity(Member member, int productId, string skuId, int quantity)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE distro_ShoppingCarts SET Quantity = @Quantity WHERE UserId = @UserId AND SkuId = @SkuId AND DistributorUserId = @DistributorUserId");
     this.database.AddInParameter(sqlStringCommand, "Quantity", DbType.Int32, quantity);
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, member.UserId);
     this.database.AddInParameter(sqlStringCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     this.database.ExecuteNonQuery(sqlStringCommand);
 }
コード例 #58
0
ファイル: ShoppingData.cs プロジェクト: davinx/himedi
 public override ShoppingCartItemInfo GetCartItemInfo(Member member, int productId, string skuId, int quantity)
 {
     ShoppingCartItemInfo info = null;
     DbCommand storedProcCommand = this.database.GetStoredProcCommand("ss_distro_ShoppingCart_GetItemInfo");
     this.database.AddInParameter(storedProcCommand, "ProductId", DbType.Int32, productId);
     this.database.AddInParameter(storedProcCommand, "Quantity", DbType.Int32, quantity);
     this.database.AddInParameter(storedProcCommand, "UserId", DbType.Int32, (member != null) ? member.UserId : 0);
     this.database.AddInParameter(storedProcCommand, "SkuId", DbType.String, skuId);
     this.database.AddInParameter(storedProcCommand, "GradeId", DbType.Int32, (member != null) ? member.GradeId : 0);
     this.database.AddInParameter(storedProcCommand, "DistributorUserId", DbType.Int32, HiContext.Current.SiteSettings.UserId.Value);
     using (IDataReader reader = this.database.ExecuteReader(storedProcCommand))
     {
         if (!reader.Read())
         {
             return info;
         }
         string sku = string.Empty;
         int num = 0;
         if (reader["SKU"] != DBNull.Value)
         {
             sku = (string) reader["SKU"];
         }
         if (reader["TotalQuantity"].ToString() != "")
         {
             num = (int) reader["TotalQuantity"];
         }
         string name = reader["ProductName"].ToString();
         int categoryId = 0;
         if (DBNull.Value != reader["CategoryId"])
         {
             categoryId = (int) reader["CategoryId"];
         }
         int weight = 0;
         if (DBNull.Value != reader["Weight"])
         {
             weight = (int) reader["Weight"];
         }
         decimal memberPrice = (decimal) reader["SalePrice"];
         string str3 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl40"])
         {
             str3 = reader["ThumbnailUrl40"].ToString();
         }
         string str4 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl60"])
         {
             str4 = reader["ThumbnailUrl60"].ToString();
         }
         string str5 = string.Empty;
         if (DBNull.Value != reader["ThumbnailUrl100"])
         {
             str5 = reader["ThumbnailUrl100"].ToString();
         }
         int purchaseGiftId = 0;
         int giveQuantity = 0;
         int wholesaleDiscountId = 0;
         string purchaseGiftName = null;
         string wholesaleDiscountName = null;
         decimal? discountRate = null;
         if (reader.NextResult() && reader.Read())
         {
             if (DBNull.Value != reader["ActivityId"])
             {
                 purchaseGiftId = (int) reader["ActivityId"];
             }
             if (DBNull.Value != reader["Name"])
             {
                 purchaseGiftName = reader["Name"].ToString();
             }
             if ((DBNull.Value != reader["BuyQuantity"]) && (DBNull.Value != reader["GiveQuantity"]))
             {
                 giveQuantity = (num / ((int) reader["BuyQuantity"])) * ((int) reader["GiveQuantity"]);
             }
         }
         if (reader.NextResult() && reader.Read())
         {
             if (DBNull.Value != reader["ActivityId"])
             {
                 wholesaleDiscountId = (int) reader["ActivityId"];
             }
             if (DBNull.Value != reader["Name"])
             {
                 wholesaleDiscountName = reader["Name"].ToString();
             }
             if (DBNull.Value != reader["DiscountValue"])
             {
                 discountRate = new decimal?(Convert.ToDecimal(reader["DiscountValue"]));
             }
         }
         string skuContent = string.Empty;
         if (reader.NextResult())
         {
             while (reader.Read())
             {
                 if (!((((reader["AttributeName"] == DBNull.Value) || string.IsNullOrEmpty((string) reader["AttributeName"])) || (reader["ValueStr"] == DBNull.Value)) || string.IsNullOrEmpty((string) reader["ValueStr"])))
                 {
                     object obj2 = skuContent;
                     skuContent = string.Concat(new object[] { obj2, reader["AttributeName"], ":", reader["ValueStr"], "; " });
                 }
             }
         }
         return new ShoppingCartItemInfo(skuId, productId, sku, name, memberPrice, skuContent, num, weight, purchaseGiftId, purchaseGiftName, giveQuantity, wholesaleDiscountId, wholesaleDiscountName, discountRate, categoryId, str3, str4, str5);
     }
 }
コード例 #59
0
ファイル: BizActorData.cs プロジェクト: davinx/himedi
 public override Member GetUnderling(HiMembershipUser membershipUser)
 {
     Member member = null;
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM distro_Members WHERE UserId = @UserId");
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, membershipUser.UserId);
     using (IDataReader reader = this.database.ExecuteReader(sqlStringCommand))
     {
         if (!reader.Read())
         {
             return member;
         }
         member = new Member(UserRole.Underling, membershipUser)
         {
             GradeId = (int)reader["GradeId"],
             ParentUserId = new int?((int)reader["ParentUserId"])
         };
         if (reader["ReferralUserId"] != DBNull.Value)
         {
             member.ReferralUserId = new int?((int)reader["ReferralUserId"]);
         }
         member.IsOpenBalance = (bool)reader["IsOpenBalance"];
         member.TradePassword = (string)reader["TradePassword"];
         member.TradePasswordFormat = (MembershipPasswordFormat)((int)reader["TradePasswordFormat"]);
         member.OrderNumber = (int)reader["OrderNumber"];
         member.Expenditure = (decimal)reader["Expenditure"];
         member.Points = (int)reader["Points"];
         member.Balance = (decimal)reader["Balance"];
         member.RequestBalance = (decimal)reader["RequestBalance"];
         if (reader["TopRegionId"] != DBNull.Value)
         {
             member.TopRegionId = (int)reader["TopRegionId"];
         }
         if (reader["RegionId"] != DBNull.Value)
         {
             member.RegionId = (int)reader["RegionId"];
         }
         if (reader["RealName"] != DBNull.Value)
         {
             member.RealName = (string)reader["RealName"];
         }
         if (reader["Address"] != DBNull.Value)
         {
             member.Address = (string)reader["Address"];
         }
         if (reader["Zipcode"] != DBNull.Value)
         {
             member.Zipcode = (string)reader["Zipcode"];
         }
         if (reader["TelPhone"] != DBNull.Value)
         {
             member.TelPhone = (string)reader["TelPhone"];
         }
         if (reader["CellPhone"] != DBNull.Value)
         {
             member.CellPhone = (string)reader["CellPhone"];
         }
         if (reader["QQ"] != DBNull.Value)
         {
             member.QQ = (string)reader["QQ"];
         }
         if (reader["Wangwang"] != DBNull.Value)
         {
             member.Wangwang = (string)reader["Wangwang"];
         }
         if (reader["MSN"] != DBNull.Value)
         {
             member.MSN = (string)reader["MSN"];
         }
     }
     return member;
 }