Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ExpressSet expressSet = ExpressHelper.GetExpressSet();

            this.hdHasNewKey.Value  = "0";
            this.hdExpressUrl.Value = "";
            if (expressSet != null)
            {
                if (!string.IsNullOrEmpty(expressSet.NewKey))
                {
                    this.hdHasNewKey.Value = "1";
                }
                if (!string.IsNullOrEmpty(expressSet.Url.Trim()))
                {
                    this.hdExpressUrl.Value = expressSet.Url.Trim();
                }
            }
            if (Globals.RequestFormStr("posttype") == "modifyRefundMondy")
            {
                base.Response.ContentType = "application/json";
                string  s      = "{\"type\":\"0\",\"tips\":\"操作失败!\"}";
                decimal result = 0M;
                decimal.TryParse(Globals.RequestFormStr("price"), out result);
                int    productid = Globals.RequestFormNum("pid");
                string str3      = Globals.RequestFormStr("oid");
                if (((result > 0M) && (productid > 0)) && !string.IsNullOrEmpty(str3))
                {
                    if (RefundHelper.UpdateRefundMoney(str3, productid, result))
                    {
                        s = "{\"type\":\"1\",\"tips\":\"操作成功!\"}";
                    }
                }
                else if (result <= 0M)
                {
                    s = "{\"type\":\"0\",\"tips\":\"退款金额需大于0!\"}";
                }
                base.Response.Write(s);
                base.Response.End();
            }
            else
            {
                this.reurl = "OrderDetails.aspx?OrderId=" + this.orderId + "&t=" + DateTime.Now.ToString("HHmmss");
                this.btnMondifyPay.Click += new EventHandler(this.btnMondifyPay_Click);
                this.btnCloseOrder.Click += new EventHandler(this.btnCloseOrder_Click);
                this.btnRemark.Click     += new EventHandler(this.btnRemark_Click);
                this.order = OrderHelper.GetOrderInfo(this.orderId);
                if (this.order == null)
                {
                    base.Response.Write("原订单已删除!");
                    base.Response.End();
                }
                else if (!base.IsPostBack)
                {
                    this.btnUpdateExpress.Visible = this.order.OrderStatus == OrderStatus.SellerAlreadySent;
                    if (string.IsNullOrEmpty(this.orderId))
                    {
                        base.GotoResourceNotFound();
                    }
                    else
                    {
                        this.hdfOrderID.Value  = this.orderId;
                        this.litOrderDate.Text = this.order.OrderDate.ToString("yyyy-MM-dd HH:mm:ss");
                        if (this.order.PayDate.HasValue)
                        {
                            this.litPayDate.Text = DateTime.Parse(this.order.PayDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        }
                        if (this.order.ShippingDate.HasValue)
                        {
                            this.litShippingDate.Text = DateTime.Parse(this.order.ShippingDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        }
                        if (this.order.FinishDate.HasValue)
                        {
                            this.litFinishDate.Text = DateTime.Parse(this.order.FinishDate.ToString()).ToString("yyyy-MM-dd HH:mm:ss");
                        }
                        this.lblOrderStatus.OrderStatusCode = this.order.OrderStatus;
                        switch (this.order.OrderStatus)
                        {
                        case OrderStatus.WaitBuyerPay:
                            this.ProcessClass2 = "active";
                            if (this.order.Gateway != "hishop.plugins.payment.podrequest")
                            {
                                this.btnConfirmPay.Visible = true;
                            }
                            this.btnModifyAddr.Attributes.Add("onclick", "DialogFrame('../trade/ShipAddress.aspx?action=update&OrderId=" + this.orderId + "','修改收货地址',620,410)");
                            this.btnModifyAddr.Visible = true;
                            break;

                        case OrderStatus.BuyerAlreadyPaid:
                            this.ProcessClass2 = "ok";
                            this.ProcessClass3 = "active";
                            this.btnModifyAddr.Attributes.Add("onclick", "DialogFrame('../trade/ShipAddress.aspx?action=update&OrderId=" + this.orderId + "','修改收货地址',620,410)");
                            this.btnModifyAddr.Visible = true;
                            break;

                        case OrderStatus.SellerAlreadySent:
                            this.ProcessClass2 = "ok";
                            this.ProcessClass3 = "ok";
                            this.ProcessClass4 = "active";
                            break;

                        case OrderStatus.Finished:
                            this.ProcessClass2 = "ok";
                            this.ProcessClass3 = "ok";
                            this.ProcessClass4 = "ok";
                            break;
                        }
                        if (this.order.ManagerMark.HasValue)
                        {
                            this.OrderRemarkImageLink.ManagerMarkValue = (int)this.order.ManagerMark.Value;
                            this.litManagerRemark.Text = this.order.ManagerRemark;
                        }
                        else
                        {
                            this.divRemarkShow.Visible = false;
                        }
                        this.comCode        = this.order.ExpressCompanyAbb;
                        this.litRemark.Text = this.order.Remark;
                        string orderId      = this.order.OrderId;
                        string orderMarking = this.order.OrderMarking;
                        if (!string.IsNullOrEmpty(orderMarking))
                        {
                            orderId = orderId + " (" + this.order.PaymentType + "流水号:" + orderMarking + ")";
                        }
                        this.litOrderId.Text  = orderId;
                        this.litUserName.Text = this.order.Username;
                        if (this.order.BalancePayMoneyTotal > 0M)
                        {
                            this.litPayType.Text = "余额支付 ¥" + this.order.BalancePayMoneyTotal.ToString("F2");
                        }
                        decimal num3 = this.order.GetTotal() - this.order.BalancePayMoneyTotal;
                        if (num3 > 0M)
                        {
                            if (!string.IsNullOrEmpty(this.litPayType.Text.Trim()))
                            {
                                this.litPayType.Text = this.litPayType.Text;
                            }
                            if ((num3 - this.order.CouponFreightMoneyTotal) > 0M)
                            {
                                if (!string.IsNullOrEmpty(this.litPayType.Text))
                                {
                                    this.litPayType.Text = this.litPayType.Text + "<br>";
                                }
                                this.litPayType.Text = this.litPayType.Text + (!this.order.PayDate.HasValue ? "待支付" : this.order.PaymentType) + " ¥" + num3.ToString("F2");
                            }
                        }
                        else if (this.order.PaymentTypeId == 0x4d)
                        {
                            this.litPayType.Text = this.order.PaymentType + " ¥" + this.order.PointToCash.ToString("F2");
                        }
                        else if (this.order.PaymentTypeId == 0x37)
                        {
                            this.litPayType.Text = this.order.PaymentType + " ¥" + this.order.RedPagerAmount.ToString("F2");
                        }
                        this.litShipToDate.Text      = this.order.ShipToDate;
                        this.litRealName.Text        = this.order.ShipTo;
                        this.litName.Text            = this.order.ShipTo;
                        this.litExOrderId.Text       = this.order.OrderId;
                        this.txtShipOrderNumber.Text = this.order.ShipOrderNumber;
                        this.OrderStatusLabelHtml.OrderStatusCode = this.order.OrderStatus;
                        this.litUserTel.Text             = string.IsNullOrEmpty(this.order.CellPhone) ? this.order.TelPhone : this.order.CellPhone;
                        this.litShippingRegion.Text      = this.order.ShippingRegion;
                        this.litFreight.Text             = Globals.FormatMoney(this.order.AdjustedFreight);
                        this.BalancePayFreightMoneyTotal = this.order.BalancePayFreightMoneyTotal;
                        this.BalancePayMoneyTotal        = this.order.BalancePayMoneyTotal;
                        if (this.order.ReferralUserId == 0)
                        {
                            this.litSiteName.Text = "主站";
                        }
                        else
                        {
                            DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(this.order.ReferralUserId);
                            if (distributorInfo != null)
                            {
                                this.litSiteName.Text = distributorInfo.StoreName;
                            }
                        }
                        StringBuilder builder = new StringBuilder();
                        if (!string.IsNullOrEmpty(this.order.ActivitiesName))
                        {
                            this.otherDiscountPrice += this.order.DiscountAmount;
                            builder.Append("<p>" + this.order.ActivitiesName + ":¥" + this.order.DiscountAmount.ToString("F2") + "</p>");
                        }
                        if (!string.IsNullOrEmpty(this.order.ReducedPromotionName))
                        {
                            this.otherDiscountPrice += this.order.ReducedPromotionAmount;
                            builder.Append("<p>" + this.order.ReducedPromotionName + ":¥" + this.order.ReducedPromotionAmount.ToString("F2") + "</p>");
                        }
                        if (!string.IsNullOrEmpty(this.order.CouponName))
                        {
                            this.otherDiscountPrice += this.order.CouponAmount;
                            builder.Append("<p>" + this.order.CouponName + ":¥" + this.order.CouponAmount.ToString("F2") + "</p>");
                        }
                        if (!string.IsNullOrEmpty(this.order.RedPagerActivityName))
                        {
                            this.otherDiscountPrice += this.order.RedPagerAmount;
                            builder.Append("<p>" + this.order.RedPagerActivityName + ":¥" + this.order.RedPagerAmount.ToString("F2") + "</p>");
                        }
                        if (this.order.PointToCash > 0M)
                        {
                            this.otherDiscountPrice += this.order.PointToCash;
                            builder.Append("<p>积分抵现:¥" + this.order.PointToCash.ToString("F2") + "</p>");
                        }
                        this.order.GetAdjustCommssion();
                        decimal num4 = 0M;
                        decimal num5 = 0M;
                        foreach (LineItemInfo info2 in this.order.LineItems.Values)
                        {
                            if (info2.IsAdminModify)
                            {
                                num4 += info2.ItemAdjustedCommssion;
                            }
                            else
                            {
                                num5 += info2.ItemAdjustedCommssion;
                            }
                        }
                        if (num4 != 0M)
                        {
                            if (num4 > 0M)
                            {
                                builder.Append("<p>管理员调价减:¥" + num4.ToString("F2") + "</p>");
                            }
                            else
                            {
                                builder.Append("<p>管理员调价加:¥" + ((num4 * -1M)).ToString("F2") + "</p>");
                            }
                        }
                        if (num5 != 0M)
                        {
                            if (num5 > 0M)
                            {
                                builder.Append("<p>分销商调价减:¥" + num5.ToString("F2") + "</p>");
                            }
                            else
                            {
                                builder.Append("<p>分销商调价加:¥" + ((num5 * -1M)).ToString("F2") + "</p>");
                            }
                        }
                        this.litActivityShow.Text = builder.ToString();
                        if (((int)this.lblOrderStatus.OrderStatusCode) != 4)
                        {
                            this.lbCloseReason.Visible = false;
                        }
                        else
                        {
                            this.divOrderProcess.Visible = false;
                            this.lbReason.Text           = this.order.CloseReason;
                        }
                        if ((this.order.OrderStatus == OrderStatus.BuyerAlreadyPaid) || ((this.order.OrderStatus == OrderStatus.WaitBuyerPay) && (this.order.Gateway == "hishop.plugins.payment.podrequest")))
                        {
                            this.btnSendGoods.Visible = true;
                        }
                        else
                        {
                            this.btnSendGoods.Visible = false;
                        }
                        if (((this.order.OrderStatus == OrderStatus.SellerAlreadySent) || (this.order.OrderStatus == OrderStatus.Finished)) && !string.IsNullOrEmpty(this.order.ExpressCompanyAbb))
                        {
                            this.pLoginsticInfo.Visible  = true;
                            this.btnViewLogistic.Visible = true;
                            if ((Express.GetExpressType() == "kuaidi100") && (this.power != null))
                            {
                                this.power.Visible = true;
                            }
                        }
                        if (this.order.OrderStatus == OrderStatus.WaitBuyerPay)
                        {
                            this.btnClocsOrder.Visible  = true;
                            this.btnModifyPrice.Visible = true;
                        }
                        else
                        {
                            this.btnClocsOrder.Visible  = false;
                            this.btnModifyPrice.Visible = false;
                        }
                        this.btnModifyPrice.Attributes.Add("onclick", "DialogFrame('../trade/EditOrder.aspx?OrderId=" + this.orderId + "&reurl=" + base.Server.UrlEncode(this.reurl) + "','修改订单价格',900,450)");
                        this.BindRemark(this.order);
                        this.ddlpayment.DataBind();
                        this.ddlpayment.SelectedValue = new int?(this.order.PaymentTypeId);
                        this.rptItemList.DataSource   = this.order.LineItems.Values;
                        this.rptItemList.DataBind();
                        string oldAddress = this.order.OldAddress;
                        string str7       = string.Empty;
                        if (!string.IsNullOrEmpty(this.order.ShippingRegion))
                        {
                            str7 = this.order.ShippingRegion.Replace(',', ' ');
                        }
                        if (!string.IsNullOrEmpty(this.order.Address))
                        {
                            str7 = str7 + this.order.Address;
                        }
                        if (!string.IsNullOrEmpty(this.order.ShipTo))
                        {
                            str7 = str7 + "," + this.order.ShipTo;
                        }
                        if (!string.IsNullOrEmpty(this.order.TelPhone))
                        {
                            str7 = str7 + "," + this.order.TelPhone;
                        }
                        if (!string.IsNullOrEmpty(this.order.CellPhone))
                        {
                            str7 = str7 + "," + this.order.CellPhone;
                        }
                        if (string.IsNullOrEmpty(oldAddress))
                        {
                            this.lblOriAddress.Text  = str7;
                            this.pNewAddress.Visible = false;
                        }
                        else
                        {
                            this.lblOriAddress.Text = oldAddress;
                            this.litAddress.Text    = str7;
                        }
                        if ((this.order.OrderStatus == OrderStatus.Finished) || (this.order.OrderStatus == OrderStatus.SellerAlreadySent))
                        {
                            string realModeName = this.order.RealModeName;
                            if (string.IsNullOrEmpty(realModeName))
                            {
                                realModeName = this.order.ModeName;
                            }
                            this.litModeName.Text        = realModeName;
                            this.litShipOrderNumber.Text = this.order.ShipOrderNumber;
                        }
                        else
                        {
                            this.litModeName.Text = this.order.ModeName;
                        }
                        if (!string.IsNullOrEmpty(this.order.ExpressCompanyName))
                        {
                            this.litCompanyName.Text = this.order.ExpressCompanyName;
                            this.hdCompanyCode.Value = this.order.ExpressCompanyAbb;
                        }
                        MemberInfo member = MemberProcessor.GetMember(this.order.UserId, true);
                        if (member != null)
                        {
                            if (!string.IsNullOrEmpty(member.OpenId))
                            {
                                this.litWeiXinNickName.Text = member.UserName;
                            }
                            if (!string.IsNullOrEmpty(member.UserBindName))
                            {
                                this.litUserName.Text = member.UserBindName;
                            }
                        }
                        if (this.order.ReferralUserId > 0)
                        {
                            builder = new StringBuilder();
                            builder.Append("<div class=\"commissionInfo mb20\"><h3>佣金信息</h3><div class=\"commissionInfoInner\">");
                            decimal num6                 = 0M;
                            decimal totalCommssion       = 0M;
                            decimal secondTotalCommssion = 0M;
                            decimal thirdTotalCommssion  = 0M;
                            if (this.order.OrderStatus != OrderStatus.Closed)
                            {
                                totalCommssion       = this.order.GetTotalCommssion();
                                secondTotalCommssion = this.order.GetSecondTotalCommssion();
                                thirdTotalCommssion  = this.order.GetThirdTotalCommssion();
                            }
                            num6 += totalCommssion;
                            string           storeName = string.Empty;
                            DistributorsInfo info4     = DistributorsBrower.GetDistributorInfo(this.order.ReferralUserId);
                            if (info4 != null)
                            {
                                storeName = info4.StoreName;
                                if ((this.order.ReferralPath != null) && (this.order.ReferralPath.Length > 0))
                                {
                                    string[] strArray      = this.order.ReferralPath.Trim().Split(new char[] { '|' });
                                    int      distributorid = 0;
                                    if (strArray.Length > 1)
                                    {
                                        distributorid = Globals.ToNum(strArray[0]);
                                        if (distributorid > 0)
                                        {
                                            info4 = DistributorsBrower.GetDistributorInfo(distributorid);
                                            if (info4 != null)
                                            {
                                                num6 += thirdTotalCommssion;
                                                builder.Append("<p class=\"mb5\"><span>上二级分销商:</span> " + info4.StoreName + "<i> ¥" + thirdTotalCommssion.ToString("F2") + "</i></p>");
                                            }
                                        }
                                        distributorid = Globals.ToNum(strArray[1]);
                                        if (distributorid > 0)
                                        {
                                            info4 = DistributorsBrower.GetDistributorInfo(distributorid);
                                            if (info4 != null)
                                            {
                                                num6 += secondTotalCommssion;
                                                builder.Append("<p class=\"mb5\"><span>上一级分销商:</span> " + info4.StoreName + "<i> ¥" + secondTotalCommssion.ToString("F2") + "</i></p>");
                                            }
                                        }
                                    }
                                    else if (strArray.Length == 1)
                                    {
                                        distributorid = Globals.ToNum(strArray[0]);
                                        if (distributorid > 0)
                                        {
                                            info4 = DistributorsBrower.GetDistributorInfo(distributorid);
                                            if (info4 != null)
                                            {
                                                builder.Append("<p class=\"mb5\"><span>上二级分销商:</span>-</p>");
                                                num6 += secondTotalCommssion;
                                                builder.Append("<p class=\"mb5\"><span>上一级分销商:</span>" + info4.StoreName + " <i> ¥" + secondTotalCommssion.ToString("F2") + "</i></p>");
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    builder.Append("<p class=\"mb5\"><span>上二级分销商:</span>-</p>");
                                    builder.Append("<p class=\"mb5\"><span>上一级分销商:</span>-</p>");
                                }
                            }
                            builder.Append("<div class=\"clearfix\">");
                            if (num5 > 0M)
                            {
                                string   str10     = " (改价让利¥" + num5.ToString("F2") + ")";
                                string[] strArray2 = new string[7];
                                strArray2[0] = "<p><span>成交店铺:</span> ";
                                strArray2[1] = storeName;
                                strArray2[2] = " <i>¥";
                                decimal num11 = totalCommssion - num5;
                                strArray2[3] = num11.ToString("F2");
                                strArray2[4] = "</i>";
                                strArray2[5] = str10;
                                strArray2[6] = "</p>";
                                builder.Append(string.Concat(strArray2));
                                builder.Append("<p><span>佣金总额:</span><i>¥" + ((num6 - num5)).ToString("F2") + "</i></p>");
                            }
                            else
                            {
                                builder.Append("<p><span>成交店铺:</span> " + storeName + " <i>¥" + totalCommssion.ToString("F2") + "</i></p>");
                                builder.Append("<p><span>佣金总额:</span><i>¥" + num6.ToString("F2") + "</i></p>");
                            }
                            builder.Append("</div></div></div>");
                            this.litCommissionInfo.Text = builder.ToString();
                        }
                        DataTable orderItemsReFundByOrderID = RefundHelper.GetOrderItemsReFundByOrderID(this.orderId);
                        if (orderItemsReFundByOrderID.Rows.Count > 0)
                        {
                            this.rptRefundList.DataSource = orderItemsReFundByOrderID;
                            this.rptRefundList.DataBind();
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static string ReturnUrlByQueryString()
        {
            int    userId = 0;
            string str    = HttpContext.Current.Request.Url.PathAndQuery.ToString();

            if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("returnUrl"))
            {
                if (HttpContext.Current.Request.Url.AbsolutePath == "/logout.aspx")
                {
                    return(string.Empty);
                }
                if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["ReferralId"]))
                {
                    userId = Globals.RequestQueryNum("ReferralId");
                    if (userId > 0)
                    {
                        if (DistributorsBrower.GetCurrentDistributors(userId, true) == null)
                        {
                            SetReferralIdCookie("0", "", false);
                            return("/Default.aspx?ReferralId=0");
                        }
                        HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                        if (cookie == null)
                        {
                            SetReferralIdCookie(userId.ToString(), "", false);
                        }
                        else if ((cookie != null) && (cookie.Value != userId.ToString()))
                        {
                            SetReferralIdCookie(userId.ToString(), "", false);
                        }
                    }
                }
                else
                {
                    HttpCookie cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                    if ((cookie2 != null) && !string.IsNullOrEmpty(cookie2.Value))
                    {
                        if (HttpContext.Current.Request.QueryString.Count > 0)
                        {
                            if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("ReferralId"))
                            {
                                return(str + "&ReferralId=" + cookie2.Value);
                            }
                            return(string.Empty);
                        }
                        if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("ReferralId"))
                        {
                            return(str + "?ReferralId=" + cookie2.Value);
                        }
                        return(string.Empty);
                    }
                }
                if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("returnUrl") && (HttpContext.Current.Request.Url.AbsolutePath != "/logout.aspx"))
                {
                    if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("ReferralId") && (HttpContext.Current.Request.QueryString.Count > 0))
                    {
                        return(str + "&ReferralId=" + userId.ToString());
                    }
                    if (!HttpContext.Current.Request.QueryString.AllKeys.Contains("ReferralId"))
                    {
                        return(str + "?ReferralId=" + userId.ToString());
                    }
                }
            }
            return(string.Empty);
        }
Exemplo n.º 3
0
        protected override void OnInit(EventArgs e)
        {
            string str = HttpContext.Current.Request["action"];

            if (str == "ReCreadt")
            {
                HttpContext.Current.Response.ContentType = "application/json";
                string str2 = HttpContext.Current.Request["imageUrl"];
                string s    = "";
                if (string.IsNullOrEmpty(str2))
                {
                    s = "{\"success\":\"false\",\"message\":\"图片地址为空\"}";
                }
                try
                {
                    MemberInfo       currentMember      = MemberProcessor.GetCurrentMember();
                    DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);
                    string           str4  = str2;
                    string           str5  = str2;
                    ScanInfos        infos = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                    if (infos == null)
                    {
                        ScanHelp.CreatNewScan(currentMember.UserId, "WX", 0);
                        infos = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                    }
                    string qRImageUrlByTicket = "";
                    if (infos == null)
                    {
                        qRImageUrlByTicket = Globals.HostPath(HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                    }
                    else
                    {
                        qRImageUrlByTicket = BarCodeApi.GetQRImageUrlByTicket(infos.CodeUrl);
                    }
                    string str7      = File.ReadAllText(HttpRuntime.AppDomainAppPath.ToString() + "Storage/Utility/StoreCardSet.js");
                    string storeName = userIdDistributors.StoreName;
                    if (!this.siteSettings.IsShowDistributorSelfStoreName)
                    {
                        storeName = this.siteSettings.SiteName;
                    }
                    StoreCardCreater creater = new StoreCardCreater(str7, str4, str5, qRImageUrlByTicket, currentMember.UserName, storeName, currentMember.UserId, currentMember.UserId);
                    string           imgUrl  = "";
                    if (creater.ReadJson() && creater.CreadCard(out imgUrl))
                    {
                        s = "{\"success\":\"true\",\"message\":\"生成成功\"}";
                        DistributorsBrower.UpdateStoreCard(currentMember.UserId, imgUrl);
                    }
                    else
                    {
                        s = "{\"success\":\"false\",\"message\":\"" + imgUrl + "\"}";
                    }
                }
                catch (Exception exception)
                {
                    s = "{\"success\":\"false\",\"message\":\"" + exception.Message + "\"}";
                }
                HttpContext.Current.Response.Write(s);
                HttpContext.Current.Response.End();
            }
            if (this.SkinName == null)
            {
                this.SkinName = "skin-VStoreCard.html";
            }
            base.OnInit(e);
        }
Exemplo n.º 4
0
        protected override void AttachChildControls()
        {
            this.litIsEnable    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litIsEnable");
            this.litIsMember    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litIsMember");
            this.litExpenditure = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litExpenditure");
            this.litminMoney    = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litminMoney");
            this.litProds       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litProds");
            this.litProdOK      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litProdOK");
            SiteSettings masterSettings      = SettingsManager.GetMasterSettings(true);
            int          currentMemberUserId = Globals.GetCurrentMemberUserId();

            if (currentMemberUserId > 0)
            {
                this.litIsMember.Value = "1";
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMemberUserId);
                MemberInfo       currentMember      = MemberProcessor.GetCurrentMember();
                if (currentMember == null)
                {
                    this.Page.Response.Redirect("/Vshop/DistributorCenter.aspx");
                    return;
                }
                this.UserBindName       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("UserBindName");
                this.UserBindName.Value = currentMember.UserBindName;
                decimal d = currentMember.Expenditure;
                if (userIdDistributors != null)
                {
                    if (userIdDistributors.ReferralStatus == 0)
                    {
                        this.IsEnable = "1";
                        this.Context.Response.Redirect("/Vshop/DistributorCenter.aspx");
                        this.Context.Response.End();
                    }
                    else if (userIdDistributors.ReferralStatus == 1)
                    {
                        this.IsEnable = "3";
                    }
                    else if (userIdDistributors.ReferralStatus == 9)
                    {
                        this.IsEnable = "9";
                    }
                }
                else
                {
                    decimal   num = 0m;
                    DataTable userOrderPaidWaitFinish = OrderHelper.GetUserOrderPaidWaitFinish(currentMemberUserId);
                    for (int i = 0; i < userOrderPaidWaitFinish.Rows.Count; i++)
                    {
                        OrderInfo orderInfo = OrderHelper.GetOrderInfo(userOrderPaidWaitFinish.Rows[i]["orderid"].ToString());
                        if (orderInfo != null)
                        {
                            decimal total = orderInfo.GetTotal();
                            if (total > 0m)
                            {
                                num += total;
                            }
                        }
                    }
                    d += num;
                    if (!masterSettings.DistributorApplicationCondition)
                    {
                        bool flag = SystemAuthorizationHelper.CheckDistributorIsCanAuthorization();
                        if (flag)
                        {
                            this.IsEnable = "2";
                        }
                        else
                        {
                            this.IsEnable = "4";
                        }
                    }
                    else
                    {
                        int finishedOrderMoney = masterSettings.FinishedOrderMoney;
                        this.litminMoney.Value = finishedOrderMoney.ToString();
                        if (finishedOrderMoney > 0 && d >= finishedOrderMoney)
                        {
                            bool flag = SystemAuthorizationHelper.CheckDistributorIsCanAuthorization();
                            if (flag)
                            {
                                this.IsEnable = "2";
                            }
                            else
                            {
                                this.IsEnable = "4";
                            }
                        }
                        if (masterSettings.EnableDistributorApplicationCondition)
                        {
                            if (!string.IsNullOrEmpty(masterSettings.DistributorProductsDate))
                            {
                                if (!string.IsNullOrEmpty(masterSettings.DistributorProducts))
                                {
                                    this.litProds.Value = masterSettings.DistributorProducts;
                                    if (masterSettings.DistributorProductsDate.Contains("|"))
                                    {
                                        System.DateTime value  = default(System.DateTime);
                                        System.DateTime value2 = default(System.DateTime);
                                        System.DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                        {
                                            '|'
                                        })[0].ToString(), out value);
                                        System.DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                        {
                                            '|'
                                        })[1].ToString(), out value2);
                                        if (value.CompareTo(System.DateTime.Now) > 0 || value2.CompareTo(System.DateTime.Now) < 0)
                                        {
                                            this.litProds.Value    = "";
                                            this.litIsEnable.Value = "0";
                                        }
                                        else if (MemberProcessor.CheckMemberIsBuyProds(currentMemberUserId, this.litProds.Value, new System.DateTime?(value), new System.DateTime?(value2)))
                                        {
                                            bool flag = SystemAuthorizationHelper.CheckDistributorIsCanAuthorization();
                                            if (flag)
                                            {
                                                this.IsEnable        = "2";
                                                this.litProdOK.Value = "(已购买指定商品,在" + value2.ToString("yyyy-MM-dd") + "之前申请有效)";
                                            }
                                            else
                                            {
                                                this.IsEnable = "4";
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    this.IsEnable = "6";
                                }
                            }
                        }
                    }
                }
                this.litExpenditure.Value = d.ToString("F2");
            }
            else
            {
                this.litIsMember.Value = "0";
            }
            this.litIsEnable.Value = this.IsEnable;
            PageTitle.AddSiteNameTitle("申请分销商");
        }
Exemplo n.º 5
0
        private HtmlInputHidden specialHideShow2;//特殊商户特殊隐藏处理

        protected override void AttachChildControls()
        {
            this.hyperindex         = (HyperLink)this.FindControl("hyperindex");
            this.litDistrbutorTitle = (Literal)this.FindControl("litDistrbutorTitle");
            this.litDistrbutorUrl   = (Literal)this.FindControl("litDistrbutorUrl");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            this.litDistrbutorUrl.Text = "ApplicationDescription.aspx";
            this.lblStyle         = (Literal)this.FindControl("lblStyle");
            this.paneldistributor = (Panel)this.FindControl("paneldistributor");
            this.litAllProduct    = (Literal)this.FindControl("litAllProduct");
            this.litProductUrl    = (Literal)this.FindControl("litProductUrl");
            this.isTypeButtonHide = (HtmlInputHidden)this.FindControl("isTypeButtonHide");
            this.specialHideShow2 = (HtmlInputHidden)this.FindControl("specialHideShow2");

            if (this.Page.Session["stylestatus"] != null)
            {
                this.lblStyle.Text = this.Page.Session["stylestatus"].ToString();
            }
            this.litDistrbutorTitle.Text = CustomConfigHelper.Instance.DistributorType_Showfootapply;
            if (currentMember != null)
            {
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);
                if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                {
                    //this.litDistrbutorTitle.Text = "店铺管理";
                    this.litDistrbutorTitle.Text = CustomConfigHelper.Instance.DistributorType_Showfootmanage;
                    this.litDistrbutorUrl.Text   = "DistributorValid.aspx";
                }
            }
            //迪曼(将分类按钮改为所有商品,并且改变跳转地址)
            if (CustomConfigHelper.Instance.ClassSkip)
            {
                this.litAllProduct.Text = "分类";
                this.litProductUrl.Text = "ProductSearch.aspx";
            }
            else
            {
                this.litAllProduct.Text = "所有商品";
                this.litProductUrl.Text = "ProductList.aspx";
            }
            //三座咖啡(隐藏掉分类按钮)
            this.isTypeButtonHide.Value = CustomConfigHelper.Instance.IsSanzuo ? "1" : "0";
            if (CustomConfigHelper.Instance.IsProLa)
            {
                this.specialHideShow2.Value = "proLa";
            }
            if (CustomConfigHelper.Instance.AutoShipping && CustomConfigHelper.Instance.AnonymousOrder)
            {
                this.specialHideShow2.Value = "sswf";
            }

            SiteSettings     masterSettings = SettingsManager.GetMasterSettings(false);
            MemberInfo       info3          = MemberProcessor.GetCurrentMember();
            decimal          expenditure    = 0M;
            DistributorsInfo info4          = null;

            if ((info3 != null) && (info3.UserId > 0))
            {
                info4       = DistributorsBrower.GetUserIdDistributors(info3.UserId);
                expenditure = info3.Expenditure;
            }
            this.paneldistributor.Visible = (masterSettings.IsRequestDistributor && (expenditure >= masterSettings.FinishedOrderMoney)) || ((info4 != null) && (info4.UserId > 0));
            int currentDistributorId = Globals.GetCurrentDistributorId();

            if ((this.hyperindex != null) && (currentDistributorId > 0))
            {
                this.hyperindex.NavigateUrl = "Default.aspx?ReferralId=" + currentDistributorId;
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            string str = context.Request.Form["actionName"];
            string s   = string.Empty;

            switch (str)
            {
            case "Vote":
                s = JsonConvert.SerializeObject(StoreHelper.GetVoteList());
                goto Label_0547;

            case "Category":
                s = JsonConvert.SerializeObject(from item in CatalogHelper.GetMainCategories() select new { CateId = item.CategoryId, CateName = item.Name });
                goto Label_0547;

            case "Activity":
            {
                Array           values = Enum.GetValues(typeof(LotteryActivityType));
                List <EnumJson> list2  = new List <EnumJson>();
                foreach (Enum enum2 in values)
                {
                    EnumJson json = new EnumJson
                    {
                        Name  = enum2.ToShowText(),
                        Value = enum2.ToString()
                    };
                    list2.Add(json);
                }
                s = JsonConvert.SerializeObject(list2);
                goto Label_0547;
            }

            case "ActivityList":
            {
                string str3 = context.Request.Form["acttype"];
                LotteryActivityType type = (LotteryActivityType)Enum.Parse(typeof(LotteryActivityType), str3);
                if (type == LotteryActivityType.SignUp)
                {
                    s = JsonConvert.SerializeObject(from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name });
                }
                goto Label_0547;
            }

            case "AccountTime":
            {
                s = s + "{";
                BalanceDrawRequestQuery entity = new BalanceDrawRequestQuery
                {
                    RequestTime      = "",
                    CheckTime        = "",
                    StoreName        = "",
                    PageIndex        = 1,
                    PageSize         = 1,
                    SortOrder        = SortAction.Desc,
                    SortBy           = "RequestTime",
                    RequestEndTime   = "",
                    RequestStartTime = "",
                    IsCheck          = "1",
                    UserId           = context.Request.Form["UserID"]
                };
                Globals.EntityCoding(entity, true);
                DataTable data = (DataTable)DistributorsBrower.GetBalanceDrawRequest(entity, null).Data;
                if (data.Rows.Count <= 0)
                {
                    s = s + "\"Time\":\"\"";
                    break;
                }
                if (!(data.Rows[0]["MerchantCode"].ToString().Trim() != context.Request.Form["merchantcode"].Trim()))
                {
                    s = s + "\"Time\":\"\"";
                    break;
                }
                s = s + "\"Time\":\"" + data.Rows[0]["RequestTime"].ToString() + "\"";
                break;
            }

            case "ProdSelect":
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                if (!string.IsNullOrEmpty(masterSettings.DistributorProducts))
                {
                    DataTable products = ProductHelper.GetProducts(masterSettings.DistributorProducts);
                    if ((products != null) && (products.Rows.Count > 0))
                    {
                        List <SelectProduct> list3 = new List <SelectProduct>();
                        foreach (DataRow row in products.Rows)
                        {
                            SelectProduct product = new SelectProduct
                            {
                                productid      = row["productid"].ToString(),
                                ProductName    = row["ProductName"].ToString(),
                                ThumbnailUrl60 = row["ThumbnailUrl60"].ToString()
                            };
                            list3.Add(product);
                        }
                        s = JsonConvert.SerializeObject(list3);
                    }
                }
                goto Label_0547;
            }

            case "ProdDel":
            {
                s = s + "{";
                string       str4     = context.Request.Form["productid"];
                SiteSettings settings = SettingsManager.GetMasterSettings(false);
                if (!string.IsNullOrEmpty(settings.DistributorProducts) && settings.DistributorProducts.Contains(str4))
                {
                    string str5 = "";
                    foreach (string str6 in settings.DistributorProducts.Split(new char[] { ',' }))
                    {
                        if (!str6.Equals(str4))
                        {
                            str5 = str5 + str6 + ",";
                        }
                    }
                    if (str5.Length > 0)
                    {
                        str5 = str5.Substring(0, str5.Length - 1);
                    }
                    settings.DistributorProducts = str5;
                    SettingsManager.Save(settings);
                }
                s = s + "\"status\":\"ok\"" + "}";
                goto Label_0547;
            }

            default:
                goto Label_0547;
            }
            s = s + "}";
Label_0547:
            context.Response.Write(s);
        }
Exemplo n.º 7
0
        public static string ExportOrderData(string orderidList)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("<table  cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");
            builder.Append("<thead><tr style=\"font-weight: bold; white-space: nowrap;background:#ccc;\">");
            builder.Append("<th style=\"border-right: 1px solid #ccc;\">订单编号</th><th style=\"border-right: 1px solid #ccc;\">商品名称</th><th style=\"border-right: 1px solid #ccc;\">商品编码</th><th style=\"border-right: 1px solid #ccc;\">SKU</th><th style=\"border-right: 1px solid #ccc;\">单价</th><th style=\"border-right: 1px solid #ccc;\">数量</th><th style=\"border-right: 1px solid #ccc;\">涨价或优惠</th><th style=\"border-right: 1px solid #ccc;\">买家会员名</th><th style=\"border-right: 1px solid #ccc;\">买家应付货款</th><th style=\"border-right: 1px solid #ccc;\">买家应付邮费</th><th style=\"border-right: 1px solid #ccc;\">总金额</th><th style=\"border-right: 1px solid #ccc;\">买家实际支付积分</th><th style=\"border-right: 1px solid #ccc;\">订单状态</th><th style=\"border-right: 1px solid #ccc;\">买家留言</th><th style=\"border-right: 1px solid #ccc;\">收货人姓名</th><th style=\"border-right: 1px solid #ccc;\">收货地址</th><th style=\"border-right: 1px solid #ccc;\">运送方式</th><th style=\"border-right: 1px solid #ccc;\">联系电话</th><th style=\"border-right: 1px solid #ccc;\">联系手机</th><th style=\"border-right: 1px solid #ccc;\">订单创建时间</th><th style=\"border-right: 1px solid #ccc;\">订单付款时间</th><th style=\"border-right: 1px solid #ccc;\">物流单号</th><th style=\"border-right: 1px solid #ccc;\">物流公司</th><th style=\"border-right: 1px solid #ccc;\">订单备注</th><th style=\"border-right: 1px solid #ccc;\">宝贝总数量</th><th style=\"border-right: 1px solid #ccc;\">分销商Id</th><th style=\"border-right: 1px solid #ccc;\">分销商店铺名称</th><th style=\"border-right: 1px solid #ccc;\">修改后的收货地址</th><th>积分抵扣</th><th>优惠</th>");
            builder.Append("</tr></thead><tbody>");
            foreach (string str in orderidList.Split(new char[] { ',' }))
            {
                OrderInfo orderInfo = GetOrderInfo(str);
                bool      flag      = true;
                if (orderInfo != null)
                {
                    int    count = orderInfo.LineItems.Values.Count;
                    string sKU   = string.Empty;
                    new StringBuilder();
                    int num2 = 0;
                    int num3 = 0;
                    foreach (LineItemInfo info2 in orderInfo.LineItems.Values)
                    {
                        builder.Append("<tr>");
                        if (flag)
                        {
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.OrderId), "</td>" }));
                        }
                        num2 += info2.PointNumber;
                        num3 += info2.Quantity;
                        sKU   = info2.SKU;
                        if (string.IsNullOrEmpty(sKU))
                        {
                            ProductInfo productDetails = ProductHelper.GetProductDetails(info2.ProductId);
                            if (productDetails != null)
                            {
                                sKU = productDetails.ProductCode;
                            }
                        }
                        builder.Append("<td>" + FormatOrderStr(info2.ItemDescription) + "</td>");
                        builder.Append("<td>" + FormatOrderStr(sKU) + "</td>");
                        builder.Append("<td>" + FormatOrderStr(info2.SkuId) + "</td>");
                        builder.Append("<td>" + ((info2.Type == 1) ? "0" : FormatOrderStr(info2.ItemAdjustedPrice.ToString("F2"))) + "</td>");
                        builder.Append("<td>" + info2.Quantity.ToString() + "</td>");
                        builder.Append("<td>" + ((info2.Type == 1) ? "0.00" : ((info2.ItemAdjustedCommssion * -1M)).ToString("F2")) + "</td>");
                        if (flag)
                        {
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.Username), "</td>" }));
                            decimal  total           = orderInfo.GetTotal();
                            decimal  adjustedFreight = orderInfo.AdjustedFreight;
                            object[] objArray3       = new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr((total - adjustedFreight).ToString("F2")), "</td>" };
                            builder.Append(string.Concat(objArray3));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.AdjustedFreight.ToString("F2")), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(total.ToString("F2")), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.PointExchange.ToString()), "</td>" }));
                            string str3 = string.Empty;
                            switch (orderInfo.OrderStatus)
                            {
                            case OrderStatus.WaitBuyerPay:
                                str3 = "等待付款";
                                break;

                            case OrderStatus.BuyerAlreadyPaid:
                                str3 = "已付款";
                                break;

                            case OrderStatus.SellerAlreadySent:
                                str3 = "已发货";
                                break;

                            case OrderStatus.Closed:
                                str3 = "已关闭";
                                break;

                            case OrderStatus.Finished:
                                str3 = "交易完成";
                                break;
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(str3), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.Remark.ToString()), "</td>" }));
                            string str4       = string.Empty;
                            string oldAddress = orderInfo.OldAddress;
                            if (!string.IsNullOrEmpty(orderInfo.ShippingRegion))
                            {
                                str4 = orderInfo.ShippingRegion.Replace(',', ' ');
                            }
                            if (!string.IsNullOrEmpty(orderInfo.Address))
                            {
                                str4 = str4 + orderInfo.Address;
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.ShipTo.ToString()), "</td>" }));
                            if (!string.IsNullOrEmpty(orderInfo.ZipCode))
                            {
                                str4 = str4 + " " + orderInfo.ZipCode;
                            }
                            if (!string.IsNullOrEmpty(orderInfo.TelPhone))
                            {
                                str4 = str4 + " " + orderInfo.TelPhone;
                            }
                            if (!string.IsNullOrEmpty(orderInfo.CellPhone))
                            {
                                str4 = str4 + " " + orderInfo.CellPhone;
                            }
                            string str6 = string.Empty;
                            if (string.IsNullOrEmpty(oldAddress))
                            {
                                builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(str4), "</td>" }));
                            }
                            else
                            {
                                str6 = str4;
                                builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(oldAddress), "</td>" }));
                            }
                            string realModeName = string.Empty;
                            if ((orderInfo.OrderStatus == OrderStatus.Finished) || (orderInfo.OrderStatus == OrderStatus.SellerAlreadySent))
                            {
                                realModeName = orderInfo.RealModeName;
                                if (string.IsNullOrEmpty(realModeName))
                                {
                                    realModeName = orderInfo.ModeName;
                                }
                            }
                            else
                            {
                                realModeName = orderInfo.ModeName;
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(realModeName), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.TelPhone), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.CellPhone), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.OrderDate.ToString()), "</td>" }));
                            string str8 = string.Empty;
                            if (orderInfo.PayDate.HasValue)
                            {
                                str8 = orderInfo.PayDate.ToString();
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(str8), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.ShipOrderNumber), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(orderInfo.ExpressCompanyName), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr((orderInfo.ManagerRemark == null) ? "" : orderInfo.ManagerRemark.ToString()), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", orderInfo.GetProductTotalNum(), "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr((orderInfo.ReferralUserId > 0) ? orderInfo.ReferralUserId.ToString() : ""), "</td>" }));
                            if (orderInfo.ReferralUserId > 0)
                            {
                                DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(orderInfo.ReferralUserId);
                                if (distributorInfo != null)
                                {
                                    builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(distributorInfo.StoreName), "</td>" }));
                                }
                                else
                                {
                                    builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(""), "</td>" }));
                                }
                            }
                            else
                            {
                                builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", FormatOrderStr(""), "</td>" }));
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", str6, "</td>" }));
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", (orderInfo.PointToCash == 0M) ? "" : orderInfo.PointToCash.ToString(), "</td>" }));
                            OrderInfo     info5    = orderInfo;
                            StringBuilder builder2 = new StringBuilder();
                            if (!string.IsNullOrEmpty(info5.ActivitiesName))
                            {
                                builder2.Append(info5.ActivitiesName + ":¥" + info5.DiscountAmount.ToString("F2"));
                            }
                            if (!string.IsNullOrEmpty(info5.ReducedPromotionName))
                            {
                                if (!string.IsNullOrEmpty(builder2.ToString()))
                                {
                                    builder2.Append("\r\n");
                                }
                                builder2.Append(info5.ReducedPromotionName + ":¥" + info5.ReducedPromotionAmount.ToString("F2"));
                            }
                            if (!string.IsNullOrEmpty(info5.CouponName))
                            {
                                if (!string.IsNullOrEmpty(builder2.ToString()))
                                {
                                    builder2.Append("\r\n");
                                }
                                builder2.Append(info5.CouponName + ":¥" + info5.CouponAmount.ToString("F2"));
                            }
                            if (!string.IsNullOrEmpty(info5.RedPagerActivityName))
                            {
                                if (!string.IsNullOrEmpty(builder2.ToString()))
                                {
                                    builder2.Append("\r\n");
                                }
                                builder2.Append(info5.RedPagerActivityName + ":¥" + info5.RedPagerAmount.ToString("F2"));
                            }
                            if (info5.PointToCash > 0M)
                            {
                                if (!string.IsNullOrEmpty(builder2.ToString()))
                                {
                                    builder2.Append("\r\n");
                                }
                                builder2.Append("积分抵现:¥" + info5.PointToCash.ToString("F2"));
                            }
                            info5.GetAdjustCommssion();
                            decimal num6 = 0M;
                            decimal num7 = 0M;
                            foreach (LineItemInfo info6 in info5.LineItems.Values)
                            {
                                if (info6.IsAdminModify)
                                {
                                    num6 += info6.ItemAdjustedCommssion;
                                }
                                else
                                {
                                    num7 += info6.ItemAdjustedCommssion;
                                }
                            }
                            if (num6 != 0M)
                            {
                                if (num6 > 0M)
                                {
                                    if (!string.IsNullOrEmpty(builder2.ToString()))
                                    {
                                        builder2.Append("\r\n");
                                    }
                                    builder2.Append("管理员调价减:¥" + num6.ToString("F2"));
                                }
                                else
                                {
                                    if (!string.IsNullOrEmpty(builder2.ToString()))
                                    {
                                        builder2.Append("\r\n");
                                    }
                                    decimal num9 = num6 * -1M;
                                    builder2.Append("管理员调价加:¥" + num9.ToString("F2"));
                                }
                            }
                            if (num7 != 0M)
                            {
                                if (num7 > 0M)
                                {
                                    if (!string.IsNullOrEmpty(builder2.ToString()))
                                    {
                                        builder2.Append("\r\n");
                                    }
                                    builder2.Append("分销商调价减:¥" + num7.ToString("F2"));
                                }
                                else
                                {
                                    if (!string.IsNullOrEmpty(builder2.ToString()))
                                    {
                                        builder2.Append("\r\n");
                                    }
                                    builder2.Append("分销商调价加:¥" + ((num7 * -1M)).ToString("F2"));
                                }
                            }
                            builder.Append(string.Concat(new object[] { "<td rowspan=\"", count, "\"  style=\"vnd.ms-excel.numberformat: @;\">", builder2.ToString(), "</td>" }));
                        }
                        flag = false;
                        builder.Append("</tr>");
                    }
                }
            }
            builder.Append("<tbody></table>");
            return(builder.ToString().Replace("<td>", "<td style=\"vnd.ms-excel.numberformat: @;\">"));
        }
Exemplo n.º 8
0
        private void BatchPaySend_Click(object sender, EventArgs e)
        {
            this.GetPaySetting();
            string str = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                str = base.Request["CheckBoxGroup"];
            }
            else
            {
                this.ShowMsg("参数错误!", false);
                return;
            }
            string str2 = this.PaybatchType.Value;

            if (str2 == "0")
            {
                string[]             strArray      = str.Split(new char[] { ',' });
                List <OutPayWeiInfo> batchUserList = new List <OutPayWeiInfo>();
                foreach (string str3 in strArray)
                {
                    BalanceDrawRequestInfo balanceDrawRequestById = DistributorsBrower.GetBalanceDrawRequestById(str3.ToString());
                    if (((balanceDrawRequestById != null) && (balanceDrawRequestById.IsCheck == "1")) && ((this.DrawMinNum <= balanceDrawRequestById.Amount) && !string.IsNullOrEmpty(balanceDrawRequestById.RedpackId)))
                    {
                        OutPayWeiInfo item = new OutPayWeiInfo
                        {
                            Amount           = ((int)balanceDrawRequestById.Amount) * 100,
                            Partner_Trade_No = balanceDrawRequestById.RedpackId,
                            Sid          = balanceDrawRequestById.SerialId,
                            Openid       = balanceDrawRequestById.MerchantCode,
                            Re_User_Name = balanceDrawRequestById.AccountName,
                            Desc         = " 分销商佣金发放",
                            UserId       = balanceDrawRequestById.UserId,
                            Nonce_Str    = OutPayHelp.GetRandomString(20)
                        };
                        batchUserList.Add(item);
                    }
                }
                if (batchUserList.Count < 1)
                {
                    this.ShowMsg("没有满足条件的提现请求!", false);
                    this.LoadParameters();
                    this.BindData();
                }
                else
                {
                    List <WeiPayResult> list2 = OutPayHelp.BatchWeiPay(batchUserList);
                    if (list2.Count < 1)
                    {
                        this.ShowMsg("系统异常,请联系管理员!", false);
                    }
                    else if (list2[0].return_code == "INITFAIL")
                    {
                        this.ShowMsg(list2[0].return_msg, false);
                    }
                    else
                    {
                        int    num   = 0;
                        int    num2  = 0;
                        int    num3  = 0;
                        int    count = batchUserList.Count;
                        string str4  = "<div class='errRow'>支付失败信息如下:";
                        using (List <WeiPayResult> .Enumerator enumerator = list2.GetEnumerator())
                        {
                            while (enumerator.MoveNext())
                            {
                                Func <OutPayWeiInfo, bool> predicate = null;
                                WeiPayResult rItem = enumerator.Current;
                                if (predicate == null)
                                {
                                    predicate = t => t.Partner_Trade_No == rItem.partner_trade_no;
                                }
                                int sid = batchUserList.FirstOrDefault <OutPayWeiInfo>(predicate).Sid;
                                if (rItem.result_code == "SUCCESS")
                                {
                                    VShopHelper.UpdateBalanceDrawRequest(sid, "微信企业付款:流水号" + rItem.payment_no);
                                    int     userId = rItem.UserId;
                                    decimal referralRequestBalance = rItem.Amount / 100;
                                    VShopHelper.UpdateBalanceDistributors(rItem.UserId, referralRequestBalance);
                                    if ((referralRequestBalance > 0M) && (sid > 0))
                                    {
                                        BalanceDrawRequestInfo balance = DistributorsBrower.GetBalanceDrawRequestById(sid.ToString());
                                        if (balance != null)
                                        {
                                            try
                                            {
                                                Messenger.SendWeiXinMsg_DrawCashRelease(balance);
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                    num3 += rItem.Amount / 100;
                                    num++;
                                }
                                else
                                {
                                    if (((rItem.err_code == "OPENID_ERROR") || (rItem.err_code == "NAME_MISMATCH")) || (rItem.return_msg.Contains("openid字段") || (rItem.err_code == "FATAL_ERROR")))
                                    {
                                        DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { sid }, 3, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss  ") + rItem.return_msg, null);
                                    }
                                    else
                                    {
                                        DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { sid }, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss  ") + rItem.return_msg, null);
                                    }
                                    object obj2 = str4;
                                    str4 = string.Concat(new object[] { obj2, "<br>ID:", sid, ", 出错提示:", rItem.return_msg });
                                    num2++;
                                }
                            }
                        }
                        count = (count - num2) - num;
                        str4  = str4 + "</div>";
                        if ((num3 == num) && (num3 != 0))
                        {
                            this.ShowMsg("全部支付成功", true);
                        }
                        else
                        {
                            this.ShowMsg(string.Concat(new object[] { "本次成功支付金额", num3, "元,其中成功", num, "笔,失败", num2, "笔,异常放弃", count, "笔", str4 }), false);
                        }
                        this.LoadParameters();
                        this.BindData();
                    }
                }
            }
            else if (str2 == "1")
            {
                this.ShowMsg("接口暂未开通", false);
            }
            else
            {
                this.ShowMsg("未定义支付方式", false);
            }
        }
Exemplo n.º 9
0
        private void weipaySend_Click(object sender, EventArgs e)
        {
            int     id = Globals.ToNum(this.HiddenSid.Value);
            decimal referralRequestBalance = decimal.Parse(this.hdreferralblance.Value);
            BalanceDrawRequestInfo balanceDrawRequestById = DistributorsBrower.GetBalanceDrawRequestById(id.ToString());

            if (balanceDrawRequestById != null)
            {
                if (balanceDrawRequestById.IsCheck == "2")
                {
                    this.ShowMsg("该申请已经支付,请检查", false);
                }
                else if (balanceDrawRequestById.IsCheck == "-1")
                {
                    this.ShowMsg("该申请已经驳回,请检查", false);
                }
                else if (string.IsNullOrEmpty(balanceDrawRequestById.RedpackId))
                {
                    this.ShowMsg("商户订单ID为空", false);
                }
                else
                {
                    WeiPayResult result = OutPayHelp.SingleWeiPay((int)(referralRequestBalance * 100M), "分销商佣金发放!", balanceDrawRequestById.MerchantCode, balanceDrawRequestById.AccountName, balanceDrawRequestById.RedpackId, balanceDrawRequestById.UserId);
                    if (result.result_code == "SUCCESS")
                    {
                        VShopHelper.UpdateBalanceDrawRequest(id, "微信企业付款");
                        int userId = balanceDrawRequestById.UserId;
                        VShopHelper.UpdateBalanceDistributors(balanceDrawRequestById.UserId, referralRequestBalance);
                        if (referralRequestBalance > 0M)
                        {
                            BalanceDrawRequestInfo balance = DistributorsBrower.GetBalanceDrawRequestById(id.ToString());
                            if (balance != null)
                            {
                                try
                                {
                                    Messenger.SendWeiXinMsg_DrawCashRelease(balance);
                                }
                                catch
                                {
                                }
                            }
                        }
                        this.LoadParameters();
                        this.BindData();
                        this.ShowMsg("支付成功!", true);
                    }
                    else
                    {
                        if (((result.err_code == "OPENID_ERROR") || (result.err_code == "NAME_MISMATCH")) || (result.return_msg.Contains("openid字段") || (result.err_code == "FATAL_ERROR")))
                        {
                            DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { id }, 3, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss  ") + result.return_msg, referralRequestBalance.ToString());
                            this.LoadParameters();
                            this.BindData();
                        }
                        else
                        {
                            DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[] { id }, 1, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss  ") + result.return_msg, referralRequestBalance.ToString());
                        }
                        this.ShowMsg("微信企业付款失败," + result.return_msg, false);
                    }
                }
            }
            else
            {
                this.ShowMsg("参数错误!", false);
            }
        }
Exemplo n.º 10
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("会员中心");
            MemberInfo currentMemberInfo = this.CurrentMemberInfo;

            if (currentMemberInfo == null)
            {
                this.Page.Response.Redirect("/logout.aspx");
            }
            else
            {
                int currentMemberUserId = Globals.GetCurrentMemberUserId();
                this.UserBindName       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("UserBindName");
                this.UserBindName.Value = currentMemberInfo.UserBindName;
                this.UpClassInfo        = (System.Web.UI.HtmlControls.HtmlContainerControl) this.FindControl("UpClassInfo");
                this.litUserName        = (System.Web.UI.WebControls.Literal) this.FindControl("litUserName");
                this.litPoints          = (System.Web.UI.WebControls.Literal) this.FindControl("litPoints");
                this.litPoints.Text     = currentMemberInfo.Points.ToString();
                this.image          = (System.Web.UI.WebControls.Image) this.FindControl("image");
                this.litBindUser    = (System.Web.UI.WebControls.Literal) this.FindControl("litBindUser");
                this.litExpenditure = (System.Web.UI.WebControls.Literal) this.FindControl("litExpenditure");
                this.litExpenditure.SetWhenIsNotNull("¥" + currentMemberInfo.Expenditure.ToString("F2"));
                if (!string.IsNullOrEmpty(currentMemberInfo.UserBindName))
                {
                    this.litBindUser.Text = " style=\"display:none\"";
                }
                MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(currentMemberInfo.GradeId);
                this.litrGradeName = (System.Web.UI.WebControls.Literal) this.FindControl("litrGradeName");
                if (memberGrade != null)
                {
                    this.litrGradeName.Text = memberGrade.Name;
                }
                else
                {
                    this.litrGradeName.Text = "普通会员";
                }
                this.litUserName.Text = (string.IsNullOrEmpty(currentMemberInfo.RealName) ? currentMemberInfo.UserName : currentMemberInfo.RealName);
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                this.IsSign = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("IsSign");
                if (!masterSettings.sign_score_Enable)
                {
                    this.IsSign.Value = "-1";
                }
                else if (!UserSignHelper.IsSign(currentMemberInfo.UserId))
                {
                    this.IsSign.Value = "1";
                }
                if (!string.IsNullOrEmpty(currentMemberInfo.UserHead))
                {
                    this.image.ImageUrl = currentMemberInfo.UserHead;
                }
                this.txtWaitForstr = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtWaitForstr");
                OrderQuery orderQuery = new OrderQuery();
                orderQuery.Status = OrderStatus.WaitBuyerPay;
                int userOrderCount = MemberProcessor.GetUserOrderCount(currentMemberUserId, orderQuery);
                orderQuery.Status = OrderStatus.SellerAlreadySent;
                int userOrderCount2 = MemberProcessor.GetUserOrderCount(currentMemberUserId, orderQuery);
                orderQuery.Status = OrderStatus.BuyerAlreadyPaid;
                int userOrderCount3      = MemberProcessor.GetUserOrderCount(currentMemberUserId, orderQuery);
                int waitCommentByUserID  = ProductBrowser.GetWaitCommentByUserID(currentMemberUserId);
                int userOrderReturnCount = MemberProcessor.GetUserOrderReturnCount(currentMemberUserId);
                this.txtWaitForstr.Value = string.Concat(new string[]
                {
                    userOrderCount.ToString(),
                    "|",
                    userOrderCount3.ToString(),
                    "|",
                    userOrderCount2.ToString(),
                    "|",
                    waitCommentByUserID.ToString(),
                    "|",
                    userOrderReturnCount.ToString()
                });
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMemberUserId);
                this.txtShowDis = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("txtShowDis");
                if (userIdDistributors == null || userIdDistributors.ReferralStatus != 0)
                {
                    this.txtShowDis.Value = "false";
                }
                else
                {
                    this.txtShowDis.Value = "true";
                }
                System.Collections.Generic.IList <MemberGradeInfo> memberGrades = MemberHelper.GetMemberGrades();
                MemberGradeInfo memberGradeInfo = null;
                foreach (MemberGradeInfo current in memberGrades)
                {
                    double?tranVol  = memberGrade.TranVol;
                    double?tranVol2 = current.TranVol;
                    if (tranVol.GetValueOrDefault() < tranVol2.GetValueOrDefault() || !(tranVol.HasValue & tranVol2.HasValue) || !(memberGrade.TranTimes >= current.TranTimes))
                    {
                        tranVol  = memberGrade.TranVol;
                        tranVol2 = current.TranVol;
                        if ((tranVol.GetValueOrDefault() < tranVol2.GetValueOrDefault() && (tranVol.HasValue & tranVol2.HasValue)) || memberGrade.TranTimes < current.TranTimes)
                        {
                            if (memberGradeInfo == null)
                            {
                                memberGradeInfo = current;
                            }
                            else
                            {
                                tranVol  = memberGradeInfo.TranVol;
                                tranVol2 = current.TranVol;
                                if ((tranVol.GetValueOrDefault() > tranVol2.GetValueOrDefault() && (tranVol.HasValue & tranVol2.HasValue)) || memberGradeInfo.TranTimes > current.TranTimes)
                                {
                                    memberGradeInfo = current;
                                }
                            }
                        }
                    }
                }
                if (memberGradeInfo == null)
                {
                    this.UpClassInfo.Visible = false;
                }
                else
                {
                    int num = 0;
                    if (memberGradeInfo.TranTimes.HasValue)
                    {
                        num = memberGradeInfo.TranTimes.Value - currentMemberInfo.OrderNumber;
                    }
                    if (num <= 0)
                    {
                        num = 1;
                    }
                    decimal d = 0m;
                    if (memberGradeInfo.TranVol.HasValue)
                    {
                        d = (decimal)memberGradeInfo.TranVol.Value - currentMemberInfo.Expenditure;
                    }
                    if (d <= 0m)
                    {
                        d = 0.01m;
                    }
                    this.UpClassInfo.InnerHtml = string.Concat(new string[]
                    {
                        "再交易<span>",
                        num.ToString(),
                        "次 </span>或消费<span> ",
                        System.Math.Round(d + 0.49m, 0).ToString(),
                        "元 </span>升级"
                    });
                }
            }
        }
Exemplo n.º 11
0
        protected override void AttachChildControls()
        {
            this.vshopcommssion       = (VshopTemplatedRepeater)this.FindControl("vshopcommssion");
            this.lbltotalcommission   = (FormatedMoneyLabel)this.FindControl("lbltotalcommission");
            this.lblsurpluscommission = (FormatedMoneyLabel)this.FindControl("lblsurpluscommission");
            this.lblAlreadycommission = (FormatedMoneyLabel)this.FindControl("lblAlreadycommission");
            this.lblcommission        = (FormatedMoneyLabel)this.FindControl("lblcommission");
            this.lbltwocommission     = (FormatedMoneyLabel)this.FindControl("lbltwocommission");
            this.lblthreecommission   = (FormatedMoneyLabel)this.FindControl("lblthreecommission");
            this.lblsaleprice         = (FormatedMoneyLabel)this.FindControl("lblsaleprice");
            this.lbltwosaleprice      = (FormatedMoneyLabel)this.FindControl("lbltwosaleprice");
            this.lblthreesaleprice    = (FormatedMoneyLabel)this.FindControl("lblthreesaleprice");
            this.paneltwo             = (Panel)this.FindControl("paneltwo");
            this.panelthree           = (Panel)this.FindControl("panelthree");
            this.litMsg    = (Literal)this.FindControl("litMsg");
            this.hyrequest = (HyperLink)this.FindControl("hyrequest");
            PageTitle.AddSiteNameTitle("我的佣金");
            DistributorsInfo userIdDistributors           = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId());
            DataTable        currentDistributorsCommosion = DistributorsBrower.GetCurrentDistributorsCommosion(userIdDistributors.UserId);

            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                this.lblsurpluscommission.Money = userIdDistributors.ReferralBlance;
                this.lblAlreadycommission.Money = userIdDistributors.ReferralRequestBalance;
                if (userIdDistributors.DistributorGradeId == DistributorGrade.TowDistributor)
                {
                    this.paneltwo.Visible = false;
                }
                else if (userIdDistributors.DistributorGradeId == DistributorGrade.ThreeDistributor)
                {
                    this.paneltwo.Visible   = false;
                    this.panelthree.Visible = false;
                }
                if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                {
                    this.lblcommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                    this.lblsaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                }
                if (userIdDistributors.DistributorGradeId == DistributorGrade.OneDistributor)
                {
                    currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.TowDistributor);
                    if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                    {
                        this.lbltwocommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                        this.lbltwosaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                    }
                    currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.ThreeDistributor);
                    if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                    {
                        this.lblthreecommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                        this.lblthreesaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                    }
                }
                if (userIdDistributors.DistributorGradeId == DistributorGrade.TowDistributor)
                {
                    currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.ThreeDistributor);
                    if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                    {
                        this.lblthreecommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                        this.lblthreesaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                    }
                }
                this.lbltotalcommission.Money = userIdDistributors.ReferralBlance + userIdDistributors.ReferralRequestBalance;
                if (DistributorsBrower.IsExitsCommionsRequest())
                {
                    this.hyrequest.Text    = "申请审核当中……";
                    this.hyrequest.Enabled = false;
                }
                MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                if (string.IsNullOrEmpty(currentMember.RealName) || string.IsNullOrEmpty(currentMember.CellPhone))
                {
                    this.hyrequest.NavigateUrl = "UserInfo.aspx?edit=true&&returnUrl=" + Globals.UrlEncode(Globals.HostPath(HttpContext.Current.Request.Url) + "/Vshop/RequestCommissions.aspx");
                }
                //明细列表
                CommissionsQuery query;
                this.vshopcommssion = (VshopTemplatedRepeater)this.FindControl("vshopcommssion");
                query           = new CommissionsQuery();
                query.StartTime = query.EndTime = "";
                query.PageIndex = 1;
                query.PageSize  = 0x186a0;
                query.UserId    = MemberProcessor.GetCurrentMember().UserId;

                Hidistro.Core.Entities.DbQueryResult commissions = DistributorsBrower.GetCommissions(query);
                if (commissions.TotalRecords > 0)
                {
                    this.vshopcommssion.DataSource = commissions.Data;
                    this.vshopcommssion.DataBind();
                }
            }
        }
Exemplo n.º 12
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     System.Collections.Generic.SortedDictionary <string, string> requestPost = this.GetRequestPost();
     if (requestPost.Count > 0)
     {
         Notify notify = new Notify();
         bool   flag   = notify.Verify(requestPost, base.Request.Form["notify_id"], base.Request.Form["sign"]);
         if (flag)
         {
             string text = base.Request.Form["success_details"];
             try
             {
                 if (!string.IsNullOrEmpty(text))
                 {
                     string[] array = text.Split(new char[]
                     {
                         '|'
                     });
                     string[] array2 = array;
                     for (int i = 0; i < array2.Length; i++)
                     {
                         string   text2  = array2[i];
                         string[] array3 = text2.Split(new char[]
                         {
                             '^'
                         });
                         if (array3.Length >= 8)
                         {
                             BalanceDrawRequestInfo balanceDrawRequestById = DistributorsBrower.GetBalanceDrawRequestById(array3[0]);
                             if (balanceDrawRequestById != null && balanceDrawRequestById.IsCheck != "2")
                             {
                                 VShopHelper.UpdateBalanceDrawRequest(int.Parse(array3[0]), "支付宝付款:流水号" + array3[6] + ",支付时间:" + array3[7]);
                                 VShopHelper.UpdateBalanceDistributors(balanceDrawRequestById.UserId, decimal.Parse(array3[3]));
                             }
                         }
                     }
                 }
                 string text3 = base.Request.Form["fail_details"];
                 if (!string.IsNullOrEmpty(text3))
                 {
                     string[] array4 = text3.Split(new char[]
                     {
                         '|'
                     });
                     string[] array5 = array4;
                     for (int j = 0; j < array5.Length; j++)
                     {
                         string   text4  = array5[j];
                         string[] array6 = text4.Split(new char[]
                         {
                             '^'
                         });
                         if (array6.Length >= 8)
                         {
                             BalanceDrawRequestInfo balanceDrawRequestById2 = DistributorsBrower.GetBalanceDrawRequestById(array6[0]);
                             if (balanceDrawRequestById2 != null && balanceDrawRequestById2.IsCheck != "2")
                             {
                                 DistributorsBrower.SetBalanceDrawRequestIsCheckStatus(new int[]
                                 {
                                     int.Parse(array6[0])
                                 }, 3, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss  ") + array6[5] + array6[6], array6[3]);
                             }
                         }
                     }
                 }
             }
             catch (System.Exception)
             {
                 try
                 {
                     string path = Globals.MapPath("/Admin/OutPay/App/") + "payLog.txt";
                     using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path, true, System.Text.Encoding.UTF8))
                     {
                         streamWriter.Write(System.DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]") + "支付成功,写入数据库失败->" + base.Request.Form.ToString() + "\r\n");
                     }
                 }
                 catch (System.Exception)
                 {
                 }
             }
             base.Response.Write("success");
             return;
         }
         base.Response.Write("fail");
         try
         {
             string path2 = Globals.MapPath("/Admin/OutPay/App/") + "payLog.txt";
             using (System.IO.StreamWriter streamWriter2 = new System.IO.StreamWriter(path2, true, System.Text.Encoding.UTF8))
             {
                 streamWriter2.Write(System.DateTime.Now.ToString("[yyyy-MM-dd HH:mm:ss]") + "支付失败->" + base.Request.Form.ToString() + "\r\n");
             }
             return;
         }
         catch (System.Exception)
         {
             return;
         }
     }
     base.Response.Write("无通知参数");
 }
Exemplo n.º 13
0
        protected override void AttachChildControls()
        {
            this.panelHomePage = (Panel)this.FindControl("panelHomePage");
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            this.hidFlowWindow = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hidFlowWindow");

            //店铺推广码送过来的地址(参数:ReferralId)
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
            {
                //无传参,取COOKIE
                HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
                {
                    this.Page.Response.Redirect("Index.aspx?ReferralId=" + cookie.Value);
                }
            }
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            this.hidFlowWindow.Value = masterSettings.isFlowWindowsOn ? "1" : "0";
            PageTitle.AddSiteNameTitle(masterSettings.SiteName);
            DistributorsInfo userIdDistributors = new DistributorsInfo();

            userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
            if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
            {
                PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
            }
            if (base.referralId <= 0)
            {
                HttpCookie cookie2 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if ((cookie2 != null) && !string.IsNullOrEmpty(cookie2.Value))
                {
                    base.referralId = int.Parse(cookie2.Value);
                    this.Page.Response.Redirect("Index.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            else
            {
                HttpCookie cookie3 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (((cookie3 != null) && !string.IsNullOrEmpty(cookie3.Value)) && (this.referralId.ToString() != cookie3.Value))
                {
                    this.Page.Response.Redirect("Index.aspx?ReferralId=" + this.referralId.ToString(), true);//跳转到自己的店铺
                }
            }


            panelHomePage.Controls.Clear();
            string  selectSql = string.Format("Select * From YiHui_HomePage Where PageType={0} order by PageSN", 11);
            DataSet ds        = DataBaseHelper.GetDataSet(selectSql);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                BaseModel baseModel = (BaseModel)this.Page.LoadControl("/admin/HomePage/ModelTag/" + dr["ModelCode"] + ".ascx");
                baseModel.PKID   = new Guid(dr["PageID"].ToString());//模块的内容ID
                baseModel.PageSN = dr["PageSN"] + "";
                panelHomePage.Controls.Add(baseModel);
            }
            string str3 = "";

            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string str4 = "";
            string str5 = (userIdDistributors == null) ? masterSettings.SiteName : userIdDistributors.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                str4 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[] { '|' })[0];
            }
            string strDes = masterSettings.ShopHomeDescription;

            if (Hidistro.ControlPanel.Config.CustomConfigHelper.Instance.BrandShow)
            {
                strDes = "我很喜欢这家平台的东西,澳洲奶粉,保健品,化妆品价格也挺便宜,你也来看看把!";
            }
            this.litItemParams.Text = str3 + "|" + masterSettings.ShopHomeName + "|" + strDes + "$";
            this.litItemParams.Text = string.Concat(new object[] { this.litItemParams.Text, str4, "|好店推荐之", str5, "商城|一个购物赚钱的好去处|", HttpContext.Current.Request.Url });
            getMyCoupon();          //获取首页赠送优惠券
            distributorVisitCont(); //更新店铺访问信息
        }
Exemplo n.º 14
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("分销中心");
            int currentMemberUserId             = Globals.GetCurrentMemberUserId();
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMemberUserId);

            if (userIdDistributors == null)
            {
                HttpContext.Current.Response.Redirect("DistributorRegCheck.aspx");
            }
            else if (userIdDistributors.ReferralStatus != 0)
            {
                HttpContext.Current.Response.Redirect("MemberCenter.aspx");
            }
            else
            {
                this.imglogo = (Image)this.FindControl("image");
                if (!string.IsNullOrEmpty(userIdDistributors.Logo))
                {
                    this.imglogo.ImageUrl = userIdDistributors.Logo;
                }
                this.litStroeName      = (Literal)this.FindControl("litStroeName");
                this.litStroeName.Text = userIdDistributors.StoreName;
                this.litrGradeName     = (Literal)this.FindControl("litrGradeName");
                DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(userIdDistributors.DistriGradeId);
                if (distributorGradeInfo != null)
                {
                    this.litrGradeName.Text = distributorGradeInfo.Name;
                }
                this.litReferralBlance      = (Literal)this.FindControl("litReferralBlance");
                this.litReferralBlance.Text = userIdDistributors.ReferralBlance.ToString("F2");
                this.litUserId         = (Literal)this.FindControl("litUserId");
                this.litUserId1        = (Literal)this.FindControl("litUserId1");
                this.litUserId2        = (Literal)this.FindControl("litUserId2");
                this.litUserId3        = (Literal)this.FindControl("litUserId3");
                this.litUserId4        = (Literal)this.FindControl("litUserId4");
                this.litUserId.Text    = userIdDistributors.UserId.ToString();
                this.litUserId1.Text   = userIdDistributors.UserId.ToString();
                this.litUserId2.Text   = userIdDistributors.UserId.ToString();
                this.litUserId3.Text   = userIdDistributors.UserId.ToString();
                this.litUserId4.Text   = userIdDistributors.UserId.ToString();
                this.litTodayOrdersNum = (Literal)this.FindControl("litTodayOrdersNum");
                OrderQuery query = new OrderQuery {
                    UserId = new int?(currentMemberUserId),
                    Status = OrderStatus.Today
                };
                this.litTodayOrdersNum.Text = DistributorsBrower.GetDistributorOrderCount(query).ToString();
                this.refrraltotal           = (FormatedMoneyLabel)this.FindControl("refrraltotal");
                this.refrraltotal.Money     = DistributorsBrower.GetUserCommissions(userIdDistributors.UserId, DateTime.Now, null, null, null, "");
                this.saletotal       = (FormatedMoneyLabel)this.FindControl("saletotal");
                this.saletotal.Money = userIdDistributors.OrdersTotal;
                this.litMysubMember  = (Literal)this.FindControl("litMysubMember");
                this.litMysubFirst   = (Literal)this.FindControl("litMysubFirst");
                this.litMysubSecond  = (Literal)this.FindControl("litMysubSecond");
                DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId);
                if ((distributorsSubStoreNum != null) || (distributorsSubStoreNum.Rows.Count > 0))
                {
                    this.litMysubMember.Text = distributorsSubStoreNum.Rows[0]["memberCount"].ToString();
                    this.litMysubFirst.Text  = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                    this.litMysubSecond.Text = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
                }
                else
                {
                    this.litMysubMember.Text = "0";
                    this.litMysubFirst.Text  = "0";
                    this.litMysubSecond.Text = "0";
                }
                this.litProtuctNum      = (Literal)this.FindControl("litProtuctNum");
                this.litProtuctNum.Text = ProductBrowser.GetProductsNumber(true).ToString();
                query.Status            = OrderStatus.All;
                this.litOrders          = (Literal)this.FindControl("litOrders");
                this.litOrders.Text     = DistributorsBrower.GetDistributorOrderCount(query).ToString();
                this.UpClassInfo        = (HtmlContainerControl)this.FindControl("UpClassInfo");
                IList <DistributorGradeInfo> distributorGradeInfos = VShopHelper.GetDistributorGradeInfos();
                DistributorGradeInfo         info3 = null;
                foreach (DistributorGradeInfo info4 in distributorGradeInfos)
                {
                    if (distributorGradeInfo.CommissionsLimit < info4.CommissionsLimit)
                    {
                        if (info3 == null)
                        {
                            info3 = info4;
                        }
                        else if (info3.CommissionsLimit > info4.CommissionsLimit)
                        {
                            info3 = info4;
                        }
                    }
                }
                if (info3 == null)
                {
                    this.UpClassInfo.Visible = false;
                }
                else
                {
                    decimal num2 = (info3.CommissionsLimit - userIdDistributors.ReferralBlance) - userIdDistributors.ReferralRequestBalance;
                    if (num2 < 0M)
                    {
                        num2 = 0.01M;
                    }
                    this.UpClassInfo.InnerHtml = "再获得<span> " + num2.ToString("F2") + " 元</span>佣金升级为 <span>" + info3.Name + "</span>";
                }
            }
        }
Exemplo n.º 15
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            StringBuilder builder       = new StringBuilder();
            MemberInfo    currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                MemberGradeInfo  memberGrade        = MemberProcessor.GetMemberGrade(currentMember.GradeId);
                OrderInfo        userLastOrder      = MemberProcessor.GetUserLastOrder(currentMember.UserId);
                string           str                = !string.IsNullOrEmpty(currentMember.UserBindName) ? currentMember.UserBindName : currentMember.UserName;
                string           str2               = !string.IsNullOrEmpty(currentMember.OpenId) ? currentMember.UserName : string.Empty;
                int              port               = context.Request.Url.Port;
                string           str3               = (port == 80) ? "" : (":" + port.ToString());
                string           text1              = "http://" + context.Request.Url.Host + str3 + Globals.ApplicationPath + "/Admin/member/managemembers.aspx?Username="******"&pageSize=10";
                string           str4               = currentMember.UserBindName + "【" + ((memberGrade != null) ? memberGrade.Name : "普通会员") + "】";
                string           str5               = currentMember.OrderNumber.ToString() + "单(¥" + currentMember.Expenditure.ToString("F2") + ")";
                string           str6               = (userLastOrder != null) ? userLastOrder.OrderDate.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
                string           str7               = string.Empty;
                string           str8               = string.Empty;
                string           str9               = string.Empty;
                string           str10              = string.Empty;
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId());
                if (userIdDistributors != null)
                {
                    DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(userIdDistributors.DistriGradeId);
                    string           str11           = "0.00";
                    DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(userIdDistributors.UserId);
                    if (distributorInfo != null)
                    {
                        str11 = distributorInfo.ReferralBlance.ToString("F2");
                    }
                    string    str12 = "0";
                    string    str13 = "0";
                    DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId);
                    if ((distributorsSubStoreNum != null) || (distributorsSubStoreNum.Rows.Count > 0))
                    {
                        str12 = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                        str13 = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
                    }
                    string text2 = "http://" + context.Request.Url.Host + str3 + Globals.ApplicationPath + "/Admin/Fenxiao/distributorlist.aspx?MicroSignal=" + currentMember.UserName + "&Status=0&pageSize=10";
                    str7  = userIdDistributors.StoreName + "【" + distributorGradeInfo.Name + "】";
                    str8  = "¥" + userIdDistributors.OrdersTotal.ToString("F2");
                    str9  = "¥" + str11 + "(待提现¥" + userIdDistributors.ReferralBlance.ToString("F2") + ",已提现¥" + userIdDistributors.ReferralRequestBalance.ToString("F2") + ")";
                    str10 = "一级分店数" + str12 + ",二级分店数" + str13;
                }
                builder.Append("<script>");
                builder.Append("var mechatMetadataInter = setInterval(function() {");
                builder.Append("if (window.mechatMetadata) {");
                builder.Append("clearInterval(mechatMetadataInter);");
                builder.Append("window.mechatMetadata({");
                builder.AppendFormat("appUserName: '******',", str);
                builder.AppendFormat("appNickName: '{0}',", currentMember.UserName);
                builder.AppendFormat("realName: '{0}',", currentMember.RealName);
                builder.AppendFormat("avatar: '{0}',", currentMember.UserHead);
                builder.AppendFormat("tel: '{0}',", currentMember.CellPhone);
                builder.AppendFormat("email: '{0}',", currentMember.Email);
                builder.AppendFormat("QQ: '{0}',", currentMember.QQ);
                builder.AppendFormat("weibo: '',", new object[0]);
                builder.AppendFormat("weixin: '{0}',", str2);
                builder.AppendFormat("address: '{0}',", currentMember.Address);
                builder.Append("extraParams: {");
                builder.AppendFormat("'会员帐号': '{0}',", str4);
                builder.AppendFormat("'会员订单': '{0}',", str5);
                builder.AppendFormat("'会员积分': '{0}',", currentMember.Points.ToString());
                builder.AppendFormat("'最近购买': '{0}',", str6);
                builder.AppendFormat("'店铺名称': '{0}',", str7);
                builder.AppendFormat("'销售额': '{0}',", str8);
                builder.AppendFormat("'佣金信息': '{0}',", str9);
                builder.AppendFormat("'分店数量': '{0}'", str10);
                builder.Append("}");
                builder.Append("});");
                builder.Append("}");
                builder.Append("}, 500);");
                builder.Append("</script>");
            }
            context.Response.Write(builder.ToString() + " ");
        }
Exemplo n.º 16
0
        protected VMemberTemplatedWebControl()
        {
            if (((MemberProcessor.GetCurrentMember() == null) || (this.Page.Session["userid"] == null)) || (this.Page.Session["userid"].ToString() != MemberProcessor.GetCurrentMember().UserId.ToString()))
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                if (masterSettings.IsValidationService)
                {
                    string msg = this.Page.Request.QueryString["code"];
                    //Utils.LogWriter.SaveLog("msg code:" + msg);

                    if (!string.IsNullOrEmpty(msg))
                    {
                        string responseResult = this.GetResponseResult("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + masterSettings.WeixinAppId + "&secret=" + masterSettings.WeixinAppSecret + "&code=" + msg + "&grant_type=authorization_code");
                        //Utils.LogWriter.SaveLog("code responseResult:" + responseResult);


                        if (responseResult.Contains("access_token"))
                        {
                            //Utils.LogWriter.SaveLog("msg access_token:" + responseResult);
                            JObject obj2 = JsonConvert.DeserializeObject(responseResult) as JObject;
                            string  str3 = this.GetResponseResult("https://api.weixin.qq.com/sns/userinfo?access_token=" + obj2["access_token"].ToString() + "&openid=" + obj2["openid"].ToString() + "&lang=zh_CN");

                            if (str3.Contains("nickname"))
                            {
                                JObject    obj3       = JsonConvert.DeserializeObject(str3) as JObject;
                                string     generateId = Globals.GetGenerateId();
                                MemberInfo member     = new MemberInfo
                                {
                                    GradeId        = MemberProcessor.GetDefaultMemberGrade(),
                                    UserName       = Globals.UrlDecode(obj3["nickname"].ToString()),
                                    OpenId         = obj3["openid"].ToString(),
                                    CreateDate     = DateTime.Now,
                                    SessionId      = generateId,
                                    SessionEndTime = DateTime.Now.AddYears(10)
                                };
                                if ((MemberProcessor.GetCurrentMember() != null) && string.IsNullOrEmpty(MemberProcessor.GetCurrentMember().OpenId))
                                {
                                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                                    currentMember.OpenId = member.OpenId;
                                    MemberProcessor.UpdateMember(currentMember);
                                }

                                //跳转前记录当前ID
                                //Utils.LogWriter.SaveLog("微信登录关联推荐人1:");
                                HttpCookie cookie3 = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                                if ((cookie3 != null) && !string.IsNullOrEmpty(cookie3.Value))
                                {
                                    try
                                    {
                                        //Utils.LogWriter.SaveLog("微信登录关联推荐人2:" + cookie3.Value);
                                        if (int.Parse(cookie3.Value) > 0)
                                        {
                                            member.ReferralUserId = int.Parse(cookie3.Value);
                                        }
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }

                                MemberProcessor.CreateMember(member);
                                MemberProcessor.GetusernameMember(Globals.UrlDecode(obj3["nickname"].ToString()));
                                MemberInfo info3  = MemberProcessor.GetMember(generateId);
                                HttpCookie cookie = new HttpCookie("Vshop-Member")
                                {
                                    Value   = info3.UserId.ToString(),
                                    Expires = DateTime.Now.AddYears(10)
                                };
                                HttpContext.Current.Response.Cookies.Add(cookie);
                                this.Page.Session["userid"] = info3.UserId.ToString();
                                DistributorsInfo userIdDistributors = new DistributorsInfo();
                                userIdDistributors = DistributorsBrower.GetUserIdDistributors(info3.UserId);
                                if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                                {
                                    HttpCookie cookie2 = new HttpCookie("Vshop-ReferralId")
                                    {
                                        Value   = userIdDistributors.UserId.ToString(),
                                        Expires = DateTime.Now.AddYears(1)
                                    };
                                    HttpContext.Current.Response.Cookies.Add(cookie2);
                                }
                                this.Page.Response.Redirect(HttpContext.Current.Request.Url.ToString());
                            }
                            else
                            {
                                this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/Default.aspx");
                            }
                        }
                        else
                        {
                            this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/Default.aspx");
                        }
                    }
                    else if (!string.IsNullOrEmpty(this.Page.Request.QueryString["state"]))
                    {
                        this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/Default.aspx");
                    }
                    else
                    {
                        string str5 = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + masterSettings.WeixinAppId + "&redirect_uri=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect";
                        //Utils.LogWriter.SaveLog("授权跳转:" + str5);
                        this.Page.Response.Redirect(str5);
                    }
                }
                else if (this.Page.Request.Cookies["Vshop-Member"] == null)
                {
                    this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/UserLogin.aspx");
                }
            }
        }
Exemplo n.º 17
0
        protected override void AttachChildControls()
        {
            this.rptCategories                = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.rptProducts                  = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptProducts.ItemDataBound   += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptProducts_ItemDataBound);
            this.rptCategories.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
            this.img            = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("imgDefaultBg");
            this.pager          = (Pager)this.FindControl("pager");
            this.litstorename   = (System.Web.UI.WebControls.Literal) this.FindControl("litstorename");
            this.litdescription = (System.Web.UI.WebControls.Literal) this.FindControl("litdescription");
            this.litattention   = (System.Web.UI.WebControls.Literal) this.FindControl("litattention");
            this.imglogo        = (HiImage)this.FindControl("imglogo");
            this.litImgae       = (System.Web.UI.WebControls.Literal) this.FindControl("litImgae");
            this.litItemParams  = (System.Web.UI.WebControls.Literal) this.FindControl("litItemParams");
            if (string.IsNullOrEmpty(this.Page.Request.QueryString["ReferralId"]))
            {
                System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value))
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + httpCookie.Value);
                }
            }
            else
            {
                //如果有传店铺ID且传入值存在,并且当前用户没有访问店铺
                System.Web.HttpCookie httpCookie = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie == null || string.IsNullOrEmpty(httpCookie.Value) || httpCookie.Value == "0")
                {
                    //用户Cookie过期,用户有推荐人时,设置访问店铺为推荐人
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (currentMember != null && currentMember.ReferralUserId > 0)
                    {
                        //当前用户无推荐人,但是有访问店铺地址时
                        if (currentMember.ReferralUserId == 0)
                        {
                            int urlReferralId = 0;
                            int.TryParse(this.Page.Request.QueryString["ReferralId"], out urlReferralId);
                            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(urlReferralId);
                            if (userIdDistributors != null && userIdDistributors.UserId > 0)
                            {
                                currentMember.ReferralUserId = userIdDistributors.UserId;
                                MemberProcessor.UpdateMember(currentMember);
                            }
                        }

                        //设置访问店铺为推荐人
                        if (currentMember.ReferralUserId > 0)
                        {
                            string name = "Vshop-ReferralId";
                            System.Web.HttpContext.Current.Response.Cookies[name].Expires = System.DateTime.Now.AddDays(-1.0);
                            System.Web.HttpCookie httpCookie2 = new System.Web.HttpCookie(name);
                            httpCookie2.Value   = currentMember.ReferralUserId.ToString();
                            httpCookie2.Expires = System.DateTime.Now.AddYears(10);
                            System.Web.HttpContext.Current.Response.Cookies.Add(httpCookie2);
                        }
                    }
                }
            }
            if (this.rptCategories.Visible)
            {
                DataTable brandCategories = CategoryBrowser.GetBrandCategories();
                this.itemcount = brandCategories.Rows.Count;
                if (brandCategories.Rows.Count > 0)
                {
                    this.rptCategories.DataSource = brandCategories;
                    this.rptCategories.DataBind();
                }
            }
            this.Page.Session["stylestatus"] = "3";
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);

            PageTitle.AddSiteNameTitle(masterSettings.SiteName);
            this.litstorename.Text   = masterSettings.SiteName;
            this.litdescription.Text = masterSettings.ShopIntroduction;
            if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
            {
                this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[]
                {
                    '|'
                })[0];
            }
            if (this.referralId <= 0)
            {
                System.Web.HttpCookie httpCookie2 = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie2 != null && !string.IsNullOrEmpty(httpCookie2.Value))
                {
                    this.referralId = int.Parse(httpCookie2.Value);
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            else
            {
                System.Web.HttpCookie httpCookie2 = System.Web.HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
                if (httpCookie2 != null && !string.IsNullOrEmpty(httpCookie2.Value) && this.referralId.ToString() != httpCookie2.Value)
                {
                    this.Page.Response.Redirect("Default.aspx?ReferralId=" + this.referralId.ToString(), true);
                }
            }
            System.Collections.Generic.IList <BannerInfo> list = new System.Collections.Generic.List <BannerInfo>();
            list = VshopBrowser.GetAllBanners();
            foreach (BannerInfo current in list)
            {
                TplCfgInfo tplCfgInfo = new NavigateInfo();
                tplCfgInfo.LocationType = current.LocationType;
                tplCfgInfo.Url          = current.Url;
                string text = "javascript:";
                if (!string.IsNullOrEmpty(current.Url))
                {
                    text = tplCfgInfo.LoctionUrl;
                }
                System.Web.UI.WebControls.Literal expr_3E2 = this.litImgae;
                string text2 = expr_3E2.Text;
                expr_3E2.Text = string.Concat(new string[]
                {
                    text2,
                    "<a  id=\"ahref\" href='",
                    text,
                    "'><img src=\"",
                    current.ImageUrl,
                    "\" title=\"",
                    current.ShortDesc,
                    "\" alt=\"",
                    current.ShortDesc,
                    "\" /></a>"
                });
            }
            if (list.Count == 0)
            {
                this.litImgae.Text = "<a id=\"ahref\"  href='javascript:'><img src=\"/Utility/pics/default.jpg\" title=\"\"  /></a>";
            }
            DistributorsInfo distributorsInfo = new DistributorsInfo();

            distributorsInfo = DistributorsBrower.GetUserIdDistributors(this.referralId);
            if (distributorsInfo != null && distributorsInfo.UserId > 0)
            {
                PageTitle.AddSiteNameTitle(distributorsInfo.StoreName);
                this.litdescription.Text = distributorsInfo.StoreDescription;
                this.litstorename.Text   = distributorsInfo.StoreName;
                if (!string.IsNullOrEmpty(distributorsInfo.Logo))
                {
                    this.imglogo.ImageUrl = distributorsInfo.Logo;
                }
                else if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
                {
                    this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[]
                    {
                        '|'
                    })[0];
                }
                if (!string.IsNullOrEmpty(distributorsInfo.BackImage))
                {
                    this.litImgae.Text = "";
                    string[] array = distributorsInfo.BackImage.Split(new char[]
                    {
                        '|'
                    });
                    for (int i = 0; i < array.Length; i++)
                    {
                        string text3 = array[i];
                        if (!string.IsNullOrEmpty(text3))
                        {
                            System.Web.UI.WebControls.Literal expr_5D7 = this.litImgae;
                            expr_5D7.Text = expr_5D7.Text + "<a ><img src=\"" + text3 + "\" title=\"\"  /></a>";
                        }
                    }
                }
            }
            this.dtpromotion = ProductBrowser.GetAllFull();
            if (this.rptProducts != null)
            {
                ProductQuery productQuery = new ProductQuery();
                productQuery.PageSize  = this.pager.PageSize;
                productQuery.PageIndex = this.pager.PageIndex;
                productQuery.SortBy    = "DisplaySequence";
                productQuery.SortOrder = SortAction.Desc;
                DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), productQuery);
                this.rptProducts.DataSource = homeProduct.Data;
                this.rptProducts.DataBind();
                this.pager.TotalRecords = homeProduct.TotalRecords;
                if (this.pager.TotalRecords <= this.pager.PageSize)
                {
                    this.pager.Visible = false;
                }
            }
            if (this.img != null)
            {
                this.img.Src = new VTemplateHelper().GetDefaultBg();
            }
            if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
            {
                this.litattention.Text = masterSettings.GuidePageSet;
            }
            string userAgent = this.Page.Request.UserAgent;

            if (userAgent.ToLower().Contains("alipay") && !string.IsNullOrEmpty(masterSettings.AliPayFuwuGuidePageSet))
            {
                if (!string.IsNullOrEmpty(masterSettings.GuidePageSet))
                {
                    this.litattention.Text = masterSettings.AliPayFuwuGuidePageSet;
                }
            }
            string text4 = "";

            if (!string.IsNullOrEmpty(masterSettings.ShopHomePic))
            {
                text4 = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.ShopHomePic;
            }
            string text5 = "";
            string text6 = (distributorsInfo == null) ? masterSettings.SiteName : distributorsInfo.StoreName;

            if (!string.IsNullOrEmpty(masterSettings.DistributorBackgroundPic))
            {
                text5 = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + masterSettings.DistributorBackgroundPic.Split(new char[]
                {
                    '|'
                })[0];
            }
            this.litItemParams.Text = string.Concat(new string[]
            {
                text4,
                "|",
                masterSettings.ShopHomeName,
                "|",
                masterSettings.ShopHomeDescription,
                "$"
            });
            this.litItemParams.Text = string.Concat(new object[]
            {
                this.litItemParams.Text,
                text5,
                "|好店推荐之",
                text6,
                "商城|一个购物赚钱的好去处|",
                System.Web.HttpContext.Current.Request.Url
            });
        }
Exemplo n.º 18
0
        protected void rptList_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if (e.CommandName == "CONFIRM_PAY" && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num      = 0;
                    int num2     = 0;
                    int arg_49_0 = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo debitNoteInfo = new DebitNoteInfo();
                        debitNoteInfo.NoteId   = Globals.GetGenerateId();
                        debitNoteInfo.OrderId  = e.CommandArgument.ToString();
                        debitNoteInfo.Operator = ManagerHelper.GetCurrentManager().UserName;
                        debitNoteInfo.Remark   = "后台" + debitNoteInfo.Operator + "收款成功";
                        OrderHelper.SaveDebitNote(debitNoteInfo);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int arg_BE_0 = num + num2;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                        return;
                    }
                    this.ShowMsg("确认订单收款失败", false);
                    return;
                }
                else if (e.CommandName == "FINISH_TRADE" && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    System.Collections.Generic.Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo lineItemInfo = new LineItemInfo();
                    foreach (System.Collections.Generic.KeyValuePair <string, LineItemInfo> current in lineItems)
                    {
                        lineItemInfo = current.Value;
                        if (lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForRefund || lineItemInfo.OrderItemsStatus == OrderStatus.ApplyForReturns)
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo);
                            foreach (LineItemInfo current2 in orderInfo.LineItems.Values)
                            {
                                if (current2.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, current2.SkuId, 5, current2.ID);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                            return;
                        }
                        this.ShowMsg("完成订单失败", false);
                        return;
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemplo n.º 19
0
        protected override void AttachChildControls()
        {
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(Globals.GetCurrentMemberUserId(false));

            if (userIdDistributors.ReferralStatus != 0)
            {
                HttpContext.Current.Response.Redirect("MemberCenter.aspx");
            }
            else
            {
                this.lbltotalcommission   = (FormatedMoneyLabel)this.FindControl("lbltotalcommission");
                this.lblsurpluscommission = (FormatedMoneyLabel)this.FindControl("lblsurpluscommission");
                this.lblAlreadycommission = (FormatedMoneyLabel)this.FindControl("lblAlreadycommission");
                this.lblcommission        = (FormatedMoneyLabel)this.FindControl("lblcommission");
                this.lbltwocommission     = (FormatedMoneyLabel)this.FindControl("lbltwocommission");
                this.lblthreecommission   = (FormatedMoneyLabel)this.FindControl("lblthreecommission");
                this.lblsaleprice         = (FormatedMoneyLabel)this.FindControl("lblsaleprice");
                this.lbltwosaleprice      = (FormatedMoneyLabel)this.FindControl("lbltwosaleprice");
                this.lblthreesaleprice    = (FormatedMoneyLabel)this.FindControl("lblthreesaleprice");
                this.paneltwo             = (Panel)this.FindControl("paneltwo");
                this.panelthree           = (Panel)this.FindControl("panelthree");
                this.litMsg    = (Literal)this.FindControl("litMsg");
                this.hyrequest = (HyperLink)this.FindControl("hyrequest");
                PageTitle.AddSiteNameTitle("我的佣金");
                DataTable currentDistributorsCommosion = DistributorsBrower.GetCurrentDistributorsCommosion(userIdDistributors.UserId);
                if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                {
                    this.lblsurpluscommission.Money = userIdDistributors.ReferralBlance;
                    this.lblAlreadycommission.Money = userIdDistributors.ReferralRequestBalance;
                    if (userIdDistributors.DistributorGradeId == DistributorGrade.TowDistributor)
                    {
                        this.paneltwo.Visible = false;
                    }
                    else if (userIdDistributors.DistributorGradeId == DistributorGrade.ThreeDistributor)
                    {
                        this.paneltwo.Visible   = false;
                        this.panelthree.Visible = false;
                    }
                    if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                    {
                        this.lblcommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                        this.lblsaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                    }
                    if (userIdDistributors.DistributorGradeId == DistributorGrade.OneDistributor)
                    {
                        currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.TowDistributor);
                        if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                        {
                            this.lbltwocommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                            this.lbltwosaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                        }
                        currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.ThreeDistributor);
                        if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                        {
                            this.lblthreecommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                            this.lblthreesaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                        }
                    }
                    if (userIdDistributors.DistributorGradeId == DistributorGrade.TowDistributor)
                    {
                        currentDistributorsCommosion = DistributorsBrower.GetDistributorsCommosion(userIdDistributors.UserId, DistributorGrade.ThreeDistributor);
                        if ((currentDistributorsCommosion != null) && (currentDistributorsCommosion.Rows.Count > 0))
                        {
                            this.lblthreecommission.Money = currentDistributorsCommosion.Rows[0]["CommTotal"];
                            this.lblthreesaleprice.Money  = currentDistributorsCommosion.Rows[0]["OrderTotal"];
                        }
                    }
                    this.lbltotalcommission.Money = userIdDistributors.ReferralBlance + userIdDistributors.ReferralRequestBalance;
                    if (DistributorsBrower.IsExitsCommionsRequest())
                    {
                        this.hyrequest.Text    = "<i class='iconfont color2 icon-iconadvance'></i>您的申请正在审核当中……";
                        this.hyrequest.Enabled = false;
                    }
                    MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                    if (string.IsNullOrEmpty(currentMember.RealName) || string.IsNullOrEmpty(currentMember.CellPhone))
                    {
                        this.hyrequest.NavigateUrl = "UserInfo.aspx?edit=true&&returnUrl=" + Globals.UrlEncode(Globals.HostPath(HttpContext.Current.Request.Url) + "/Vshop/RequestCommissions.aspx");
                    }
                }
            }
        }
Exemplo n.º 20
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("下级分销商");
            this.litMysubMember = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubMember");
            this.litMysubFirst  = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubFirst");
            this.litMysubSecond = (System.Web.UI.WebControls.Literal) this.FindControl("litMysubSecond");
            int currentMemberUserId             = Globals.GetCurrentMemberUserId(false);
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMemberUserId);

            this.litUserId      = (System.Web.UI.WebControls.Literal) this.FindControl("litUserId");
            this.litUserId.Text = userIdDistributors.UserId.ToString();
            DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId);

            if (distributorsSubStoreNum != null || distributorsSubStoreNum.Rows.Count > 0)
            {
                this.litMysubMember.Text = distributorsSubStoreNum.Rows[0]["memberCount"].ToString();
                this.litMysubFirst.Text  = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                this.litMysubSecond.Text = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
            }
            else
            {
                this.litMysubMember.Text = "0";
                this.litMysubFirst.Text  = "0";
                this.litMysubSecond.Text = "0";
            }
            this.rpdistributor = (VshopTemplatedRepeater)this.FindControl("rpdistributor");
            this.hiddTotal     = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddTotal");
            DistributorsQuery distributorsQuery = new DistributorsQuery();

            distributorsQuery.PageIndex = 0;
            distributorsQuery.PageSize  = 10;
            DistributorsInfo currentDistributors = DistributorsBrower.GetCurrentDistributors(Globals.GetCurrentMemberUserId(false), true);

            if (currentDistributors.ReferralStatus != 0)
            {
                System.Web.HttpContext.Current.Response.Redirect("MemberCenter.aspx");
            }
            else
            {
                distributorsQuery.GradeId = 2;
                int gradeId = 0;
                if (int.TryParse(this.Page.Request.QueryString["gradeId"], out gradeId))
                {
                    distributorsQuery.GradeId = gradeId;
                }
                distributorsQuery.ReferralPath = currentDistributors.UserId.ToString();
                distributorsQuery.UserId       = currentDistributors.UserId;
                int    num  = 0;
                string text = this.Page.Request.QueryString["sort"];
                if (string.IsNullOrWhiteSpace(text))
                {
                    text = "CreateTime";
                }
                string text2 = this.Page.Request.QueryString["order"];
                if (string.IsNullOrWhiteSpace(text2))
                {
                    text2 = "desc";
                }
                DataTable downDistributors = DistributorsBrower.GetDownDistributors(distributorsQuery, out num, text, text2);
                this.hiddTotal.Value          = num.ToString();
                this.rpdistributor.DataSource = downDistributors;
                this.rpdistributor.DataBind();
            }
        }
Exemplo n.º 21
0
        public static bool ConfirmPay(OrderInfo order)
        {
            ManagerHelper.CheckPrivilege(Privilege.CofimOrderPay);
            bool flag = false;

            if (order.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
            {
                OrderDao dao = new OrderDao();
                order.OrderStatus   = OrderStatus.BuyerAlreadyPaid;
                order.PayDate       = new DateTime?(DateTime.Now);
                order.PaymentTypeId = 0x63;
                order.PaymentType   = "线下支付";
                ManagerInfo currentManager = ManagerHelper.GetCurrentManager();
                string      str            = string.Empty;
                if (currentManager != null)
                {
                    str = string.Concat(new object[] { currentManager.UserName, "(", currentManager.UserId, ")" });
                }
                order.ManagerRemark = "管理员" + str + "后台收款";
                order.Gateway       = "hishop.plugins.payment.offlinerequest";
                flag = dao.UpdateOrder(order, null);
                string str2 = "";
                if (!flag)
                {
                    return(flag);
                }
                dao.UpdatePayOrderStock(order);
                foreach (LineItemInfo info2 in order.LineItems.Values)
                {
                    ProductDao dao2 = new ProductDao();
                    str2 = str2 + "'" + info2.SkuId + "',";
                    ProductInfo productDetails = dao2.GetProductDetails(info2.ProductId);
                    productDetails.SaleCounts     += info2.Quantity;
                    productDetails.ShowSaleCounts += info2.Quantity;
                    dao2.UpdateProduct(productDetails, null);
                }
                if (!string.IsNullOrEmpty(str2))
                {
                    dao.UpdateItemsStatus(order.OrderId, 2, str2.Substring(0, str2.Length - 1));
                }
                if (!string.IsNullOrEmpty(order.ActivitiesId))
                {
                    new ActivitiesDao().UpdateActivitiesTakeEffect(order.ActivitiesId);
                }
                MemberHelper.SetOrderDate(order.UserId, 1);
                SettingsManager.GetMasterSettings(true);
                MemberInfo member = new MemberDao().GetMember(order.UserId);
                if (VshopBrowser.IsPassAutoToDistributor(member, true))
                {
                    DistributorsBrower.MemberAutoToDistributor(member);
                }
                try
                {
                    OrderInfo info5 = order;
                    if (info5 != null)
                    {
                        Messenger.SendWeiXinMsg_OrderPay(info5);
                    }
                }
                catch (Exception)
                {
                }
                EventLogs.WriteOperationLog(Privilege.CofimOrderPay, string.Format(CultureInfo.InvariantCulture, "确认收款编号为\"{0}\"的订单", new object[] { order.OrderId }));
            }
            return(flag);
        }
Exemplo n.º 22
0
        bool SkipWinxinOpenId(string userName, string openId, string headimgurl, string state)
        {
            WxLogger("      状态信息:** 进入 SkipWinxinOpenId 函数体 **");

            bool flag = false;

            try
            {
                string generateId = Globals.GetGenerateId();

                MemberInfo member = new MemberInfo();

                member.GradeId        = MemberProcessor.GetDefaultMemberGrade();
                member.UserName       = userName;
                member.RealName       = userName;
                member.OpenId         = openId;
                member.CreateDate     = DateTime.Now;
                member.SessionId      = generateId;
                member.SessionEndTime = DateTime.Now.AddYears(10);
                member.Email          = generateId + "@localhost.com";
                member.SessionId      = generateId;
                member.Password       = generateId;
                member.RealName       = string.Empty;
                member.Address        = string.Empty;
                member.UserHead       = headimgurl;//用户头像
                #region 设置推荐人
                if (!string.IsNullOrWhiteSpace(state))
                {
                    int referralUserId = 0;
                    if (int.TryParse(state, out referralUserId))
                    {
                        member.ReferralUserId = referralUserId;
                    }
                }

                //System.IO.File.AppendAllText(HiContext.Current.Context.Request.MapPath("~/ReferralUserId.txt"), "用户名:" + userName + ";ReferralUserId=" + member.ReferralUserId + ";openid=" + openId + Environment.NewLine);

                #endregion

                if (MemberProcessor.CreateMember(member))
                {
                    //MemberProcessor.GetusernameMember(Globals.UrlDecode(userName));
                    //MemberProcessor.GetusernameMember(Globals.UrlDecode(obj3["nickname"].ToString()));
                    //System.IO.File.AppendAllText(Page.Request.MapPath("~/wx.txt"), "***用户创建成功了***" + Environment.NewLine);//获取到openid

                    IList <MemberInfo> memberLst = Hidistro.ControlPanel.Members.MemberHelper.GetMemdersByOpenIds("'" + openId + "'");

                    HttpCookie cookie = new HttpCookie("Vshop-Member");

                    cookie.Value = memberLst[0].UserId.ToString();

                    cookie.Expires = DateTime.Now.AddYears(10);

                    HttpContext.Current.Response.Cookies.Add(cookie);


                    //  this.Page.Session["userid"] = member.UserId.ToString();

                    DistributorsInfo userIdDistributors = new DistributorsInfo();

                    userIdDistributors = DistributorsBrower.GetUserIdDistributors(member.UserId);

                    if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                    {
                        HttpCookie cookie2 = new HttpCookie("Vshop-ReferralId")
                        {
                            Value   = userIdDistributors.UserId.ToString(),
                            Expires = DateTime.Now.AddYears(1)
                        };
                        HttpContext.Current.Response.Cookies.Add(cookie2);
                    }

                    flag = true;
                }
            }
            catch (Exception ex)
            {
                WxLogger("      异常信息:** SkipWinxinOpenId()函数调用引发的异常:" + ex.Message + "**");
            }


            return(flag);
        }
Exemplo n.º 23
0
        protected override void Render(HtmlTextWriter writer)
        {
            base.Text = "";
            SiteSettings  masterSettings = SettingsManager.GetMasterSettings(false);
            StringBuilder stringBuilder  = new StringBuilder();
            bool          flag           = false;
            string        text           = string.Empty;
            string        text2          = string.Empty;

            if (masterSettings.EnableSaleService)
            {
                if (!string.IsNullOrEmpty(masterSettings.MeiQiaEntId))
                {
                    flag = true;
                    string     text3      = "name: '游客'";
                    MemberInfo memberInfo = MemberProcessor.GetCurrentMember();
                    if (memberInfo == null)
                    {
                        string getCurrentWXOpenId = Globals.GetCurrentWXOpenId;
                        if (!string.IsNullOrEmpty(getCurrentWXOpenId))
                        {
                            memberInfo = MemberProcessor.GetOpenIdMember(getCurrentWXOpenId, "wx");
                        }
                    }
                    if (memberInfo != null)
                    {
                        StringBuilder stringBuilder2 = new StringBuilder();
                        stringBuilder2.Append("name: '" + (string.IsNullOrEmpty(memberInfo.RealName) ? memberInfo.UserName : memberInfo.RealName) + "'");
                        if (!string.IsNullOrEmpty(memberInfo.Email))
                        {
                            stringBuilder2.Append(",email: '" + memberInfo.Email + "'");
                        }
                        if (!string.IsNullOrEmpty(memberInfo.Address))
                        {
                            stringBuilder2.Append(",address: '" + memberInfo.Address.Replace("'", "’") + "'");
                        }
                        if (!string.IsNullOrEmpty(memberInfo.CellPhone))
                        {
                            stringBuilder2.Append(",tel: '" + memberInfo.CellPhone + "'");
                        }
                        if (!string.IsNullOrEmpty(memberInfo.QQ))
                        {
                            stringBuilder2.Append(",qq: '" + memberInfo.QQ + "'");
                        }
                        MemberGradeInfo memberGrade = MemberProcessor.GetMemberGrade(memberInfo.GradeId);
                        stringBuilder2.Append(string.Concat(new string[]
                        {
                            ",会员帐号: '",
                            memberInfo.UserBindName,
                            "【",
                            (memberGrade != null) ? memberGrade.Name : "普通会员",
                            "】'"
                        }));
                        stringBuilder2.Append(",注册日期: '" + memberInfo.CreateDate.ToString("yyyy-MM-dd") + "'");
                        stringBuilder2.Append(",订单量: '" + memberInfo.OrderNumber + "'");
                        stringBuilder2.Append(",积分: '" + memberInfo.Points + "'");
                        if (memberInfo.LastOrderDate.HasValue)
                        {
                            stringBuilder2.Append(",最近下单: '" + memberInfo.LastOrderDate.Value.ToString("yyyy-MM-dd") + "'");
                        }
                        DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(memberInfo.UserId);
                        if (userIdDistributors != null)
                        {
                            DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(userIdDistributors.DistriGradeId);
                            string           text4           = "0.00";
                            DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(userIdDistributors.UserId);
                            if (distributorInfo != null)
                            {
                                text4 = distributorInfo.ReferralBlance.ToString("F2");
                            }
                            string    str  = "0";
                            string    str2 = "0";
                            DataTable distributorsSubStoreNum = VShopHelper.GetDistributorsSubStoreNum(userIdDistributors.UserId);
                            if (distributorsSubStoreNum != null || distributorsSubStoreNum.Rows.Count > 0)
                            {
                                str  = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                                str2 = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
                            }
                            stringBuilder2.Append(string.Concat(new string[]
                            {
                                ",店铺名称: '",
                                userIdDistributors.StoreName,
                                "【",
                                distributorGradeInfo.Name,
                                "】'"
                            }));
                            stringBuilder2.Append(",销售额: '¥" + userIdDistributors.OrdersTotal.ToString("F2") + "'");
                            stringBuilder2.Append(string.Concat(new string[]
                            {
                                ",佣金信息: '¥",
                                text4,
                                "(待提现¥",
                                userIdDistributors.ReferralBlance.ToString("F2"),
                                ",已提现¥",
                                userIdDistributors.ReferralRequestBalance.ToString("F2"),
                                ")'"
                            }));
                            string str3 = "一级分店数" + str + ",二级分店数" + str2;
                            stringBuilder2.Append(",comment: '" + str3 + "'");
                        }
                        text3 = stringBuilder2.ToString();
                    }
                    text = string.Concat(new string[]
                    {
                        "<script>function MeiQiaInit() {$('#meiqia_serviceico').show();}(function(m, ei, q, i, a, j, s) {m[a] = m[a] || function() {(m[a].a = m[a].a || []).push(arguments)};j = ei.createElement(q),s = ei.getElementsByTagName(q)[0];j.async = true;j.charset = 'UTF-8';j.src = i + '?v=' + new Date().getUTCDate();s.parentNode.insertBefore(j, s);})(window, document, 'script', '//static.meiqia.com/dist/meiqia.js', '_MEIQIA');_MEIQIA('entId', ",
                        masterSettings.MeiQiaEntId,
                        ");_MEIQIA('withoutBtn');_MEIQIA('metadata', {",
                        text3,
                        "});</script><script>_MEIQIA('allSet', MeiQiaInit);</script>"
                    });
                    text2 = "<!-- 在线客服 -->\n<div class=\"customer-service\" id=\"meiqia_serviceico\" style=\"position:fixed;bottom:100px;right:10%;width:38px;height:38px;background:url(/Utility/pics/service.png?v1026) no-repeat;background-size:100%;cursor:pointer;display:none\" onclick=\"javascript:_MEIQIA._SHOWPANEL();\"></div>";
                }
                else
                {
                    CustomerServiceSettings masterSettings2 = CustomerServiceManager.GetMasterSettings(false);
                    if (!string.IsNullOrEmpty(masterSettings2.unitid) && !string.IsNullOrEmpty(masterSettings2.unit) && !string.IsNullOrEmpty(masterSettings2.password))
                    {
                        text = string.Format("<script src='//meiqia.com/js/mechat.js?unitid={0}&btn=hide' charset='UTF-8' async='async'></script>", masterSettings2.unitid);
                        flag = true;
                        stringBuilder.Append("<script type=\"text/javascript\">");
                        stringBuilder.Append("function mechatFuc()");
                        stringBuilder.Append("{");
                        stringBuilder.Append("$.get(\"/Api/Hi_Ajax_OnlineServiceConfig.ashx\", function (data) {");
                        stringBuilder.Append("if (data != \"\") {");
                        stringBuilder.Append("$(data).appendTo('head');");
                        stringBuilder.Append("}");
                        stringBuilder.Append("mechatClick();");
                        stringBuilder.Append("});");
                        stringBuilder.Append("}");
                        stringBuilder.Append("</script>");
                        text2 = "<!-- 在线客服 -->\n<div class=\"customer-service\" style=\"position:fixed;bottom:100px;right:10%;width:38px;height:38px;background:url(/Utility/pics/service.png?v1026) no-repeat;background-size:100%;cursor:pointer;\" onclick=\"javascript:mechatFuc();\"></div>";
                    }
                }
                if (flag)
                {
                    base.Text = string.Concat(new string[]
                    {
                        text,
                        "\n",
                        stringBuilder.ToString(),
                        "\n",
                        text2
                    });
                }
            }
            base.Render(writer);
        }
Exemplo n.º 24
0
        protected override void OnInit(System.EventArgs e)
        {
            string a = System.Web.HttpContext.Current.Request["action"];

            if (a == "ReCreadt")
            {
                System.Web.HttpContext.Current.Response.ContentType = "application/json";
                string text = System.Web.HttpContext.Current.Request["imageUrl"];
                string s    = "";
                if (string.IsNullOrEmpty(text))
                {
                    s = "{\"success\":\"false\",\"message\":\"图片地址为空\"}";
                }
                try
                {
                    MemberInfo       currentMember      = MemberProcessor.GetCurrentMember();
                    DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);
                    string           userHeadPath       = text;
                    string           storeLogoPath      = text;
                    ScanInfos        scanInfosByUserId  = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                    if (scanInfosByUserId == null)
                    {
                        ScanHelp.CreatNewScan(currentMember.UserId, "WX", 0);
                        scanInfosByUserId = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                    }
                    string codeUrl;
                    if (scanInfosByUserId == null)
                    {
                        codeUrl = Globals.HostPath(System.Web.HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                    }
                    else
                    {
                        codeUrl = BarCodeApi.GetQRImageUrlByTicket(scanInfosByUserId.CodeUrl);
                    }
                    string setJson   = System.IO.File.ReadAllText(System.Web.HttpRuntime.AppDomainAppPath.ToString() + "Storage/Utility/StoreCardSet.js");
                    string storeName = userIdDistributors.StoreName;
                    if (!this.siteSettings.IsShowDistributorSelfStoreName)
                    {
                        storeName = this.siteSettings.SiteName;
                    }
                    StoreCardCreater storeCardCreater = new StoreCardCreater(setJson, userHeadPath, storeLogoPath, codeUrl, currentMember.UserName, storeName, currentMember.UserId, currentMember.UserId);
                    string           text2            = "";
                    if (storeCardCreater.ReadJson() && storeCardCreater.CreadCard(out text2))
                    {
                        s = "{\"success\":\"true\",\"message\":\"生成成功\"}";
                        DistributorsBrower.UpdateStoreCard(currentMember.UserId, text2);
                    }
                    else
                    {
                        s = "{\"success\":\"false\",\"message\":\"" + text2 + "\"}";
                    }
                }
                catch (System.Exception ex)
                {
                    s = "{\"success\":\"false\",\"message\":\"" + ex.Message + "\"}";
                }
                System.Web.HttpContext.Current.Response.Write(s);
                System.Web.HttpContext.Current.Response.End();
            }
            if (this.SkinName == null)
            {
                this.SkinName = "skin-VStoreCard.html";
            }
            base.OnInit(e);
        }
Exemplo n.º 25
0
        protected override void Render(HtmlTextWriter writer)
        {
            string       text           = string.Empty;
            string       text2          = string.Empty;
            string       text3          = string.Empty;
            HttpCookie   httpCookie     = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (httpCookie != null && !string.IsNullOrEmpty(httpCookie.Value) && masterSettings.IsShowDistributorSelfStoreName)
            {
                string           value           = httpCookie.Value;
                DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(Globals.ToNum(value));
                if (distributorInfo != null && distributorInfo.ReferralStatus != 9)
                {
                    text  = distributorInfo.StoreName;
                    text2 = distributorInfo.StoreDescription;
                    text3 = distributorInfo.Logo;
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text  = masterSettings.SiteName;
                text2 = masterSettings.ShopIntroduction;
                text3 = masterSettings.DistributorLogoPic;
            }
            string text4 = this.Context.Items["Hishop.Title.Value"] as string;
            string text5 = this.Context.Items["Hishop.Desc.Value"] as string;

            if (string.IsNullOrEmpty(text5))
            {
                text5 = text2;
            }
            if (string.IsNullOrEmpty(text4))
            {
                writer.WriteLine("<title>{0}</title>", text);
            }
            else
            {
                writer.WriteLine("<title>{0}</title>", text4 + " - " + text);
                writer.WriteLine("<meta name=\"keywords\" content=\"{0}\" />", text4);
            }
            writer.WriteLine("<meta name=\"description\" content=\"{0}\" />", text5);
            string telReg = masterSettings.TelReg;
            string text6  = string.Concat(new string[]
            {
                " var followWtSiteName='",
                text,
                "'; var followWtImgUrl='",
                text3,
                "';"
            });
            string userAgent = this.Page.Request.UserAgent;

            if (userAgent.ToLower().Contains("micromessenger") || Globals.RequestQueryNum("istest") == 1)
            {
                text6 += " var isfollowWt='true';";
                Uri    url   = HttpContext.Current.Request.Url;
                string text7 = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString()));
                if (!text3.StartsWith("http"))
                {
                    text3 = text7 + text3;
                }
                string text8      = this.ConvertDateTimeInt(DateTime.Now).ToString();
                string empty      = string.Empty;
                string text9      = "QoN4FvGbxdTi7mnffL";
                string cacheToken = this.GetCacheToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                string signature  = this.GetSignature(cacheToken, text8, text9, out empty);
                writer.WriteLine(string.Concat(new object[]
                {
                    "<script src=\"http://res.wx.qq.com/open/js/jweixin-1.0.0.js\"></script><script>",
                    text6,
                    "var telReg=",
                    telReg,
                    ";wx.config({ debug: false,appId: '",
                    masterSettings.WeixinAppId,
                    "',timestamp: '",
                    text8,
                    "', nonceStr: '",
                    text9,
                    "',signature: '",
                    signature,
                    "',jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','chooseWXPay']});var _GetTokenError='",
                    this._GetTokenError,
                    "'; var wxinshare_title='",
                    HttpContext.Current.Server.HtmlEncode(text.Replace("\n", " ").Replace("\r", "")),
                    "';var wxinshare_desc='",
                    HttpContext.Current.Server.HtmlEncode(text2.Replace("\n", " ").Replace("\r", "")),
                    "';var wxinshare_link='",
                    text7,
                    "/default.aspx?ReferralId=",
                    Globals.GetCurrentDistributorId(),
                    "';var fxShopName='",
                    HttpContext.Current.Server.HtmlEncode(text.Replace("\n", " ").Replace("\r", "")),
                    "';var wxinshare_imgurl='",
                    text3,
                    "'</script><script src=\"/templates/common/script/WeiXinShare.js?201603\"></script>"
                }));
                return;
            }
            text6 += " var isfollowWt='false';";
            writer.WriteLine(string.Concat(new string[]
            {
                "<script>",
                text6,
                "var telReg=",
                telReg,
                ";var _GetTokenError=''; var wxinshare_title='';var wxinshare_desc='';var wxinshare_link='';var wxinshare_imgurl='';;var fxShopName=''</script>"
            }));
        }
Exemplo n.º 26
0
        private HtmlInputHidden hidUserStoreName; //隐藏域,当前匹配的门店名


        protected override void AttachChildControls()
        {
            this.litOrderAlert     = (Literal)this.FindControl("litOrderAlert");//公告栏
            this.litStoreList      = (Literal)this.FindControl("litStoreList");
            this.litDefaultAddress = (Literal)this.FindControl("litDefaultAddress");
            this.hidMinPrice       = (HtmlInputHidden)this.FindControl("hidMinPrice");
            this.hidFromUserId     = (HtmlInputHidden)this.FindControl("hidFromUserId");
            this.hidUserDistance   = (HtmlInputHidden)this.FindControl("hidUserDistance");
            this.hidUserStoreId    = (HtmlInputHidden)this.FindControl("hidUserStoreId");
            this.hidUserStoreName  = (HtmlInputHidden)this.FindControl("hidUserStoreName");

            SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
            MemberInfo   currentMember  = MemberProcessor.GetCurrentMember();

            this.litOrderAlert.Text = masterSettings.orderAlert;

            this.hidMinPrice.Value = masterSettings.roadPriceInfo;

            //获取我的推广人id
            try
            {
                string VisitFromMemberId = HiCache.Get(string.Format("DataCache-FromMemberId-{0}", currentMember.OpenId)) as string;
                if (!string.IsNullOrEmpty(VisitFromMemberId))
                {
                    this.hidFromUserId.Value = VisitFromMemberId;
                }
            }
            catch (Exception ex) {
                //WriteLog(ex.Message);
            }

            //获取用户默认配送地址,如果没有填写,则跳转到新增地址页面
            ShippingAddressInfo shippingAddress = MemberProcessor.GetDefaultShippingAddress();

            if (shippingAddress == null)
            {
                this.Page.Response.Redirect("AddShippingAddressPro.aspx?returnUrl=picOrder.aspx"); return;
            }

            this.litDefaultAddress.Text = MemberProcessor.GetDefaultShippingAddress().Address;


            //如果填写了地址,获取所有门店坐标,并且匹配用户的默认配送地址,获取最近门店,并计算出相应的配送费和配送距离等
            DataTable          dtPoiInfo   = WxPoiHelper.GetPoiListInfo();
            List <PoiInfoList> poiInfoList = new List <PoiInfoList>();

            if (dtPoiInfo.Rows.Count == 0)//如果没有同步,则调用微信接口重新获取
            {
                //获取access_token
                string token = Access_token.GetAccess_token(Access_token.Access_Type.weixin, true);
                //门店列表接口提交url
                string url = "https://api.weixin.qq.com/cgi-bin/poi/getpoilist?access_token=" + token;
                //提交json串,门店列表索引开始:begin,门店列表返回数量限制:limit
                string json = @"{""begin"":0,""limit"":10}";
                //调用post提交方法
                string strPOIList = new Hishop.Weixin.MP.Util.WebUtils().DoPost(url, json);
                //将传回的json字符串转换为json对象
                JObject obj3 = JsonConvert.DeserializeObject(strPOIList) as JObject;
                //将json对象转换为实体类对象
                poiInfoList = JsonHelper.JsonToList <PoiInfoList>(obj3["business_list"].ToString());

                //同步微信门店信息
                if (WxPoiHelper.SyncPoiListInfo(poiInfoList))
                {
                    dtPoiInfo = WxPoiHelper.GetPoiListInfo();
                }
            }


            //拼装门店列表
            string storelisthtml = "<div class='storeNow'><p><span class='switch' onclick='chooseStore()'>选择门店</span></p></div>";

            storelisthtml += "<ul class='chooseStore'>";
            foreach (DataRow row in dtPoiInfo.Rows)
            {
                DataTable dtSender = WxPoiHelper.GetSenderByPoiId(row["poi_id"].ToString());
                storelisthtml += string.Format("<li poi_id='{0}'>{1}</li>", row["poi_id"].ToString(), DistributorsBrower.GetDistributorInfo(int.Parse(dtSender.Rows[0]["clientuserid"].ToString())).StoreName);
            }
            storelisthtml += "</ul>";

            litStoreList.Text = storelisthtml;


            //如果手动选择了门店,那么门店列表除了该门店的一律删除
            DataTable dtt = new DataTable();

            if (!string.IsNullOrEmpty(this.Page.Request.QueryString["poi_id"]))
            {
                dtt = dtPoiInfo.Clone();
                DataRow[] dr = dtPoiInfo.Select("poi_id = '" + this.Page.Request.QueryString["poi_id"] + "'   ");
                for (int i = 0; i < dr.Length; i++)
                {
                    dtt.ImportRow((DataRow)dr[i]);
                }
                dtPoiInfo = dtt;
            }



            //获取所有门店的坐标
            string offset = string.Empty;

            foreach (DataRow row in dtPoiInfo.Rows)
            {
                offset += row["latitude"] + "," + row["longitude"] + ";";//增加精度纬度
            }
            offset = offset.TrimEnd(';');
            //将门店坐标放入数组
            string[] offsetList = offset.Split(';');
            //循环判断获取距离,得到配送范围内的门店poi_id
            List <string> poi_id            = new List <string>();
            List <double> poi_user_distance = new List <double>();

            for (int i = 0; i < offsetList.Length; i++)
            {
                string[] oa       = offsetList[i].Split(',');//获取门店经度,纬度
                double   distance = GetDistance(shippingAddress.lat, shippingAddress.lng, Convert.ToDouble(oa[0]), Convert.ToDouble(oa[1]));
                poi_id.Add(dtPoiInfo.Rows[i]["poi_id"].ToString());
                poi_user_distance.Add(distance);
            }

            string matchIds      = "";
            string matchDistance = "";

            if (poi_id.Count > 0)
            {
                for (int i = 0; i < poi_id.Count; i++)
                {
                    DataTable dtSender = WxPoiHelper.GetSenderByPoiId(poi_id[i]);
                    foreach (DataRow row in dtSender.Rows)
                    {
                        if (row["clientUserId"].ToString() != "")
                        {
                            matchIds      += row["clientUserId"] + ",";
                            matchDistance += poi_user_distance[i] + ",";
                        }
                    }
                }
                matchDistance = matchDistance.TrimEnd(',');
                matchIds      = matchIds.TrimEnd(',');
            }

            string[] matchDistanceArrStr = matchDistance.Split(',');
            if (matchDistanceArrStr.Length <= 0)
            {
                return;
            }
            double[] matchDistanceArr = new double[matchDistanceArrStr.Length];
            for (int i = 0; i < matchDistanceArrStr.Length; i++)
            {
                matchDistanceArr[i] = Convert.ToDouble(matchDistanceArrStr[i]);
            }
            string[] matchIdsArr = matchIds.Split(',');
            int      minIndex    = GetMinAndIndex(matchDistanceArr);

            hidUserDistance.Value   = matchDistanceArr[minIndex].ToString(); //获取距离最小的值
            this.litOrderAlert.Text = this.litOrderAlert.Text + "当前配送距离:" + hidUserDistance.Value + "公里";
            hidUserStoreId.Value    = matchIdsArr[minIndex].ToString();      //获取距离最小的值的门店id
            if (matchIdsArr.Length > 0)
            {
                hidUserStoreName.Value = DistributorsBrower.GetDistributorInfo(int.Parse(matchIdsArr[minIndex])).StoreName;
            }
        }
Exemplo n.º 27
0
        protected void rptList_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            bool      flag      = false;
            OrderInfo orderInfo = OrderHelper.GetOrderInfo(e.CommandArgument.ToString());

            if (orderInfo != null)
            {
                if ((e.CommandName == "CONFIRM_PAY") && orderInfo.CheckAction(OrderActions.SELLER_CONFIRM_PAY))
                {
                    int num2       = 0;
                    int num3       = 0;
                    int groupBuyId = orderInfo.GroupBuyId;
                    if (OrderHelper.ConfirmPay(orderInfo))
                    {
                        DebitNoteInfo info2 = new DebitNoteInfo();
                        info2.NoteId   = Globals.GetGenerateId();
                        info2.OrderId  = e.CommandArgument.ToString();
                        info2.Operator = ManagerHelper.GetCurrentManager().UserName;
                        info2.Remark   = "后台" + info2.Operator + "收款成功";

                        OrderHelper.SaveDebitNote(info2);
                        if (orderInfo.GroupBuyId > 0)
                        {
                            int num4 = num2 + num3;
                        }
                        this.BindOrders();
                        orderInfo.OnPayment();
                        this.ShowMsg("成功的确认了订单收款", true);
                    }
                    else
                    {
                        this.ShowMsg("确认订单收款失败", false);
                    }
                }
                else if ((e.CommandName == "FINISH_TRADE") && orderInfo.CheckAction(OrderActions.SELLER_FINISH_TRADE))
                {
                    Dictionary <string, LineItemInfo> lineItems = orderInfo.LineItems;
                    LineItemInfo info3 = new LineItemInfo();
                    foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                    {
                        info3 = pair.Value;
                        if ((info3.OrderItemsStatus == OrderStatus.ApplyForRefund) || (info3.OrderItemsStatus == OrderStatus.ApplyForReturns))
                        {
                            flag = true;
                        }
                    }
                    if (!flag)
                    {
                        if (OrderHelper.ConfirmOrderFinish(orderInfo))
                        {
                            this.BindOrders();
                            DistributorsBrower.UpdateCalculationCommission(orderInfo, wid);
                            foreach (LineItemInfo info4 in orderInfo.LineItems.Values)
                            {
                                if (info4.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    RefundHelper.UpdateOrderGoodStatu(orderInfo.OrderId, info4.SkuId, 5);
                                }
                            }
                            this.ShowMsg("成功的完成了该订单", true);
                        }
                        else
                        {
                            this.ShowMsg("完成订单失败", false);
                        }
                    }
                    else
                    {
                        this.ShowMsg("订单中商品有退货(款)不允许完成!", false);
                    }
                }
            }
        }
Exemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            wid = context.Session[DTKeys.SESSION_WEB_ID] as string;
            if (string.IsNullOrEmpty(wid))
            {
                return;
            }
            string str  = context.Request.Form["actionName"];
            string s    = string.Empty;
            string str4 = str;

            if (str4 != null)
            {
                if (!(str4 == "Topic"))
                {
                    if (str4 == "Vote")
                    {
                        s = JsonConvert.SerializeObject(StoreHelper.GetVoteList());
                    }
                    else if (str4 == "Category")
                    {
                        s = JsonConvert.SerializeObject(from item in CatalogHelper.GetMainCategories(this.wid) select new { CateId = item.CategoryId, CateName = item.Name });
                    }
                    else if (str4 == "Activity")
                    {
                        Array           values = Enum.GetValues(typeof(LotteryActivityType));
                        List <EnumJson> list3  = new List <EnumJson>();
                        foreach (Enum enum2 in values)
                        {
                            EnumJson json = new EnumJson {
                                Name  = enum2.ToShowText(),
                                Value = enum2.ToString()
                            };
                            list3.Add(json);
                        }
                        s = JsonConvert.SerializeObject(list3);
                    }
                    else if (str4 == "ActivityList")
                    {
                        string str3 = context.Request.Form["acttype"];
                        LotteryActivityType type = (LotteryActivityType)Enum.Parse(typeof(LotteryActivityType), str3);
                        if (type == LotteryActivityType.SignUp)
                        {
                            s = JsonConvert.SerializeObject(from item in VShopHelper.GetAllActivity() select new { ActivityId = item.ActivityId, ActivityName = item.Name });
                        }
                        else
                        {
                            s = JsonConvert.SerializeObject(VShopHelper.GetLotteryActivityByType(type));
                        }
                    }
                    else if (str4 == "AccountTime")
                    {
                        s = s + "{";
                        BalanceDrawRequestQuery entity = new BalanceDrawRequestQuery {
                            RequestTime      = "",
                            CheckTime        = "",
                            StoreName        = "",
                            PageIndex        = 1,
                            PageSize         = 1,
                            SortOrder        = SortAction.Desc,
                            SortBy           = "RequestTime",
                            RequestEndTime   = "",
                            RequestStartTime = "",
                            IsCheck          = "1",
                            UserId           = context.Request.Form["UserID"]
                        };
                        Globals.EntityCoding(entity, true);
                        DataTable data = (DataTable)DistributorsBrower.GetBalanceDrawRequest(entity, null).Data;
                        if (data.Rows.Count > 0)
                        {
                            if (data.Rows[0]["MerchantCode"].ToString().Trim() != context.Request.Form["merchantcode"].Trim())
                            {
                                s = s + "\"Time\":\"" + data.Rows[0]["RequestTime"].ToString() + "\"";
                            }
                            else
                            {
                                s = s + "\"Time\":\"\"";
                            }
                        }
                        else
                        {
                            s = s + "\"Time\":\"\"";
                        }
                        s = s + "}";
                    }
                }
                else
                {
                    s = JsonConvert.SerializeObject(VShopHelper.Gettopics());
                }
            }
            context.Response.Write(s);
        }
Exemplo n.º 29
0
 protected override void AttachChildControls()
 {
     if (!int.TryParse(this.Page.Request.QueryString["ReferralId"], out this.userId))
     {
         this.Context.Response.Redirect("/");
     }
     else
     {
         DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(this.userId);
         if (userIdDistributors == null)
         {
             this.Context.Response.Redirect("/");
         }
         else
         {
             this.imglogo = (HtmlImage)this.FindControl("QrcodeImg");
             int currentMemberUserId = Globals.GetCurrentMemberUserId(false);
             this.editPanel         = (HtmlControl)this.FindControl("editPanel");
             this.editPanel.Visible = false;
             if (currentMemberUserId == this.userId)
             {
                 this.imglogo.Attributes.Add("Admin", "true");
                 MemberInfo currentMember = MemberProcessor.GetCurrentMember();
                 DateTime   cardCreatTime = userIdDistributors.CardCreatTime;
                 string     str           = File.ReadAllText(HttpRuntime.AppDomainAppPath.ToString() + "Storage/Utility/StoreCardSet.js");
                 JObject    obj2          = JsonConvert.DeserializeObject(str) as JObject;
                 DateTime   time2         = new DateTime();
                 if ((obj2 != null) && (obj2["writeDate"] != null))
                 {
                     time2 = DateTime.Parse(obj2["writeDate"].ToString());
                 }
                 ScanInfos info = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                 if (info == null)
                 {
                     ScanHelp.CreatNewScan(currentMember.UserId, "WX", 0);
                     info = ScanHelp.GetScanInfosByUserId(currentMember.UserId, 0, "WX");
                 }
                 string codeUrl = "";
                 if (info == null)
                 {
                     codeUrl = Globals.HostPath(HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                 }
                 else
                 {
                     codeUrl = info.CodeUrl;
                     if (string.IsNullOrEmpty(codeUrl))
                     {
                         string token = TokenApi.GetToken_Message(this.siteSettings.WeixinAppId, this.siteSettings.WeixinAppSecret);
                         if (TokenApi.CheckIsRightToken(token))
                         {
                             string str4 = BarCodeApi.CreateTicket(token, info.Sceneid, "QR_LIMIT_SCENE", "2592000");
                             if (!string.IsNullOrEmpty(str4))
                             {
                                 codeUrl             = str4;
                                 info.CodeUrl        = str4;
                                 info.CreateTime     = DateTime.Now;
                                 info.LastActiveTime = DateTime.Now;
                                 ScanHelp.updateScanInfosCodeUrl(info);
                             }
                         }
                     }
                     if (string.IsNullOrEmpty(codeUrl))
                     {
                         codeUrl = Globals.HostPath(HttpContext.Current.Request.Url) + "/Follow.aspx?ReferralId=" + currentMember.UserId.ToString();
                     }
                     else
                     {
                         codeUrl = BarCodeApi.GetQRImageUrlByTicket(codeUrl);
                     }
                 }
                 if (string.IsNullOrEmpty(userIdDistributors.StoreCard) || (cardCreatTime < time2))
                 {
                     string storeName = userIdDistributors.StoreName;
                     if (!this.siteSettings.IsShowDistributorSelfStoreName)
                     {
                         storeName = this.siteSettings.SiteName;
                     }
                     StoreCardCreater creater = new StoreCardCreater(str, currentMember.UserHead, userIdDistributors.Logo, codeUrl, currentMember.UserName, storeName, this.userId, this.userId);
                     string           imgUrl  = "";
                     if (creater.ReadJson() && creater.CreadCard(out imgUrl))
                     {
                         DistributorsBrower.UpdateStoreCard(this.userId, imgUrl);
                     }
                 }
             }
             if (string.IsNullOrEmpty(userIdDistributors.StoreCard))
             {
                 userIdDistributors.StoreCard = "/Storage/master/DistributorCards/StoreCard" + this.userId.ToString() + ".jpg";
             }
             this.ShareInfo   = (HtmlInputHidden)this.FindControl("ShareInfo");
             this.imglogo.Src = userIdDistributors.StoreCard;
             PageTitle.AddSiteNameTitle("掌柜名片");
         }
     }
 }
Exemplo n.º 30
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("申请分销");
            this.Page.Session["stylestatus"] = "2";

            if (MemberProcessor.GetCurrentMember() != null)
            {
                DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(MemberProcessor.GetCurrentMember().UserId);
                if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
                {
                    this.Page.Response.Redirect("DistributorCenter.aspx", true);
                }
            }

            Literal litNext = (Literal)this.FindControl("litNext");

            //增加判断,如果选了快速开店,上架商品页面也必须要跳过.
            if (litNext != null)
            {
                if ((Hidistro.Core.SettingsManager.GetMasterSettings(false).EnableStoreInfoSet))//如果开启了店铺配置(非快速开店)
                {
                    litNext.Text = (Hidistro.Core.SettingsManager.GetMasterSettings(false).EnableStoreProductAuto) ? "" : ",上架商品";
                }
                else//如果没开店铺配置(快速开店)
                {
                    storeName = (HtmlInputHidden)this.FindControl("storeName");
                    if (storeName != null) //附一个默认值
                    {
                        int i = 1;
                        storeName.Value = MemberProcessor.GetCurrentMember().UserName.ToString() + "的小店";
                        while (DistributorsBrower.IsExiteDistributorsByStoreName(storeName.Value) > 0)
                        {
                            i++;
                            storeName.Value += i.ToString();
                        }
                    }
                    litNext.Text = "";
                }
            }

            //页面[马上成为分销商]按钮的传参判断
            if (Page.Request.QueryString["action"] != null)
            {
                switch (Page.Request.QueryString["action"])
                {
                //针对阿黛尔艺丝,成为分销商(vip)后直接获取一个最新的优惠券
                case "VIP":
                    int            couponId;//优惠券id
                    string         claimCode     = string.Empty;
                    MemberInfo     currentMember = MemberProcessor.GetCurrentMember();
                    CouponItemInfo item          = new CouponItemInfo();
                    System.Collections.Generic.IList <CouponItemInfo> listCouponItem = new System.Collections.Generic.List <CouponItemInfo>();
                    //DataTable coupons = CouponHelper.GetAllCouponsID();
                    DataTable allCoupons = CouponHelper.GetAllCoupons();    //优惠券列表
                    for (int i = 0; i < allCoupons.Rows.Count; i++)
                    {
                        if (allCoupons.Rows[i]["sendAtDistributor"].ToString() == "1")    //如果需要在成为分销商时赠送,就开始赠送
                        {
                            couponId  = Convert.ToInt32(allCoupons.Rows[i]["CouponId"]);
                            claimCode = currentMember.UserId.ToString().PadLeft(15, 'a');   //左边填充
                            item      = new CouponItemInfo(couponId, claimCode, new int?(currentMember.UserId), currentMember.UserName, currentMember.Email, System.DateTime.Now);
                            listCouponItem.Add(item);
                            CouponHelper.SendClaimCodes(couponId, listCouponItem);
                            break;
                        }
                    }
                    break;
                }
            }
        }