コード例 #1
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");
            }
        }
コード例 #2
0
 protected void dtlstRegionsSelect_ItemCommand(object source, DataListCommandEventArgs e)
 {
     shippingId = (int)this.dtlstRegionsSelect.DataKeys[e.Item.ItemIndex];
     this.ViewState["shippingId"] = shippingId;
     if (e.CommandName == "Edit")
     {
         ShippingAddressInfo userShippingAddress = PersonalHelper.GetUserShippingAddress(shippingId);
         if (userShippingAddress != null)
         {
             this.txtShipTo.Text = userShippingAddress.ShipTo;
             this.dropRegionsSelect.SetSelectedRegionId(new int?(userShippingAddress.RegionId));
             this.txtAddress.Text        = userShippingAddress.Address;
             this.txtZipcode.Text        = userShippingAddress.Zipcode;
             this.txtTelPhone.Text       = userShippingAddress.TelPhone;
             this.txtCellPhone.Text      = userShippingAddress.CellPhone;
             this.btnCancel.Visible      = true;
             this.btnAddAddress.Visible  = false;
             this.btnEditAddress.Visible = true;
         }
     }
     if (e.CommandName == "Delete")
     {
         if (PersonalHelper.DeleteShippingAddress(shippingId))
         {
             this.ShowMessage("成功的删除了你要删除的记录", true);
             this.BindList();
         }
         else
         {
             this.ShowMessage("删除失败", false);
         }
         shippingId = 0;
     }
 }
コード例 #3
0
        void BindList()
        {
            IList <ShippingAddressInfo> shippingAddress = PersonalHelper.GetShippingAddress(HiContext.Current.User.UserId);

            this.dtlstRegionsSelect.DataSource = shippingAddress;
            this.dtlstRegionsSelect.DataBind();
        }
コード例 #4
0
 void Notify_Finished(object sender, FinishedEventArgs e)
  {
      DateTime now = DateTime.Now;
      TradeTypes selfhelpInpour = TradeTypes.SelfhelpInpour;
      Member user = Users.GetUser(this.InpourRequest.UserId, false) as Member;
      decimal num = user.Balance + this.InpourRequest.InpourBlance;
      BalanceDetailInfo balanceDetails = new BalanceDetailInfo();
      balanceDetails.UserId = this.InpourRequest.UserId;
      balanceDetails.UserName = user.Username;
      balanceDetails.TradeDate = now;
      balanceDetails.TradeType = selfhelpInpour;
      balanceDetails.Income = new decimal?(this.InpourRequest.InpourBlance);
      balanceDetails.Balance = num;
      if (this.paymode != null)
      {
          balanceDetails.Remark = "充值支付方式:" + this.paymode.Name;
      }
      if (PersonalHelper.Recharge(balanceDetails, this.InpourRequest.InpourId))
      {
          Users.ClearUserCache(user);
          this.ResponseStatus(true, "success");
      }
      else
      {
          PersonalHelper.RemoveInpourRequest(this.InpourId);
          this.ResponseStatus(false, "fail");
      }
  }
コード例 #5
0
 protected void btnAddAddress_Click(object sender, System.EventArgs e)
 {
     if (this.ValShippingAddress())
     {
         if (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) >= HiContext.Current.Config.ShippingAddressQuantity)
         {
             this.ShowMessage(string.Format("最多只能添加{0}个收货地址", HiContext.Current.Config.ShippingAddressQuantity), false);
             this.Reset();
         }
         else
         {
             ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo();
             if (PersonalHelper.CreateShippingAddress(shippingAddressInfo))
             {
                 this.ShowMessage("成功的添加了一个收货地址", true);
                 this.Reset();
             }
             else
             {
                 this.ShowMessage("地址已经在,请重新输入一次再试", false);
             }
             this.BindList();
         }
     }
 }
コード例 #6
0
        private void btnConfirm_Click(object sender, System.EventArgs e)
        {
            PaymentModeInfo   paymentMode       = TradeHelper.GetPaymentMode(this.paymentModeId);
            InpourRequestInfo inpourRequestInfo = new InpourRequestInfo
            {
                InpourId     = this.GenerateInpourId(),
                TradeDate    = System.DateTime.Now,
                InpourBlance = this.balance,
                UserId       = HiContext.Current.User.UserId,
                PaymentId    = paymentMode.ModeId
            };

            if (PersonalHelper.AddInpourBlance(inpourRequestInfo))
            {
                string attach = "";
                System.Web.HttpCookie httpCookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    attach = httpCookie.Value;
                }
                string         text           = inpourRequestInfo.InpourId.ToString(System.Globalization.CultureInfo.InvariantCulture);
                PaymentRequest paymentRequest = PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), text, inpourRequestInfo.InpourBlance + (decimal)this.ViewState["PayCharge"], "预付款充值", "操作流水号-" + text, HiContext.Current.User.Email, inpourRequestInfo.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[]
                {
                    paymentMode.Gateway
                })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourNotify_url", new object[]
                {
                    paymentMode.Gateway
                })), attach);
                paymentRequest.SendRequest();
            }
        }
コード例 #7
0
 protected override void AttachChildControls()
 {
     this.litUserName            = (Literal)this.FindControl("litUserName");
     this.litUserPoint           = (Literal)this.FindControl("litUserPoint");
     this.litUserRank            = (Literal)this.FindControl("litUserRank");
     this.litUserLink            = (Literal)this.FindControl("litUserLink");
     this.litNoPayOrderNum       = (Literal)this.FindControl("litNoPayOrderNum");
     this.litNoReplyLeaveWordNum = (Literal)this.FindControl("litNoReplyLeaveWordNum");
     this.litAccountAmount       = (FormatedMoneyLabel)this.FindControl("litAccountAmount");
     this.litRequestBalance      = (FormatedMoneyLabel)this.FindControl("litRequestBalance");
     this.litUseableBalance      = (FormatedMoneyLabel)this.FindControl("litUseableBalance");
     this.hpOrder        = (HyperLink)this.FindControl("hpOrder");
     this.hpMes          = (HyperLink)this.FindControl("hpMes");
     this.hpRepay        = (HyperLink)this.FindControl("hpRepaly");
     this.divBalance     = (HtmlGenericControl)this.FindControl("divBalance");
     this.divOpenBalance = (HtmlGenericControl)this.FindControl("divOpenBalance");
     PageTitle.AddSiteNameTitle("会员中心首页", HiContext.Current.Context);
     if (!this.Page.IsPostBack)
     {
         Member user = Users.GetUser(HiContext.Current.User.UserId, false) as Member;
         if (!user.IsOpenBalance)
         {
             this.divBalance.Visible     = false;
             this.divOpenBalance.Visible = true;
         }
         this.litUserPoint.Text = user.Points.ToString();
         this.litUserName.Text  = user.Username;
         MemberGradeInfo memberGrade = PersonalHelper.GetMemberGrade(user.GradeId);
         if (memberGrade != null)
         {
             this.litUserRank.Text = memberGrade.Name;
         }
         int noPayOrderNum          = 0;
         int noReadMessageNum       = 0;
         int noReplyLeaveCommentNum = 0;
         PersonalHelper.GetStatisticsNum(out noPayOrderNum, out noReadMessageNum, out noReplyLeaveCommentNum);
         this.litNoPayOrderNum.Text       = noPayOrderNum.ToString();
         this.litNoReplyLeaveWordNum.Text = noReplyLeaveCommentNum.ToString();
         this.hpMes.Text              = noReadMessageNum.ToString();
         this.litAccountAmount.Money  = user.Balance;
         this.litRequestBalance.Money = user.RequestBalance;
         this.litUseableBalance.Money = user.Balance - user.RequestBalance;
         if (noPayOrderNum > 0)
         {
             this.hpOrder.Visible     = true;
             this.hpOrder.NavigateUrl = "UserOrders.aspx?orderStatus=" + 1;
         }
         this.hpMes.NavigateUrl = "UserReceivedMessages.aspx";
         if (noReplyLeaveCommentNum > 0)
         {
             this.hpRepay.Visible     = true;
             this.hpRepay.NavigateUrl = "UserConsultations.aspx";
         }
         Uri    url = HttpContext.Current.Request.Url;
         string str = (url.Port == 80) ? string.Empty : (":" + url.Port.ToString(CultureInfo.InvariantCulture));
         this.litUserLink.Text = string.Concat(new object[] { string.Format(CultureInfo.InvariantCulture, "{0}://{1}{2}", new object[] { url.Scheme, HiContext.Current.SiteSettings.SiteUrl, str }), Globals.ApplicationPath, "/?ReferralUserId=", HiContext.Current.User.UserId });
     }
 }
コード例 #8
0
 protected override void AttachChildControls()
 {
     this.dlstPtConsultationReplyed = (ThemedTemplatedList)this.FindControl("dlstPtConsultationReplyed");
     this.pagerConsultationReplyed  = (Pager)this.FindControl("pagerConsultationReplyed");
     PageTitle.AddSiteNameTitle("咨询/已回复", HiContext.Current.Context);
     if (!this.Page.IsPostBack)
     {
         PersonalHelper.ViewProductConsultations();
         this.BindPtConsultationReplyed();
     }
 }
コード例 #9
0
 public override void DataBind()
 {
     this.Items.Clear();
     if (this.AllowNull)
     {
         base.Items.Add(new ListItem(this.NullToDisplay, string.Empty));
     }
     foreach (MemberGradeInfo info in PersonalHelper.GetMemberGrades())
     {
         this.Items.Add(new ListItem(Globals.HtmlDecode(info.Name), info.GradeId.ToString()));
     }
 }
コード例 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = HeaderStringHelper.GetPageTitle(Resources.CalendarAddonResource.AddonName);
            Master.DisabledSidePanel = true;

            CalendarPageContent.Controls.Add(LoadControl(CalendarControl.Location));

            //for personal
            if (SetupInfo.IsPersonal)
            {
                PersonalHelper.AdjustTopNavigator(Master.TopStudioPanel, PersonalPart.WebItem, CalendarAddon.AddonID);
            }
        }
コード例 #11
0
 public override void DataBind()
 {
     this.Items.Clear();
     if (this.AllowNull)
     {
         base.Items.Add(new System.Web.UI.WebControls.ListItem(this.NullToDisplay, string.Empty));
     }
     System.Collections.Generic.IList <MemberGradeInfo> memberGrades = PersonalHelper.GetMemberGrades();
     foreach (MemberGradeInfo current in memberGrades)
     {
         this.Items.Add(new System.Web.UI.WebControls.ListItem(Globals.HtmlDecode(current.Name), current.GradeId.ToString()));
     }
 }
コード例 #12
0
        private void BindBalanceDetails()
        {
            BalanceDetailQuery balanceDetailQuery = this.GetBalanceDetailQuery();
            DbQueryResult      balanceDetails     = PersonalHelper.GetBalanceDetails(balanceDetailQuery);

            this.accountList.DataSource = balanceDetails.Data;
            this.accountList.DataBind();
            this.dropTradeType.DataBind();
            this.dropTradeType.SelectedValue = balanceDetailQuery.TradeType;
            this.calendarStart.SelectedDate  = balanceDetailQuery.FromDate;
            this.calendarEnd.SelectedDate    = balanceDetailQuery.ToDate;
            this.pager.TotalRecords          = balanceDetails.TotalRecords;
        }
コード例 #13
0
        protected void RenderHeader()
        {
            var topNavigationPanel = (TopNavigationPanel)LoadControl(TopNavigationPanel.Location);

            topNavigationPanel.SingleSearchHandlerType = typeof(SearchHandler);
            _topNavigationPanelPlaceHolder.Controls.Add(topNavigationPanel);

            //for personal
            if (SetupInfo.IsPersonal)
            {
                PersonalHelper.AdjustTopNavigator(topNavigationPanel,
                                                  ASC.Web.Studio.Personal.PersonalPart.WebItem, ProductEntryPoint.ID);
            }
        }
コード例 #14
0
        private bool ValShippingAddress(HttpContext context, ref string erromsg)
        {
            Regex regex = new Regex(@"[\u4e00-\u9fa5a-zA-Z]+[\u4e00-\u9fa5_a-zA-Z0-9]*");

            if (string.IsNullOrEmpty(context.Request.Params["ShippingTo"].Trim()) || !regex.IsMatch(context.Request.Params["ShippingTo"].Trim()))
            {
                erromsg = "收货人名字不能为空,只能是汉字或字母开头,长度在2-20个字符之间";
                return(false);
            }
            if (string.IsNullOrEmpty(context.Request.Params["AddressDetails"].Trim()))
            {
                erromsg = "详细地址不能为空";
                return(false);
            }
            if ((context.Request.Params["AddressDetails"].Trim().Length < 3) || (context.Request.Params["AddressDetails"].Trim().Length > 60))
            {
                erromsg = "详细地址长度在3-60个字符之间";
                return(false);
            }
            if (string.IsNullOrEmpty(context.Request.Params["RegionId"].Trim()) || (Convert.ToInt32(context.Request.Params["RegionId"].Trim()) <= 0))
            {
                erromsg = "请选择收货地址";
                return(false);
            }
            if (string.IsNullOrEmpty(context.Request.Params["TelPhone"].Trim()) && string.IsNullOrEmpty(context.Request.Params["CellHphone"].Trim().Trim()))
            {
                erromsg = "电话号码和手机二者必填其一";
                return(false);
            }
            if (!string.IsNullOrEmpty(context.Request.Params["TelPhone"].Trim()) && ((context.Request.Params["TelPhone"].Trim().Length < 3) || (context.Request.Params["TelPhone"].Trim().Length > 20)))
            {
                erromsg = "电话号码长度限制在3-20个字符之间";
                return(false);
            }
            if (!string.IsNullOrEmpty(context.Request.Params["CellHphone"].Trim()) && ((context.Request.Params["CellHphone"].Trim().Length < 3) || (context.Request.Params["CellHphone"].Trim().Length > 20)))
            {
                erromsg = "手机号码长度限制在3-20个字符之间";
                return(false);
            }
            if (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) >= HiContext.Current.Config.ShippingAddressQuantity)
            {
                erromsg = string.Format("最多只能添加{0}个收货地址", HiContext.Current.Config.ShippingAddressQuantity);
                return(false);
            }
            return(true);
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = HeaderStringHelper.GetPageTitle(Resources.CalendarAddonResource.AddonName, null, null);

            (Master as StudioTemplate).TopNavigationPanel.DisableSearch = true;
            (Master as StudioTemplate).TopNavigationPanel.CustomTitle   = Resources.CalendarAddonResource.AddonName;

            (Master as StudioTemplate).TopNavigationPanel.CustomTitleURL     = VirtualPathUtility.ToAbsolute(CalendarAddon.BaseVirtualPath);
            (Master as StudioTemplate).TopNavigationPanel.CustomTitleIconURL = WebImageSupplier.GetAbsoluteWebPath("logo.png", CalendarAddon.AddonID);

            (Master as IStudioMaster).ContentHolder.Controls.Add(LoadControl(CalendarControl.Location));
            (Master as IStudioMaster).DisabledSidePanel = true;

            //for personal
            if (SetupInfo.IsPersonal)
            {
                PersonalHelper.AdjustTopNavigator((Master as StudioTemplate).TopNavigationPanel, PersonalPart.WebItem, CalendarAddon.AddonID);
            }
        }
コード例 #16
0
 protected void btnEditAddress_Click(object sender, EventArgs e)
 {
     if (this.ValShippingAddress())
     {
         ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo();
         shippingAddressInfo.ShippingId = Convert.ToInt32(this.ViewState["shippingId"]);
         if (PersonalHelper.UpdateShippingAddress(shippingAddressInfo))
         {
             this.ShowMessage("成功的修改了一个收货地址", true);
             this.Reset();
         }
         else
         {
             this.ShowMessage("地址已经在,请重新输入一次再试", false);
         }
         this.btnEditAddress.Visible = false;
         this.btnAddAddress.Visible  = true;
         this.BindList();
     }
 }
コード例 #17
0
 private void DoValidate()
 {
     System.Collections.Specialized.NameValueCollection parameters = new System.Collections.Specialized.NameValueCollection
     {
         this.Page.Request.Form,
         this.Page.Request.QueryString
     };
     this.Gateway = this.Page.Request.QueryString["HIGW"];
     this.Notify  = PaymentNotify.CreateInstance(this.Gateway, parameters);
     if (this.isBackRequest)
     {
         this.Notify.ReturnUrl = Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[]
         {
             this.Gateway
         })) + "?" + this.Page.Request.Url.Query;
     }
     this.InpourId      = this.Notify.GetOrderId();
     this.Amount        = this.Notify.GetOrderAmount();
     this.InpourRequest = PersonalHelper.GetInpourBlance(this.InpourId);
     if (this.InpourRequest == null)
     {
         this.ResponseStatus(true, "success");
     }
     else
     {
         this.Amount  = this.InpourRequest.InpourBlance;
         this.paymode = TradeHelper.GetPaymentMode(this.InpourRequest.PaymentId);
         if (this.paymode == null)
         {
             this.ResponseStatus(true, "gatewaynotfound");
         }
         else
         {
             this.Notify.Finished          += new System.EventHandler <FinishedEventArgs>(this.Notify_Finished);
             this.Notify.NotifyVerifyFaild += new System.EventHandler(this.Notify_NotifyVerifyFaild);
             this.Notify.Payment           += new System.EventHandler(this.Notify_Payment);
             this.Notify.VerifyNotify(30000, HiCryptographer.Decrypt(this.paymode.Settings));
         }
     }
 }
コード例 #18
0
        private void AddUserShippingAddress(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string erromsg = "";

            if (this.ValShippingAddress(context, ref erromsg))
            {
                if (PersonalHelper.CreateShippingAddress(this.GetShippingAddressInfo(context)))
                {
                    IList <ShippingAddressInfo> shippingAddress = PersonalHelper.GetShippingAddress(HiContext.Current.User.UserId);
                    ShippingAddressInfo         info            = shippingAddress[shippingAddress.Count - 1];
                    context.Response.Write(string.Concat(new object[] { "{\"Status\":\"OK\",\"Result\":{\"ShipTo\":\"", info.ShipTo, "\",\"RegionId\":\"", RegionHelper.GetFullRegion(info.RegionId, " "), "\",\"ShippingAddress\":\"", info.Address, "\",\"ShippingId\":\"", info.ShippingId, "\",\"CellPhone\":\"", info.CellPhone, "\"}}" }));
                }
                else
                {
                    context.Response.Write("{\"Status\":\"Error\",\"Result\":\"地址已经在,请重新输入一次再试\"}");
                }
            }
            else
            {
                context.Response.Write("{\"Status\":\"Error\",\"Result\":\"" + erromsg + "\"}");
            }
        }
コード例 #19
0
        private void UpdateShippingAddress(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string str = "";

            str = "请选择要修改的收货地址";
            if (this.ValShippingAddress(context, ref str) || string.IsNullOrEmpty(context.Request.Params["ShippingId"]) || System.Convert.ToInt32(context.Request.Params["ShippingId"]) > 0)
            {
                ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo(context);
                shippingAddressInfo.ShippingId = System.Convert.ToInt32(context.Request.Params["ShippingId"]);
                if (PersonalHelper.UpdateShippingAddress(shippingAddressInfo))
                {
                    context.Response.Write(string.Concat(new object[]
                    {
                        "{\"Status\":\"OK\",\"Result\":{\"ShipTo\":\"",
                        shippingAddressInfo.ShipTo,
                        "\",\"RegionId\":\"",
                        RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, " "),
                        "\",\"ShippingAddress\":\"",
                        shippingAddressInfo.Address,
                        "\",\"ShippingId\":\"",
                        shippingAddressInfo.ShippingId,
                        "\",\"CellPhone\":\"",
                        shippingAddressInfo.CellPhone,
                        "\"}}"
                    }));
                }
                else
                {
                    context.Response.Write("{\"Status\":\"Error\",\"Result\":\"地址已经在,请重新输入一次再试\"}");
                }
            }
            else
            {
                context.Response.Write("{\"Status\":\"Error\",\"Result\":\"" + str + "\"}");
            }
        }
コード例 #20
0
        private void AddUserShippingAddress(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string str = "";

            if (this.ValShippingAddress(context, ref str))
            {
                ShippingAddressInfo shippingAddressInfo = this.GetShippingAddressInfo(context);
                if (PersonalHelper.CreateShippingAddress(shippingAddressInfo))
                {
                    System.Collections.Generic.IList <ShippingAddressInfo> shippingAddress = PersonalHelper.GetShippingAddress(Hidistro.Membership.Context.HiContext.Current.User.UserId);
                    shippingAddressInfo = shippingAddress[shippingAddress.Count - 1];
                    context.Response.Write(string.Concat(new object[]
                    {
                        "{\"Status\":\"OK\",\"Result\":{\"ShipTo\":\"",
                        shippingAddressInfo.ShipTo,
                        "\",\"RegionId\":\"",
                        RegionHelper.GetFullRegion(shippingAddressInfo.RegionId, " "),
                        "\",\"ShippingAddress\":\"",
                        shippingAddressInfo.Address,
                        "\",\"ShippingId\":\"",
                        shippingAddressInfo.ShippingId,
                        "\",\"CellPhone\":\"",
                        shippingAddressInfo.CellPhone,
                        "\"}}"
                    }));
                }
                else
                {
                    context.Response.Write("{\"Status\":\"Error\",\"Result\":\"地址已经在,请重新输入一次再试\"}");
                }
            }
            else
            {
                context.Response.Write("{\"Status\":\"Error\",\"Result\":\"" + str + "\"}");
            }
        }
コード例 #21
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            PaymentModeInfo   paymentMode = TradeHelper.GetPaymentMode(this.paymentModeId);
            InpourRequestInfo info3       = new InpourRequestInfo();

            info3.InpourId     = this.GenerateInpourId();
            info3.TradeDate    = DateTime.Now;
            info3.InpourBlance = this.balance;
            info3.UserId       = HiContext.Current.User.UserId;
            info3.PaymentId    = paymentMode.ModeId;
            InpourRequestInfo inpourRequest = info3;

            if (PersonalHelper.AddInpourBlance(inpourRequest))
            {
                string     attach = "";
                HttpCookie cookie = HiContext.Current.Context.Request.Cookies["Token_" + HiContext.Current.User.UserId.ToString()];
                if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                {
                    attach = cookie.Value;
                }
                string orderId = inpourRequest.InpourId.ToString(CultureInfo.InvariantCulture);
                PaymentRequest.CreateInstance(paymentMode.Gateway, HiCryptographer.Decrypt(paymentMode.Settings), orderId, inpourRequest.InpourBlance + ((decimal)this.ViewState["PayCharge"]), "预付款充值", "操作流水号-" + orderId, HiContext.Current.User.Email, inpourRequest.TradeDate, Globals.FullPath(Globals.GetSiteUrls().Home), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourReturn_url", new object[] { paymentMode.Gateway })), Globals.FullPath(Globals.GetSiteUrls().UrlData.FormatUrl("InpourNotify_url", new object[] { paymentMode.Gateway })), attach).SendRequest();
            }
        }
コード例 #22
0
        private void btnDrawConfirm_Click(object sender, System.EventArgs e)
        {
            Member member = Users.GetUser(HiContext.Current.User.UserId) as Member;

            if (member.RequestBalance > 0m)
            {
                this.ShowMessage("上笔提现管理员还没有处理,只有处理完后才能再次申请提现", false);
            }
            else
            {
                BalanceDrawRequestInfo balanceDrawRequest = this.GetBalanceDrawRequest();
                if (this.ValidateBalanceDrawRequest(balanceDrawRequest))
                {
                    if (PersonalHelper.BalanceDrawRequest(balanceDrawRequest))
                    {
                        this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("user_MyBalanceDetails"));
                    }
                    else
                    {
                        this.ShowMessage("申请提现过程中出现未知错误", false);
                    }
                }
            }
        }
コード例 #23
0
 protected override void AttachChildControls()
 {
     this.txtSearchText      = (TextBox)this.FindControl("txtSearchText");
     this.btnSearchButton    = ButtonManager.Create(this.FindControl("btnSearchButton"));
     this.grdReferralmembers = (Common_Referral_MemberList)this.FindControl("Common_Referral_MemberList");
     this.pager = (Pager)this.FindControl("pager");
     this.btnSearchButton.Click += new EventHandler(this.btnSearchButton_Click);
     if (!this.Page.IsPostBack)
     {
         PageTitle.AddSiteNameTitle("会员中心首页", HiContext.Current.Context);
         MemberQuery query = new MemberQuery();
         if (!string.IsNullOrEmpty(this.Page.Request.QueryString["username"]))
         {
             query.Username = this.Page.Server.UrlDecode(this.Page.Request.QueryString["username"]);
         }
         query.PageIndex = this.pager.PageIndex;
         query.PageSize  = this.pager.PageSize;
         DbQueryResult myReferralMembers = PersonalHelper.GetMyReferralMembers(query);
         this.grdReferralmembers.DataSource = myReferralMembers.Data;
         this.grdReferralmembers.DataBind();
         this.txtSearchText.Text = query.Username;
         this.pager.TotalRecords = myReferralMembers.TotalRecords;
     }
 }
コード例 #24
0
        private bool ValShippingAddress(System.Web.HttpContext context, ref string erromsg)
        {
            System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex("[\\u4e00-\\u9fa5a-zA-Z]+[\\u4e00-\\u9fa5_a-zA-Z0-9]*");
            bool result;

            if (string.IsNullOrEmpty(context.Request.Params["ShippingTo"].Trim()) || !regex.IsMatch(context.Request.Params["ShippingTo"].Trim()))
            {
                erromsg = "收货人名字不能为空,只能是汉字或字母开头,长度在2-20个字符之间";
                result  = false;
            }
            else
            {
                if (string.IsNullOrEmpty(context.Request.Params["AddressDetails"].Trim()))
                {
                    erromsg = "详细地址不能为空";
                    result  = false;
                }
                else
                {
                    if (context.Request.Params["AddressDetails"].Trim().Length < 3 || context.Request.Params["AddressDetails"].Trim().Length > 60)
                    {
                        erromsg = "详细地址长度在3-60个字符之间";
                        result  = false;
                    }
                    else
                    {
                        if (string.IsNullOrEmpty(context.Request.Params["RegionId"].Trim()) || System.Convert.ToInt32(context.Request.Params["RegionId"].Trim()) <= 0)
                        {
                            erromsg = "请选择收货地址";
                            result  = false;
                        }
                        else
                        {
                            if (string.IsNullOrEmpty(context.Request.Params["TelPhone"].Trim()) && string.IsNullOrEmpty(context.Request.Params["CellHphone"].Trim().Trim()))
                            {
                                erromsg = "电话号码和手机二者必填其一";
                                result  = false;
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(context.Request.Params["TelPhone"].Trim()) && (context.Request.Params["TelPhone"].Trim().Length < 3 || context.Request.Params["TelPhone"].Trim().Length > 20))
                                {
                                    erromsg = "电话号码长度限制在3-20个字符之间";
                                    result  = false;
                                }
                                else
                                {
                                    if (!string.IsNullOrEmpty(context.Request.Params["CellHphone"].Trim()) && (context.Request.Params["CellHphone"].Trim().Length < 3 || context.Request.Params["CellHphone"].Trim().Length > 20))
                                    {
                                        erromsg = "手机号码长度限制在3-20个字符之间";
                                        result  = false;
                                    }
                                    else
                                    {
                                        if (PersonalHelper.GetShippingAddressCount(Hidistro.Membership.Context.HiContext.Current.User.UserId) >= Hidistro.Membership.Context.HiContext.Current.Config.ShippingAddressQuantity)
                                        {
                                            erromsg = string.Format("最多只能添加{0}个收货地址", Hidistro.Membership.Context.HiContext.Current.Config.ShippingAddressQuantity);
                                            result  = false;
                                        }
                                        else
                                        {
                                            result = true;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
コード例 #25
0
        public void btnCreateOrder_Click(object sender, EventArgs e)
        {
            if (ValidateCreateOrder())
            {
                OrderInfo orderInfo = GetOrderInfo(shoppingCart);

                if (shoppingCart.Quantity > 1)
                {
                    isSignBuy = false;
                }

                if (orderInfo == null)
                {
                    ShowMessage("购物车中已经没有任何商品", false);
                }
                else if (!HiContext.Current.User.IsAnonymous && (shoppingCart.GetTotalNeedPoint() > ((Member)HiContext.Current.User).Points))
                {
                    ShowMessage("您当前的积分不够兑换所需积分!", false);
                }
                else if (isCountDown && (ProductBrowser.GetCountDownInfo(shoppingCart.LineItems[productSku].ProductId).EndDate < DateTime.Now))
                {
                    ShowMessage("此订单为抢购订单,但抢购时间已到!", false);
                }
                else
                {
                    try
                    {
                        if (ShoppingProcessor.CreatOrder(orderInfo))
                        {
                            Messenger.OrderCreated(orderInfo, HiContext.Current.User);
                            orderInfo.OnCreated();
                            if (shoppingCart.GetTotalNeedPoint() > 0)
                            {
                                ShoppingProcessor.CutNeedPoint(shoppingCart.GetTotalNeedPoint());
                            }
                            if ((!isCountDown && !isGroupBuy) && !isSignBuy)
                            {
                                ShoppingCartProcessor.ClearShoppingCart();
                            }
                            if (!HiContext.Current.User.IsAnonymous && (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) == 0))
                            {
                                ShippingAddressInfo shippingAddress = new ShippingAddressInfo();
                                shippingAddress.UserId    = HiContext.Current.User.UserId;
                                shippingAddress.ShipTo    = Globals.HtmlEncode(txtShipTo.Text);
                                shippingAddress.RegionId  = dropRegions.GetSelectedRegionId().Value;
                                shippingAddress.Address   = Globals.HtmlEncode(txtAddress.Text);
                                shippingAddress.Zipcode   = txtZipcode.Text;
                                shippingAddress.CellPhone = txtCellPhone.Text;
                                shippingAddress.TelPhone  = txtTelPhone.Text;
                                PersonalHelper.CreateShippingAddress(shippingAddress);
                            }
                            Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("FinishOrder", new object[] { orderInfo.OrderId }));
                        }
                    }
                    catch (Exception exception)
                    {
                        ShowMessage(exception.ToString(), false);
                    }
                }
            }
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int num = 0;
            SortedDictionary <string, string> requestPost = this.GetRequestPost();

            if (requestPost.Count > 0)
            {
                string             openIdType     = "hishop.plugins.openid.alipay.alipayservice";
                OpenIdSettingsInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType);
                if (openIdSettings == null)
                {
                    base.Response.Write("登录失败,没有找到对应的插件配置信息。");
                    return;
                }
                XmlDocument document = new XmlDocument();
                document.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings));
                AliPayNotify notify      = new AliPayNotify(requestPost, base.Request.Form["notify_id"], document.FirstChild.SelectSingleNode("Partner").InnerText, document.FirstChild.SelectSingleNode("Key").InnerText);
                string       responseTxt = notify.ResponseTxt;
                string       str3        = base.Request.Form["sign"];
                string       mysign      = notify.Mysign;
                if ((responseTxt == "true") && (str3 == mysign))
                {
                    string str5 = base.Request.Form["receive_address"];
                    if (!string.IsNullOrEmpty(str5))
                    {
                        XmlDocument document2 = new XmlDocument();
                        document2.LoadXml(str5);
                        ShippingAddressInfo shippingAddress = new ShippingAddressInfo();
                        shippingAddress.UserId = HiContext.Current.User.UserId;
                        if ((document2.SelectSingleNode("/receiveAddress/address") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/address").InnerText))
                        {
                            shippingAddress.Address = Globals.HtmlEncode(document2.SelectSingleNode("/receiveAddress/address").InnerText);
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/fullname") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/fullname").InnerText))
                        {
                            shippingAddress.ShipTo = Globals.HtmlEncode(document2.SelectSingleNode("/receiveAddress/fullname").InnerText);
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/post") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/post").InnerText))
                        {
                            shippingAddress.Zipcode = document2.SelectSingleNode("/receiveAddress/post").InnerText;
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/mobile_phone") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText))
                        {
                            shippingAddress.CellPhone = document2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText;
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/phone") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/phone").InnerText))
                        {
                            shippingAddress.TelPhone = document2.SelectSingleNode("/receiveAddress/phone").InnerText;
                        }
                        string innerText = string.Empty;
                        string str7      = string.Empty;
                        string str8      = string.Empty;
                        if ((document2.SelectSingleNode("/receiveAddress/area") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/area").InnerText))
                        {
                            innerText = document2.SelectSingleNode("/receiveAddress/area").InnerText;
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/city") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/city").InnerText))
                        {
                            str7 = document2.SelectSingleNode("/receiveAddress/city").InnerText;
                        }
                        if ((document2.SelectSingleNode("/receiveAddress/prov") != null) && !string.IsNullOrEmpty(document2.SelectSingleNode("/receiveAddress/prov").InnerText))
                        {
                            str8 = document2.SelectSingleNode("/receiveAddress/prov").InnerText;
                        }
                        if ((string.IsNullOrEmpty(innerText) && string.IsNullOrEmpty(str7)) && string.IsNullOrEmpty(str8))
                        {
                            shippingAddress.RegionId = 0;
                        }
                        else
                        {
                            shippingAddress.RegionId = RegionHelper.GetRegionId(innerText, str7, str8);
                        }
                        SiteSettings siteSettings = HiContext.Current.SiteSettings;
                        if (PersonalHelper.GetShippingAddressCount(HiContext.Current.User.UserId) < HiContext.Current.Config.ShippingAddressQuantity)
                        {
                            num = PersonalHelper.AddShippingAddress(shippingAddress);
                        }
                    }
                }
            }
            this.Page.Response.Redirect(Globals.ApplicationPath + "/SubmmitOrder.aspx?shippingId=" + num);
        }
コード例 #27
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            int num = 0;

            System.Collections.Generic.SortedDictionary <string, string> requestPost = this.GetRequestPost();
            if (requestPost.Count > 0)
            {
                string             openIdType     = "hishop.plugins.openid.alipay.alipayservice";
                OpenIdSettingsInfo openIdSettings = OpenIdHelper.GetOpenIdSettings(openIdType);
                if (openIdSettings == null)
                {
                    base.Response.Write("登录失败,没有找到对应的插件配置信息。");
                    return;
                }
                System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument();
                xmlDocument.LoadXml(HiCryptographer.Decrypt(openIdSettings.Settings));
                AliPayNotify aliPayNotify = new AliPayNotify(requestPost, base.Request.Form["notify_id"], xmlDocument.FirstChild.SelectSingleNode("Partner").InnerText, xmlDocument.FirstChild.SelectSingleNode("Key").InnerText);
                string       responseTxt  = aliPayNotify.ResponseTxt;
                string       a            = base.Request.Form["sign"];
                string       mysign       = aliPayNotify.Mysign;
                if (responseTxt == "true" && a == mysign)
                {
                    string text = base.Request.Form["receive_address"];
                    if (!string.IsNullOrEmpty(text))
                    {
                        System.Xml.XmlDocument xmlDocument2 = new System.Xml.XmlDocument();
                        xmlDocument2.LoadXml(text);
                        ShippingAddressInfo shippingAddressInfo = new ShippingAddressInfo();
                        shippingAddressInfo.UserId = Hidistro.Membership.Context.HiContext.Current.User.UserId;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/address") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText))
                        {
                            shippingAddressInfo.Address = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/address").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/fullname") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText))
                        {
                            shippingAddressInfo.ShipTo = Globals.HtmlEncode(xmlDocument2.SelectSingleNode("/receiveAddress/fullname").InnerText);
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/post") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText))
                        {
                            shippingAddressInfo.Zipcode = xmlDocument2.SelectSingleNode("/receiveAddress/post").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText))
                        {
                            shippingAddressInfo.CellPhone = xmlDocument2.SelectSingleNode("/receiveAddress/mobile_phone").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/phone") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText))
                        {
                            shippingAddressInfo.TelPhone = xmlDocument2.SelectSingleNode("/receiveAddress/phone").InnerText;
                        }
                        string text2 = string.Empty;
                        string text3 = string.Empty;
                        string text4 = string.Empty;
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/area") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText))
                        {
                            text2 = xmlDocument2.SelectSingleNode("/receiveAddress/area").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/city") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText))
                        {
                            text3 = xmlDocument2.SelectSingleNode("/receiveAddress/city").InnerText;
                        }
                        if (xmlDocument2.SelectSingleNode("/receiveAddress/prov") != null && !string.IsNullOrEmpty(xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText))
                        {
                            text4 = xmlDocument2.SelectSingleNode("/receiveAddress/prov").InnerText;
                        }
                        if (string.IsNullOrEmpty(text2) && string.IsNullOrEmpty(text3) && string.IsNullOrEmpty(text4))
                        {
                            shippingAddressInfo.RegionId = 0;
                        }
                        else
                        {
                            shippingAddressInfo.RegionId = RegionHelper.GetRegionId(text2, text3, text4);
                        }
                        Hidistro.Membership.Context.SiteSettings arg_371_0 = Hidistro.Membership.Context.HiContext.Current.SiteSettings;
                        if (PersonalHelper.GetShippingAddressCount(Hidistro.Membership.Context.HiContext.Current.User.UserId) < Hidistro.Membership.Context.HiContext.Current.Config.ShippingAddressQuantity)
                        {
                            num = PersonalHelper.AddShippingAddress(shippingAddressInfo);
                        }
                    }
                }
            }
            this.Page.Response.Redirect(Globals.ApplicationPath + "/SubmmitOrder.aspx?shippingId=" + num);
        }
コード例 #28
0
 public void btnCreateOrder_Click(object sender, System.EventArgs e)
 {
     if (this.ValidateCreateOrder())
     {
         OrderInfo orderInfo = this.GetOrderInfo(this.shoppingCart);
         if (this.shoppingCart.GetQuantity() > 1)
         {
             this.isSignBuy = false;
         }
         if (orderInfo == null)
         {
             this.ShowMessage("购物车中已经没有任何商品", false);
         }
         else
         {
             if (orderInfo.GetTotal() < 0m)
             {
                 this.ShowMessage("订单金额不能为负", false);
             }
             else
             {
                 if (!Hidistro.Membership.Context.HiContext.Current.User.IsAnonymous)
                 {
                     int totalNeedPoint = this.shoppingCart.GetTotalNeedPoint();
                     int points         = ((Hidistro.Membership.Context.Member)Hidistro.Membership.Context.HiContext.Current.User).Points;
                     if (points >= 0 && totalNeedPoint > points)
                     {
                         this.ShowMessage("您当前的积分不够兑换所需积分!", false);
                         return;
                     }
                 }
                 if (this.isCountDown)
                 {
                     CountDownInfo countDownInfo = ProductBrowser.GetCountDownInfo(this.shoppingCart.LineItems[this.productSku].ProductId);
                     if (countDownInfo.EndDate < System.DateTime.Now)
                     {
                         this.ShowMessage("此订单为抢购订单,但抢购时间已到!", false);
                         return;
                     }
                     if (this.shoppingCart.LineItems[this.productSku].Quantity > countDownInfo.MaxCount)
                     {
                         this.ShowMessage("你购买的数量超过限购数量:" + countDownInfo.MaxCount.ToString(), false);
                         return;
                     }
                     int num = ShoppingProcessor.CountDownOrderCount(this.shoppingCart.LineItems[this.productSku].ProductId);
                     if (num + this.shoppingCart.LineItems[this.productSku].Quantity > countDownInfo.MaxCount)
                     {
                         this.ShowMessage(string.Format("你已经抢购过该商品{0}件,每个用户只允许抢购{1}件,如果你有未付款的抢购单,请及时支付!", num, countDownInfo.MaxCount), false);
                         return;
                     }
                 }
                 try
                 {
                     if (ShoppingProcessor.CreatOrder(orderInfo))
                     {
                         Messenger.OrderCreated(orderInfo, Hidistro.Membership.Context.HiContext.Current.User);
                         orderInfo.OnCreated();
                         if (this.shoppingCart.GetTotalNeedPoint() > 0)
                         {
                             ShoppingProcessor.CutNeedPoint(this.shoppingCart.GetTotalNeedPoint(), orderInfo.OrderId);
                         }
                         if (!this.isCountDown && !this.isGroupBuy && !this.isSignBuy && !this.isBundling)
                         {
                             ShoppingCartProcessor.ClearShoppingCart();
                         }
                         if (!Hidistro.Membership.Context.HiContext.Current.User.IsAnonymous && PersonalHelper.GetShippingAddressCount(Hidistro.Membership.Context.HiContext.Current.User.UserId) == 0)
                         {
                             PersonalHelper.CreateShippingAddress(new ShippingAddressInfo
                             {
                                 UserId    = Hidistro.Membership.Context.HiContext.Current.User.UserId,
                                 ShipTo    = Globals.HtmlEncode(this.txtShipTo.Text),
                                 RegionId  = this.dropRegions.GetSelectedRegionId().Value,
                                 Address   = Globals.HtmlEncode(this.txtAddress.Text),
                                 Zipcode   = this.txtZipcode.Text,
                                 CellPhone = this.txtCellPhone.Text,
                                 TelPhone  = this.txtTelPhone.Text
                             });
                         }
                         this.Page.Response.Redirect(Globals.GetSiteUrls().UrlData.FormatUrl("FinishOrder", new object[]
                         {
                             orderInfo.OrderId
                         }));
                     }
                 }
                 catch (System.Exception ex)
                 {
                     this.ShowMessage(ex.ToString(), false);
                 }
             }
         }
     }
 }
コード例 #29
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            //check if cookie from this portal
            if (SecurityContext.CurrentAccount is IUserAccount &&
                ((IUserAccount)SecurityContext.CurrentAccount).Tenant != CoreContext.TenantManager.GetCurrentTenant().TenantId)
            {
                SecurityContext.Logout();
                Response.Redirect("~/");
            }

            var currentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);

            if (currentUser == Constants.LostUser || currentUser.Status != EmployeeStatus.Active)
            {
                SecurityContext.Logout();
                Response.Redirect("~/");
            }

            ProcessSecureFilter();

            var wizardSettings = SettingsManager.Instance.LoadSettings <WizardSettings>(TenantProvider.CurrentTenantID);

            if (Request["first"] == "1" && !string.IsNullOrEmpty(Request["id"]) && wizardSettings.Completed)
            {
                // wizardSettings.Completed - open source, Request["first"] - cloud
                wizardSettings.Completed = false;
                SettingsManager.Instance.SaveSettings(wizardSettings, TenantProvider.CurrentTenantID);
            }

            var smsAuthSettings = SettingsManager.Instance.LoadSettings <StudioSmsNotificationSettings>(TenantProvider.CurrentTenantID);

            if (!wizardSettings.Completed && !(this is confirm))
            {
                var successAuth = SecurityContext.IsAuthenticated;
                if (!successAuth)
                {
                    var cookie = Request["id"] ?? CookiesManager.GetCookies(CookiesType.AuthKey);
                    if (!string.IsNullOrEmpty(cookie))
                    {
                        successAuth = AuthByCookies(cookie);
                    }
                    if (!successAuth)
                    {
                        try
                        {
                            cookie      = SecurityContext.AuthenticateMe(UserManagerWrapper.AdminID.ToString(), "admin");
                            successAuth = true;
                        }
                        catch (System.Security.SecurityException)
                        {
                        }
                    }
                    if (successAuth)
                    {
                        CookiesManager.SetCookies(CookiesType.AuthKey, cookie);
                        WebItemManager.Instance.ItemGlobalHandlers.Login(SecurityContext.CurrentAccount.ID);
                    }
                }
                if (!successAuth && !(this is Auth))
                {
                    Response.Redirect("~/auth.aspx");
                }
                if (successAuth && !(this is Wizard))
                {
                    Response.Redirect("~/wizard.aspx");
                }
            }
            else if (smsAuthSettings.Enable && Session["UserTransferData"] != null && !(this is confirm))
            {
                Response.Redirect(String.Format("~/Confirm.aspx?type={0}", ((UserTransferData)Session["UserTransferData"]).MobilePhoneActivationStatus == MobilePhoneActivationStatus.NotActivated ? ConfirmType.PhoneActivation : ConfirmType.PhoneAuth));
            }

            else if (!SecurityContext.IsAuthenticated && wizardSettings.Completed && !(this is confirm))
            {
                //for demo
                if (SetupInfo.WorkMode == WorkMode.Promo)
                {
                    if (AutoAuthByPromo())
                    {
                        UserOnlineManager.Instance.RegistryOnlineUser(SecurityContext.CurrentAccount.ID);

                        Response.Redirect("~/");
                        return;
                    }
                }

                if (this is Auth && Session["refererURL"] == null && !string.IsNullOrEmpty(HttpContext.Current.Request.Params["id"]))
                {
                    var authCookie = HttpContext.Current.Request.Params["id"];
                    if (AuthByCookies(authCookie))
                    {
                        CookiesManager.SetCookies(CookiesType.AuthKey, authCookie);
                        var first = Request["first"] == "1";
                        if (first)
                        {
                            try
                            {
                                var tenant = CoreContext.TenantManager.GetCurrentTenant(false);
                                tenant.Name = Resources.Resource.StudioWelcomeHeader;
                                CoreContext.TenantManager.SaveTenant(tenant);
                            }
                            catch
                            {
                            }
                        }
                        Response.Redirect(VirtualPathUtility.ToAbsolute("~/") + (first ? "?first=1" : ""));
                        return;
                    }
                }

                if (!(this is Auth))
                {
                    var refererURL = Request.Url.AbsoluteUri;
                    if (!ValidateRefererUrl(refererURL))
                    {
                        refererURL = (string)Session["refererURL"];
                    }

                    if (!AutoAuthByCookies() && !CoreContext.TenantManager.GetCurrentTenant().Public)
                    {
                        Session["refererURL"] = refererURL;
                        Response.Redirect("~/auth.aspx");
                        return;
                    }
                }
            }

            else if (SecurityContext.IsAuthenticated && this is Auth && !this.IsLogout)
            {
                Response.Redirect("~/");
                return;
            }

            else if (this is Wizard && wizardSettings.Completed)
            {
                Response.Redirect("~/");
                return;
            }

            //check disable and public
            var webitem = CommonLinkUtility.GetWebItemByUrl(Request.Url.ToString());

            if (webitem != null && webitem.IsDisabled())
            {
                Response.Redirect("~/");
                return;
            }


            if (SecurityContext.IsAuthenticated)
            {
                UserOnlineManager.Instance.RegistryOnlineUser(SecurityContext.CurrentAccount.ID);

                try
                {
                    StatisticManager.SaveUserVisit(TenantProvider.CurrentTenantID, SecurityContext.CurrentAccount.ID, CommonLinkUtility.GetProductID());
                }
                catch (Exception exc)
                {
                    Log.Error("failed save user visit", exc);
                }
            }

            CurrentSkin = WebSkin.GetUserSkin();
            Theme       = CurrentSkin.ASPTheme;


            #region Init common javascript resources

            var commonJavascriptResources = "CommonJavascriptResources";
            if (!Page.ClientScript.IsClientScriptBlockRegistered(commonJavascriptResources))
            {
                var script = string.Format(@"
var CommonJavascriptResources = {{
	CancelConfirmMessage : '{0}'
}};", Resources.Resource.CancelConfirmMessage.ReplaceSingleQuote());
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), commonJavascriptResources, script, true);
            }

            #endregion

            PersonalHelper.TransferRequest(this);
        }
コード例 #30
0
 protected override void AttachChildControls()
 {
     this.dropRegions         = (RegionSelector)this.FindControl("dropRegions");
     this.txtShipTo           = (System.Web.UI.WebControls.TextBox) this.FindControl("txtShipTo");
     this.txtAddress          = (System.Web.UI.WebControls.TextBox) this.FindControl("txtAddress");
     this.txtZipcode          = (System.Web.UI.WebControls.TextBox) this.FindControl("txtZipcode");
     this.txtCellPhone        = (System.Web.UI.WebControls.TextBox) this.FindControl("txtCellPhone");
     this.txtTelPhone         = (System.Web.UI.WebControls.TextBox) this.FindControl("txtTelPhone");
     this.txtInvoiceTitle     = (System.Web.UI.WebControls.TextBox) this.FindControl("txtInvoiceTitle");
     this.drpShipToDate       = (System.Web.UI.HtmlControls.HtmlSelect) this.FindControl("drpShipToDate");
     this.litTaxRate          = (System.Web.UI.WebControls.Label) this.FindControl("litTaxRate");
     this.shippingModeList    = (Common_ShippingModeList)this.FindControl("Common_ShippingModeList");
     this.paymentModeList     = (Common_PaymentModeList)this.FindControl("grd_Common_PaymentModeList");
     this.inputPaymentModeId  = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("inputPaymentModeId");
     this.inputShippingModeId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("inputShippingModeId");
     this.hdbuytype           = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hdbuytype");
     this.pannel_useraddress  = (System.Web.UI.WebControls.Panel) this.FindControl("pannel_useraddress");
     this.lblPaymentPrice     = (FormatedMoneyLabel)this.FindControl("lblPaymentPrice");
     this.lblShippModePrice   = (FormatedMoneyLabel)this.FindControl("lblShippModePrice");
     this.chkTax                = (System.Web.UI.HtmlControls.HtmlInputCheckBox) this.FindControl("chkTax");
     this.cartProductList       = (Common_SubmmintOrder_ProductList)this.FindControl("Common_SubmmintOrder_ProductList");
     this.cartGiftList          = (Common_SubmmintOrder_GiftList)this.FindControl("Common_SubmmintOrder_GiftList");
     this.litProductAmount      = (System.Web.UI.WebControls.Literal) this.FindControl("litProductAmount");
     this.litProductBundling    = (System.Web.UI.WebControls.Literal) this.FindControl("litProductBundling");
     this.litAllWeight          = (System.Web.UI.WebControls.Label) this.FindControl("litAllWeight");
     this.litPoint              = (System.Web.UI.WebControls.Label) this.FindControl("litPoint");
     this.hlkSentTimesPoint     = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkSentTimesPoint");
     this.lblOrderTotal         = (FormatedMoneyLabel)this.FindControl("lblOrderTotal");
     this.txtMessage            = (System.Web.UI.WebControls.TextBox) this.FindControl("txtMessage");
     this.hlkFeeFreight         = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkFeeFreight");
     this.hlkReducedPromotion   = (System.Web.UI.WebControls.HyperLink) this.FindControl("hlkReducedPromotion");
     this.lblTotalPrice         = (FormatedMoneyLabel)this.FindControl("lblTotalPrice");
     this.htmlCouponCode        = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("htmlCouponCode");
     this.CmbCoupCode           = (System.Web.UI.HtmlControls.HtmlSelect) this.FindControl("CmbCoupCode");
     this.tbCoupon              = (System.Web.UI.HtmlControls.HtmlTable) this.FindControl("tbCoupon");
     this.litCouponAmout        = (FormatedMoneyLabel)this.FindControl("litCouponAmout");
     this.btnCreateOrder        = ButtonManager.Create(this.FindControl("btnCreateOrder"));
     this.btnCreateOrder.Click += new System.EventHandler(this.btnCreateOrder_Click);
     Hidistro.Membership.Context.SiteSettings masterSettings = Hidistro.Membership.Context.SettingsManager.GetMasterSettings(false);
     if (!this.Page.IsPostBack)
     {
         this.BindUserAddress();
         this.shippingModeList.DataSource = ShoppingProcessor.GetShippingModes();
         this.shippingModeList.DataBind();
         this.ReBindPayment();
         if (this.shoppingCart != null)
         {
             this.litTaxRate.Text = masterSettings.TaxRate.ToString(System.Globalization.CultureInfo.InvariantCulture);
             this.BindShoppingCartInfo(this.shoppingCart);
             if (this.isGroupBuy || this.isCountDown || this.isBundling || this.shoppingCart.LineItems.Count == 0)
             {
                 this.tbCoupon.Visible = false;
             }
             this.CmbCoupCode.DataTextField  = "DisplayText";
             this.CmbCoupCode.DataValueField = "ClaimCode";
             this.CmbCoupCode.DataSource     = ShoppingProcessor.GetCoupon(this.shoppingCart.GetTotal());
             this.CmbCoupCode.DataBind();
             System.Web.UI.WebControls.ListItem item = new System.Web.UI.WebControls.ListItem("", "0");
             this.CmbCoupCode.Items.Insert(0, item);
             this.hdbuytype.Value            = this.buytype;
             this.pannel_useraddress.Visible = (!Hidistro.Membership.Context.HiContext.Current.User.IsAnonymous && PersonalHelper.GetShippingAddressCount(Hidistro.Membership.Context.HiContext.Current.User.UserId) > 0);
         }
     }
 }