Example #1
0
        public static bool UpdateCalculationCommission(OrderInfo order)
        {
            DistributorsInfo userIdDistributors = GetUserIdDistributors(order.ReferralUserId);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info2       = new LineItemInfo();
                DataView     defaultView = CategoryBrowser.GetAllCategories().DefaultView;
                string       str2        = null;
                string       str3        = null;
                string       str4        = null;
                decimal      subTotal    = 0M;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    string key = pair.Key;
                    info2 = pair.Value;
                    DataTable productCategories = ProductBrowser.GetProductCategories(info2.ProductId);
                    if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                    {
                        defaultView.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                        str2 = defaultView[0]["FirstCommission"].ToString();
                        str3 = defaultView[0]["SecondCommission"].ToString();
                        str4 = defaultView[0]["ThirdCommission"].ToString();

                        //计算分销 一口价 减 成本价 乘以 佣金比例
                        if ((!string.IsNullOrEmpty(str2) && !string.IsNullOrEmpty(str3)) && !string.IsNullOrEmpty(str4))
                        {
                            ArrayList referralBlanceList = new ArrayList();
                            ArrayList userIdList         = new ArrayList();
                            ArrayList ordersTotalList    = new ArrayList();
                            subTotal = info2.GetSubTotal();

                            //三级分店
                            referralBlanceList.Add((decimal.Parse(str2.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                            userIdList.Add(order.ReferralUserId);
                            ordersTotalList.Add(subTotal);

                            if (userIdDistributors.ParentUserId > 0)
                            {
                                referralBlanceList.Add((decimal.Parse(str3.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                userIdList.Add(userIdDistributors.ParentUserId);
                                ordersTotalList.Add(subTotal);

                                if (userIdDistributors.ReferralUserId2 > 0)
                                {
                                    referralBlanceList.Add((decimal.Parse(str4.Split(new char[] { '|' })[0]) / 100M) * info2.GetSubCommission());
                                    userIdList.Add(userIdDistributors.ReferralUserId2);
                                    ordersTotalList.Add(subTotal);
                                }
                            }

                            flag = new DistributorsDao().UpdateCalculationCommission(userIdList, referralBlanceList, order.OrderId, ordersTotalList, order.UserId.ToString());
                        }
                    }
                }
                flag = new DistributorsDao().UpdateDistributorsOrderNum(order.ReferralUserId.ToString(), order.GetTotal().ToString());
                RemoveDistributorCache(userIdDistributors.UserId);
            }
            return(flag);
        }
Example #2
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);
                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.litUserId.Text    = userIdDistributors.UserId.ToString();
                this.litUserId1.Text   = userIdDistributors.UserId.ToString();
                this.litUserId2.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.saletotal       = (FormatedMoneyLabel)this.FindControl("saletotal");
                this.saletotal.Money = userIdDistributors.OrdersTotal;
                this.litMysubStore   = (Literal)this.FindControl("litMysubStore");
                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.litMysubFirst.Text  = distributorsSubStoreNum.Rows[0]["firstV"].ToString();
                    this.litMysubSecond.Text = distributorsSubStoreNum.Rows[0]["secondV"].ToString();
                    this.litMysubStore.Text  = (int.Parse(this.litMysubFirst.Text) + int.Parse(this.litMysubSecond.Text)).ToString();
                }
                else
                {
                    this.litMysubFirst.Text  = "0";
                    this.litMysubSecond.Text = "0";
                    this.litMysubStore.Text  = "0";
                }
                this.litProtuctNum      = (Literal)this.FindControl("litProtuctNum");
                this.litProtuctNum.Text = ProductBrowser.GetProductsNumber().ToString();
                query.Status            = OrderStatus.All;
                this.litOrders          = (Literal)this.FindControl("litOrders");
                this.litOrders.Text     = DistributorsBrower.GetDistributorOrderCount(query).ToString();
            }
        }
Example #3
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("申请分销");
            this.Page.Session["stylestatus"] = "2";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (string.IsNullOrEmpty(currentMember.UserBindName))
            {
                this.Page.Response.Redirect("/BindUserMessage.aspx?returnUrl=/Vshop/DistributorValid.aspx", true);
                this.Page.Response.End();
            }
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);

            if (userIdDistributors != null && userIdDistributors.ReferralStatus == 0)
            {
                this.Page.Response.Redirect("/Vshop/DistributorCenter.aspx", true);
                this.Page.Response.End();
            }
            bool         flag           = false;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.DistributorApplicationCondition)
            {
                decimal expenditure        = currentMember.Expenditure;
                int     finishedOrderMoney = masterSettings.FinishedOrderMoney;
                if (finishedOrderMoney > 0)
                {
                    decimal   num = 0m;
                    DataTable userOrderPaidWaitFinish = OrderHelper.GetUserOrderPaidWaitFinish(currentMember.UserId);
                    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;
                            }
                        }
                    }
                    if (currentMember.Expenditure + num >= finishedOrderMoney)
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    if (masterSettings.EnableDistributorApplicationCondition)
                    {
                        if (!string.IsNullOrEmpty(masterSettings.DistributorProductsDate) && !string.IsNullOrEmpty(masterSettings.DistributorProducts))
                        {
                            if (masterSettings.DistributorProductsDate.Contains("|"))
                            {
                                System.DateTime value  = default(System.DateTime);
                                System.DateTime value2 = default(System.DateTime);
                                bool            flag2  = System.DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                {
                                    '|'
                                })[0].ToString(), out value);
                                bool flag3 = System.DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[]
                                {
                                    '|'
                                })[1].ToString(), out value2);
                                if (flag2 && flag3 && System.DateTime.Now.CompareTo(value) >= 0 && System.DateTime.Now.CompareTo(value2) < 0)
                                {
                                    if (MemberProcessor.CheckMemberIsBuyProds(currentMember.UserId, masterSettings.DistributorProducts, new System.DateTime?(value), new System.DateTime?(value2)))
                                    {
                                        flag = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                flag = true;
            }
            if (!flag)
            {
                this.Page.Response.Redirect("/Vshop/DistributorRegCheck.aspx", true);
                this.Page.Response.End();
            }
            int num2 = 0;

            this.idImg = (System.Web.UI.HtmlControls.HtmlImage) this.FindControl("idImg");
            string text = string.Empty;

            if (int.TryParse(this.Page.Request.QueryString["ReferralId"], out num2))
            {
                if (num2 > 0)
                {
                    DistributorsInfo userIdDistributors2 = DistributorsBrower.GetUserIdDistributors(num2);
                    if (userIdDistributors2 != null)
                    {
                        if (!string.IsNullOrEmpty(userIdDistributors2.Logo))
                        {
                            text = userIdDistributors2.Logo;
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(text))
            {
                text = masterSettings.DistributorLogoPic;
            }
            this.idImg.Src = text;
            if (userIdDistributors != null && userIdDistributors.ReferralStatus != 0)
            {
                this.litIsEnable       = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litIsEnable");
                this.litIsEnable.Value = userIdDistributors.ReferralStatus.ToString();
            }
        }
Example #4
0
        public static bool UpdateCalculationCommission(OrderInfo order)
        {
            Exception exception;

            new MemberDao().SetOrderDate(order.UserId, 2);
            DistributorsInfo userIdDistributors = GetUserIdDistributors(order.ReferralUserId);
            SiteSettings     masterSettings     = SettingsManager.GetMasterSettings(false);
            bool             flag = false;

            if (userIdDistributors != null)
            {
                flag = setCommission(order, userIdDistributors);
                if (!string.IsNullOrEmpty(order.ReferralPath))
                {
                    string    userOpenIdByUserId;
                    string    aliUserOpenIdByUserId;
                    int       notDescDistributorGrades;
                    ArrayList commTatalList  = new ArrayList();
                    decimal   num            = 0M;
                    ArrayList userIdList     = new ArrayList();
                    string    referralUserId = order.ReferralUserId.ToString();
                    string    orderId        = order.OrderId;
                    ArrayList orderTotalList = new ArrayList();
                    decimal   num2           = 0M;
                    ArrayList gradeIdList    = new ArrayList();
                    string[]  strArray       = order.ReferralPath.Split(new char[] { '|' });
                    if (strArray.Length == 1)
                    {
                        DistributorsInfo distributor = GetUserIdDistributors(int.Parse(strArray[0]));
                        if (distributor != null)
                        {
                            foreach (LineItemInfo info3 in order.LineItems.Values)
                            {
                                if (info3.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                                {
                                    num  += info3.SecondItemsCommission;
                                    num2 += info3.GetSubTotal();
                                }
                            }
                            commTatalList.Add(num);
                            orderTotalList.Add(num2 + order.AdjustedFreight);
                            userIdList.Add(distributor.UserId);
                            try
                            {
                                if ((order != null) && (num > 0M))
                                {
                                    userOpenIdByUserId    = MemberProcessor.GetUserOpenIdByUserId(distributor.UserId);
                                    aliUserOpenIdByUserId = MemberProcessor.GetAliUserOpenIdByUserId(distributor.UserId);
                                    Messenger.SendWeiXinMsg_OrderGetCommission(order, userOpenIdByUserId, aliUserOpenIdByUserId, num);
                                }
                            }
                            catch (Exception exception1)
                            {
                                exception = exception1;
                            }
                            notDescDistributorGrades = GetNotDescDistributorGrades(distributor.UserId.ToString());
                            if (distributor.DistriGradeId != notDescDistributorGrades)
                            {
                                DistributorGradeChange(distributor, order.OrderId, notDescDistributorGrades);
                            }
                        }
                    }
                    if (strArray.Length == 2)
                    {
                        DistributorsInfo info4 = GetUserIdDistributors(int.Parse(strArray[0]));
                        foreach (LineItemInfo info3 in order.LineItems.Values)
                        {
                            if (info3.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                            {
                                num  += info3.ThirdItemsCommission;
                                num2 += info3.GetSubTotal();
                            }
                        }
                        commTatalList.Add(num);
                        orderTotalList.Add(num2 + order.AdjustedFreight);
                        userIdList.Add(info4.UserId);
                        try
                        {
                            if ((order != null) && (num > 0M))
                            {
                                userOpenIdByUserId    = MemberProcessor.GetUserOpenIdByUserId(info4.UserId);
                                aliUserOpenIdByUserId = MemberProcessor.GetAliUserOpenIdByUserId(info4.UserId);
                                Messenger.SendWeiXinMsg_OrderGetCommission(order, userOpenIdByUserId, aliUserOpenIdByUserId, num);
                            }
                        }
                        catch (Exception exception2)
                        {
                            exception = exception2;
                        }
                        notDescDistributorGrades = GetNotDescDistributorGrades(info4.UserId.ToString());
                        if (info4.DistriGradeId != notDescDistributorGrades)
                        {
                            DistributorGradeChange(info4, order.OrderId, notDescDistributorGrades);
                        }
                        DistributorsInfo info5 = GetUserIdDistributors(int.Parse(strArray[1]));
                        num  = 0M;
                        num2 = 0M;
                        foreach (LineItemInfo info3 in order.LineItems.Values)
                        {
                            if (info3.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                            {
                                num  += info3.SecondItemsCommission;
                                num2 += info3.GetSubTotal();
                            }
                        }
                        commTatalList.Add(num);
                        orderTotalList.Add(num2 + order.AdjustedFreight);
                        userIdList.Add(info5.UserId);
                        try
                        {
                            if ((order != null) && (num > 0M))
                            {
                                userOpenIdByUserId    = MemberProcessor.GetUserOpenIdByUserId(info5.UserId);
                                aliUserOpenIdByUserId = MemberProcessor.GetAliUserOpenIdByUserId(info5.UserId);
                                Messenger.SendWeiXinMsg_OrderGetCommission(order, userOpenIdByUserId, aliUserOpenIdByUserId, num);
                            }
                        }
                        catch (Exception exception3)
                        {
                            exception = exception3;
                        }
                        int newDistributorGradeid = GetNotDescDistributorGrades(info5.UserId.ToString());
                        if (info5.DistriGradeId != newDistributorGradeid)
                        {
                            DistributorGradeChange(info5, order.OrderId, newDistributorGradeid);
                        }
                    }
                    flag = new DistributorsDao().UpdateTwoCalculationCommission(userIdList, referralUserId, orderId, orderTotalList, commTatalList);
                    for (int i = 0; i < userIdList.Count; i++)
                    {
                        int num6 = GetNotDescDistributorGrades(userIdList[i].ToString());
                        gradeIdList.Add(num6);
                    }
                    flag = new DistributorsDao().UpdateGradeId(gradeIdList, userIdList);
                }
                RemoveDistributorCache(userIdDistributors.UserId);
            }
            OrderRedPagerBrower.CreateOrderRedPager(order.OrderId, order.GetTotal(), order.UserId);
            int id = Globals.IsNumeric(order.ActivitiesId) ? Globals.ToNum(order.ActivitiesId) : 0;

            if (id > 0)
            {
                ActivityDetailInfo activityDetailInfo = new Hidistro.SqlDal.VShop.ActivityDao().GetActivityDetailInfo(id);
                if (activityDetailInfo != null)
                {
                    OrderInfo info8;
                    int       couponId = activityDetailInfo.CouponId;
                    int       integral = activityDetailInfo.Integral;
                    if ((couponId > 0) && (ShoppingProcessor.GetCoupon(couponId.ToString()) != null))
                    {
                        SendCouponResult result = new CouponDao().SendCouponToMember(couponId, order.UserId);
                        try
                        {
                            info8 = order;
                            if (info8 != null)
                            {
                                Messenger.SendWeiXinMsg_OrderGetCoupon(info8);
                            }
                        }
                        catch (Exception exception4)
                        {
                            exception = exception4;
                        }
                    }
                    if (integral > 0)
                    {
                        new OrderDao().AddMemberPointNumber(integral, order, null);
                        try
                        {
                            info8 = order;
                            if (info8 != null)
                            {
                                Messenger.SendWeiXinMsg_OrderGetPoint(info8, integral);
                            }
                        }
                        catch (Exception exception5)
                        {
                            exception = exception5;
                        }
                    }
                }
            }
            MemberProcessor.UpdateUserAccount(order);
            try
            {
                string   retInfo   = "";
                DateTime orderDate = order.OrderDate;
                DateTime?payDate   = order.PayDate;
                if (order.Gateway == "hishop.plugins.payment.podrequest")
                {
                    payDate = new DateTime?(orderDate);
                }
                if (payDate.HasValue && (payDate.Value.ToString("yyyy-MM-dd") != DateTime.Now.ToString("yyyy-MM-dd")))
                {
                    bool flag2 = new ShopStatisticDao().StatisticsOrdersByRecDate(payDate.Value, UpdateAction.AllUpdate, 0, out retInfo);
                }
            }
            catch
            {
            }
            return(flag);
        }
Example #5
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("申请分销");
            this.Page.Session["stylestatus"] = "2";
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (string.IsNullOrEmpty(currentMember.UserBindName))
            {
                this.Page.Response.Redirect("/BindUserMessage.aspx?returnUrl=/Vshop/DistributorValid.aspx", true);
                this.Page.Response.End();
            }
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(currentMember.UserId);

            if ((userIdDistributors != null) && (userIdDistributors.ReferralStatus == 0))
            {
                this.Page.Response.Redirect("/Vshop/DistributorCenter.aspx", true);
                this.Page.Response.End();
            }
            bool         flag           = false;
            SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);

            if (masterSettings.DistributorApplicationCondition)
            {
                decimal expenditure        = currentMember.Expenditure;
                int     finishedOrderMoney = masterSettings.FinishedOrderMoney;
                if (finishedOrderMoney > 0)
                {
                    decimal   num3 = 0M;
                    DataTable userOrderPaidWaitFinish = OrderHelper.GetUserOrderPaidWaitFinish(currentMember.UserId);
                    decimal   total     = 0M;
                    OrderInfo orderInfo = null;
                    for (int i = 0; i < userOrderPaidWaitFinish.Rows.Count; i++)
                    {
                        orderInfo = OrderHelper.GetOrderInfo(userOrderPaidWaitFinish.Rows[i]["orderid"].ToString());
                        if (orderInfo != null)
                        {
                            total = orderInfo.GetTotal();
                            if (total > 0M)
                            {
                                num3 += total;
                            }
                        }
                    }
                    if ((currentMember.Expenditure + num3) >= finishedOrderMoney)
                    {
                        flag = true;
                    }
                }
                if ((!flag && masterSettings.EnableDistributorApplicationCondition) && ((!string.IsNullOrEmpty(masterSettings.DistributorProductsDate) && !string.IsNullOrEmpty(masterSettings.DistributorProducts)) && masterSettings.DistributorProductsDate.Contains("|")))
                {
                    DateTime time  = new DateTime();
                    DateTime time2 = new DateTime();
                    bool     flag2 = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[0].ToString(), out time);
                    bool     flag3 = DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[1].ToString(), out time2);
                    if ((((flag2 && flag3) && (DateTime.Now.CompareTo(time) >= 0)) && (DateTime.Now.CompareTo(time2) < 0)) && MemberProcessor.CheckMemberIsBuyProds(currentMember.UserId, masterSettings.DistributorProducts, new DateTime?(time), new DateTime?(time2)))
                    {
                        flag = true;
                    }
                }
            }
            else
            {
                flag = true;
            }
            if (!flag)
            {
                this.Page.Response.Redirect("/Vshop/DistributorRegCheck.aspx", true);
                this.Page.Response.End();
            }
            int result = 0;

            this.idImg = (HtmlImage)this.FindControl("idImg");
            string logo = string.Empty;

            if (int.TryParse(this.Page.Request.QueryString["ReferralId"], out result) && (result > 0))
            {
                DistributorsInfo info4 = DistributorsBrower.GetUserIdDistributors(result);
                if ((info4 != null) && !string.IsNullOrEmpty(info4.Logo))
                {
                    logo = info4.Logo;
                }
            }
            if (string.IsNullOrEmpty(logo))
            {
                logo = masterSettings.DistributorLogoPic;
            }
            this.idImg.Src = logo;
            if ((userIdDistributors != null) && (userIdDistributors.ReferralStatus != 0))
            {
                this.litIsEnable       = (HtmlInputHidden)this.FindControl("litIsEnable");
                this.litIsEnable.Value = userIdDistributors.ReferralStatus.ToString();
            }
        }
Example #6
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);
        }
Example #7
0
        public static void DistributorGradeChange(DistributorsInfo distributor, string orderid, int newDistributorGradeid)
        {
            DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(newDistributorGradeid);

            if ((distributorGradeInfo != null) && (distributorGradeInfo.AddCommission > 0M))
            {
                try
                {
                    Messenger.SendWeiXinMsg_DistributorGradeChange(MemberProcessor.GetMember(distributor.UserId, true), distributorGradeInfo.Name);
                }
                catch
                {
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                if (masterSettings.IsAddCommission == 1)
                {
                    try
                    {
                        DateTime time  = DateTime.Parse(masterSettings.AddCommissionStartTime);
                        DateTime time2 = DateTime.Parse(masterSettings.AddCommissionEndTime).AddDays(1.0);
                        if ((DateTime.Now > time) && (DateTime.Now < time2))
                        {
                            decimal num = distributor.ReferralRequestBalance + distributor.ReferralBlance;
                            DistributorGradeCommissionInfo info = new DistributorGradeCommissionInfo {
                                UserId             = distributor.UserId,
                                Commission         = distributorGradeInfo.AddCommission,
                                PubTime            = DateTime.Now,
                                OperAdmin          = "system",
                                Memo               = "升级奖励",
                                OrderID            = orderid,
                                OldCommissionTotal = num
                            };
                            if (!string.IsNullOrEmpty(info.OrderID))
                            {
                                info.ReferralUserId = new OrderDao().GetOrderReferralUserId(info.OrderID);
                            }
                            else
                            {
                                info.OrderID = "U" + GenerateOrderId();
                            }
                            info.CommType = 3;
                            if (info.ReferralUserId == 0)
                            {
                                info.ReferralUserId = info.UserId;
                                info.CommType       = 4;
                            }
                            DistributorGradeCommissionBrower.AddCommission(info);
                            NoticeInfo info4 = new NoticeInfo {
                                Title = "恭喜分销商获得升级奖励佣金¥" + distributorGradeInfo.AddCommission.ToString("F2")
                            };
                            StringBuilder builder = new StringBuilder();
                            builder.Append("<p class='textlist'>恭喜<span style='color:#3D9BDF;'>" + distributor.StoreName + "</span>自动升级为<span style='color:red;'>" + distributorGradeInfo.Name + "</span>分销商" + ((num > 0M) ? ("(累计获得佣金" + num.ToString("F2") + "元)") : "") + ",系统额外奖励佣金" + distributorGradeInfo.AddCommission.ToString("F2") + "元!</p>");
                            builder.Append("<p class='textlist'>自" + time.ToString("yyyy年MM月dd日") + "至" + time2.ToString("yyyy年MM月dd日") + ",分销商等级提升将获得系统奖励的额外佣金。</p>");
                            builder.Append("<table class='table table-bordered' style='text-align: center;'><thead><tr class='firstRow'><th style='text-align:center;'>等级名称</th><th style='text-align:center;'>需要佣金</th><th style='text-align:center;'>奖励佣金</th></tr></thead><tbody>");
                            DataTable allDistributorGrade = DistributorGradeBrower.GetAllDistributorGrade();
                            int       count = allDistributorGrade.Rows.Count;
                            for (int i = 0; i < count; i++)
                            {
                                builder.Append("<tr><td>" + allDistributorGrade.Rows[i]["Name"].ToString() + "</td><td>¥" + decimal.Parse(allDistributorGrade.Rows[i]["CommissionsLimit"].ToString()).ToString("F2") + "</td><td>¥" + decimal.Parse(allDistributorGrade.Rows[i]["AddCommission"].ToString()).ToString("F2") + "</td></tr>");
                            }
                            builder.Append("</tbody></table>");
                            info4.Memo     = builder.ToString();
                            info4.Author   = "system";
                            info4.AddTime  = DateTime.Now;
                            info4.IsPub    = 1;
                            info4.PubTime  = new DateTime?(DateTime.Now);
                            info4.SendType = 0;
                            info4.SendTo   = 0;
                            NoticeBrowser.SaveNotice(info4);
                        }
                    }
                    catch (Exception exception)
                    {
                        Globals.Debuglog("升级奖励异常" + exception.Message, "_Debuglog.txt");
                    }
                }
            }
        }
        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();
            }
        }
        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);
        }
Example #10
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();
                }
            }
        }
Example #11
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");
                }
            }
        }
Example #12
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>升级"
                    });
                }
            }
        }
Example #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(); //更新店铺访问信息
        }
Example #14
0
 public static bool UpdateDistributor(DistributorsInfo query)
 {
     return(new DistributorsDao().UpdateDistributor(query));
 }
Example #15
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;
            }
        }
Example #16
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);
        }
Example #17
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>"
            }));
        }
Example #18
0
        public static OrderInfo GetCalculadtionCommission(OrderInfo order)
        {
            DistributorsDao     dao             = new DistributorsDao();
            DistributorGradeDao dao2            = new DistributorGradeDao();
            DistributorsInfo    distributorInfo = dao.GetDistributorInfo(order.ReferralUserId);

            if (distributorInfo != null)
            {
                decimal  num         = 0M;
                decimal  num2        = 0M;
                decimal  num3        = 0M;
                DataView defaultView = dao2.GetAllDistributorGrade().DefaultView;
                if (distributorInfo.DistriGradeId.ToString() != "0")
                {
                    defaultView.RowFilter = " GradeId=" + distributorInfo.DistriGradeId;
                    if (defaultView.Count > 0)
                    {
                        num = decimal.Parse(defaultView[0]["FirstCommissionRise"].ToString());
                    }
                }
                if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                {
                    string[] strArray = distributorInfo.ReferralPath.Split(new char[] { '|' });
                    if (strArray.Length == 1)
                    {
                        DistributorsInfo info2 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info2.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info2.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                    }
                    else
                    {
                        DistributorsInfo info3 = dao.GetDistributorInfo(int.Parse(strArray[1]));
                        if (info3.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info3.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num2 = decimal.Parse(defaultView[0]["SecondCommissionRise"].ToString());
                            }
                        }
                        DistributorsInfo info4 = dao.GetDistributorInfo(int.Parse(strArray[0]));
                        if (info4.DistriGradeId.ToString() != "0")
                        {
                            defaultView.RowFilter = " GradeId=" + info4.DistriGradeId;
                            if (defaultView.Count > 0)
                            {
                                num3 = decimal.Parse(defaultView[0]["ThirdCommissionRise"].ToString());
                            }
                        }
                    }
                }
                Dictionary <string, LineItemInfo> lineItems = order.LineItems;
                LineItemInfo info5 = new LineItemInfo();
                DataView     view2 = new CategoryDao().GetCategories(order.wid).DefaultView;
                string       str   = null;
                string       str2  = null;
                string       str3  = null;
                foreach (KeyValuePair <string, LineItemInfo> pair in lineItems)
                {
                    info5 = pair.Value;
                    if (info5.Type == 0)
                    {
                        info5.ItemsCommission       = num;
                        info5.SecondItemsCommission = num2;
                        info5.ThirdItemsCommission  = num3;
                        decimal num4 = (info5.GetSubTotal() - info5.DiscountAverage) - info5.ItemAdjustedCommssion;
                        if (num4 > 0M)
                        {
                            if (info5.IsSetCommission)
                            {
                                info5.ItemsCommission       = ((info5.FirstCommission + num) / 100M) * num4;
                                info5.SecondItemsCommission = ((info5.SecondCommission + num2) / 100M) * num4;
                                info5.ThirdItemsCommission  = ((info5.ThirdCommission + num3) / 100M) * num4;
                            }
                            else
                            {
                                DataTable productCategories = new ProductDao().GetProductCategories(info5.ProductId);
                                if ((productCategories.Rows.Count > 0) && (productCategories.Rows[0][0].ToString() != "0"))
                                {
                                    view2.RowFilter = " CategoryId=" + productCategories.Rows[0][0];
                                    str             = view2[0]["FirstCommission"].ToString();
                                    str2            = view2[0]["SecondCommission"].ToString();
                                    str3            = view2[0]["ThirdCommission"].ToString();
                                    if ((!string.IsNullOrEmpty(str) && !string.IsNullOrEmpty(str2)) && !string.IsNullOrEmpty(str3))
                                    {
                                        info5.ItemsCommission       = ((decimal.Parse(str) + num) / 100M) * num4;
                                        info5.SecondItemsCommission = ((decimal.Parse(str2) + num2) / 100M) * num4;
                                        info5.ThirdItemsCommission  = ((decimal.Parse(str3) + num3) / 100M) * num4;
                                    }
                                }
                            }
                        }
                        else
                        {
                            info5.ItemsCommission       = 0M;
                            info5.SecondItemsCommission = 0M;
                            info5.ThirdItemsCommission  = 0M;
                        }
                    }
                    if (!string.IsNullOrEmpty(distributorInfo.ReferralPath) && (distributorInfo.ReferralPath != "0"))
                    {
                        if (distributorInfo.ReferralPath.Split(new char[] { '|' }).Length == 1)
                        {
                            info5.ThirdItemsCommission = 0M;
                        }
                    }
                    else
                    {
                        info5.SecondItemsCommission = 0M;
                        info5.ThirdItemsCommission  = 0M;
                    }
                }
            }
            return(order);
        }
Example #19
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("掌柜名片");
         }
     }
 }
Example #20
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");
                    }
                }
            }
        }
Example #21
0
        public static bool setCommission(OrderInfo order, DistributorsInfo DisInfo)
        {
            bool      flag               = false;
            decimal   num                = 0M;
            decimal   num2               = 0M;
            decimal   resultCommTatal    = 0M;
            string    userId             = order.ReferralUserId.ToString();
            string    orderId            = order.OrderId;
            decimal   num4               = 0M;
            ArrayList gradeIdList        = new ArrayList();
            ArrayList referralUserIdList = new ArrayList();

            foreach (LineItemInfo info in order.LineItems.Values)
            {
                if (info.OrderItemsStatus.ToString() == OrderStatus.SellerAlreadySent.ToString())
                {
                    num2 += info.ItemsCommission;
                    if ((!string.IsNullOrEmpty(info.ItemAdjustedCommssion.ToString()) && (info.ItemAdjustedCommssion > 0M)) && !info.IsAdminModify)
                    {
                        num += info.ItemAdjustedCommssion;
                    }
                    num4 += (info.GetSubTotal() - info.DiscountAverage) - info.ItemAdjustedCommssion;
                }
            }
            num4 -= order.AdjustedFreight;
            if (false)
            {
                resultCommTatal = num2;
            }
            else
            {
                resultCommTatal = num2 - num;
                if (resultCommTatal < 0M)
                {
                    resultCommTatal = 0M;
                }
            }
            flag = new DistributorsDao().UpdateCalculationCommission(userId, userId, orderId, num4 + order.AdjustedFreight, resultCommTatal);
            try
            {
                if ((order != null) && (resultCommTatal > 0M))
                {
                    string userOpenIdByUserId    = MemberProcessor.GetUserOpenIdByUserId(DisInfo.UserId);
                    string aliUserOpenIdByUserId = MemberProcessor.GetAliUserOpenIdByUserId(DisInfo.UserId);
                    Messenger.SendWeiXinMsg_OrderGetCommission(order, userOpenIdByUserId, aliUserOpenIdByUserId, resultCommTatal);
                }
            }
            catch (Exception exception)
            {
                Globals.Debuglog("分佣问题:" + exception.Message, "_Debuglog.txt");
            }
            int notDescDistributorGrades = GetNotDescDistributorGrades(userId);

            if (notDescDistributorGrades > 0)
            {
                gradeIdList.Add(notDescDistributorGrades);
                referralUserIdList.Add(userId);
                flag = new DistributorsDao().UpdateGradeId(gradeIdList, referralUserIdList);
                if (DisInfo.DistriGradeId != notDescDistributorGrades)
                {
                    DistributorGradeChange(DisInfo, order.OrderId, notDescDistributorGrades);
                }
            }
            return(flag);
        }
Example #22
0
        public static DistributorsInfo PopulateDistributorInfo(IDataReader reader)
        {
            if (null == reader)
            {
                return(null);
            }
            DistributorsInfo info = new DistributorsInfo {
                UserId    = (int)reader["UserId"],
                StoreName = (string)reader["StoreName"]
            };

            if (reader["RequestAccount"] != DBNull.Value)
            {
                info.RequestAccount = (string)reader["RequestAccount"];
            }
            if (reader["Logo"] != DBNull.Value)
            {
                info.Logo = (string)reader["Logo"];
            }
            info.BackImage = (string)reader["BackImage"];
            if (reader["AccountTime"] != DBNull.Value)
            {
                info.AccountTime = new DateTime?((DateTime)reader["AccountTime"]);
            }
            if (reader["GradeId"] != DBNull.Value)
            {
                info.DistributorGradeId = (DistributorGrade)Enum.Parse(typeof(DistributorGrade), reader["GradeId"].ToString(), true);
            }
            info.OrdersTotal = (decimal)reader["OrdersTotal"];
            if (reader["ReferralPath"] != DBNull.Value)
            {
                info.ReferralPath = (string)reader["ReferralPath"];
            }
            info.ReferralUserId         = (int)reader["ReferralUserId"];
            info.ReferralOrders         = (int)reader["ReferralOrders"];
            info.ReferralBlance         = (decimal)reader["ReferralBlance"];
            info.ReferralRequestBalance = (decimal)reader["ReferralRequestBalance"];
            info.CreateTime             = (DateTime)reader["CreateTime"];
            info.ReferralStatus         = (int)reader["ReferralStatus"];
            if (reader["StoreDescription"] != DBNull.Value)
            {
                info.StoreDescription = (string)reader["StoreDescription"];
            }
            if (reader["DistributorGradeId"] != DBNull.Value)
            {
                info.DistriGradeId = (int)reader["DistributorGradeId"];
            }
            if (isExistsField(reader, "IsAgent") && reader["IsAgent"] != DBNull.Value)
            {
                info.IsAgent = (int)reader["IsAgent"];
            }
            if (isExistsField(reader, "AgentGradeId") && reader["AgentGradeId"] != DBNull.Value)
            {
                info.AgentGradeId = (int)reader["AgentGradeId"];
            }
            if (isExistsField(reader, "AgentPath") && reader["AgentPath"] != DBNull.Value)
            {
                info.AgentPath = (string)reader["AgentPath"];
            }
            return(info);
        }
Example #23
0
        public void ProcessRequest(System.Web.HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember != null)
            {
                MemberGradeInfo memberGrade   = MemberProcessor.GetMemberGrade(currentMember.GradeId);
                OrderInfo       userLastOrder = MemberProcessor.GetUserLastOrder(currentMember.UserId);
                string          arg           = (!string.IsNullOrEmpty(currentMember.UserBindName)) ? currentMember.UserBindName : currentMember.UserName;
                string          arg2          = (!string.IsNullOrEmpty(currentMember.OpenId)) ? currentMember.UserName : string.Empty;
                int             port          = context.Request.Url.Port;
                string          text          = (port == 80) ? "" : (":" + port.ToString());
                string.Concat(new string[]
                {
                    "http://",
                    context.Request.Url.Host,
                    text,
                    Globals.ApplicationPath,
                    "/Admin/member/managemembers.aspx?Username="******"&pageSize=10"
                });
                string           arg3 = currentMember.UserBindName + "【" + ((memberGrade != null) ? memberGrade.Name : "普通会员") + "】";
                string           arg4 = currentMember.OrderNumber.ToString() + "单(¥" + currentMember.Expenditure.ToString("F2") + ")";
                string           arg5 = (userLastOrder != null) ? userLastOrder.OrderDate.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty;
                string           arg6 = string.Empty;
                string           arg7 = string.Empty;
                string           arg8 = string.Empty;
                string           arg9 = string.Empty;
                int              currentMemberUserId = Globals.GetCurrentMemberUserId();
                DistributorsInfo userIdDistributors  = DistributorsBrower.GetUserIdDistributors(currentMemberUserId);
                if (userIdDistributors != null)
                {
                    DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(userIdDistributors.DistriGradeId);
                    string           text2           = "0.00";
                    DistributorsInfo distributorInfo = DistributorsBrower.GetDistributorInfo(userIdDistributors.UserId);
                    if (distributorInfo != null)
                    {
                        text2 = distributorInfo.ReferralBlance.ToString("F2");
                    }
                    string str  = "0";
                    string str2 = "0";
                    System.Data.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();
                    }
                    string.Concat(new string[]
                    {
                        "http://",
                        context.Request.Url.Host,
                        text,
                        Globals.ApplicationPath,
                        "/Admin/Fenxiao/distributorlist.aspx?MicroSignal=",
                        currentMember.UserName,
                        "&Status=0&pageSize=10"
                    });
                    arg6 = userIdDistributors.StoreName + "【" + distributorGradeInfo.Name + "】";
                    arg7 = "¥" + userIdDistributors.OrdersTotal.ToString("F2");
                    arg8 = string.Concat(new string[]
                    {
                        "¥",
                        text2,
                        "(待提现¥",
                        userIdDistributors.ReferralBlance.ToString("F2"),
                        ",已提现¥",
                        userIdDistributors.ReferralRequestBalance.ToString("F2"),
                        ")"
                    });
                    arg9 = "一级分店数" + str + ",二级分店数" + str2;
                }
                stringBuilder.Append("<script>");
                stringBuilder.Append("var mechatMetadataInter = setInterval(function() {");
                stringBuilder.Append("if (window.mechatMetadata) {");
                stringBuilder.Append("clearInterval(mechatMetadataInter);");
                stringBuilder.Append("window.mechatMetadata({");
                stringBuilder.AppendFormat("appUserName: '******',", arg);
                stringBuilder.AppendFormat("appNickName: '{0}',", currentMember.UserName);
                stringBuilder.AppendFormat("realName: '{0}',", currentMember.RealName);
                stringBuilder.AppendFormat("avatar: '{0}',", currentMember.UserHead);
                stringBuilder.AppendFormat("tel: '{0}',", currentMember.CellPhone);
                stringBuilder.AppendFormat("email: '{0}',", currentMember.Email);
                stringBuilder.AppendFormat("QQ: '{0}',", currentMember.QQ);
                stringBuilder.AppendFormat("weibo: '',", new object[0]);
                stringBuilder.AppendFormat("weixin: '{0}',", arg2);
                stringBuilder.AppendFormat("address: '{0}',", currentMember.Address);
                stringBuilder.Append("extraParams: {");
                stringBuilder.AppendFormat("'会员帐号': '{0}',", arg3);
                stringBuilder.AppendFormat("'会员订单': '{0}',", arg4);
                stringBuilder.AppendFormat("'会员积分': '{0}',", currentMember.Points.ToString());
                stringBuilder.AppendFormat("'最近购买': '{0}',", arg5);
                stringBuilder.AppendFormat("'店铺名称': '{0}',", arg6);
                stringBuilder.AppendFormat("'销售额': '{0}',", arg7);
                stringBuilder.AppendFormat("'佣金信息': '{0}',", arg8);
                stringBuilder.AppendFormat("'分店数量': '{0}'", arg9);
                stringBuilder.Append("}");
                stringBuilder.Append("});");
                stringBuilder.Append("}");
                stringBuilder.Append("}, 500);");
                stringBuilder.Append("</script>");
            }
            context.Response.Write(stringBuilder.ToString() + " ");
        }
Example #24
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: @;\">"));
        }
Example #25
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);
                }
            }
            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
            });
        }
Example #26
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("申请分销商");
        }
        protected override void AttachChildControls()
        {
            this.litItemParams = (Literal)this.FindControl("litItemParams");
            string     str           = HttpContext.Current.Request.QueryString.Get("orderid");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (!string.IsNullOrEmpty(str) && (currentMember != null))
            {
                DataTable orderRedPager = ShareActHelper.GetOrderRedPager(str, currentMember.UserId);
                if ((orderRedPager != null) && (orderRedPager.Rows.Count > 0))
                {
                    DataView defaultView = orderRedPager.DefaultView;
                    if (defaultView.Count > 0)
                    {
                        ShareActivityInfo act = ShareActHelper.GetAct(Convert.ToInt32(defaultView[0]["RedPagerActivityId"]));
                        if (act != null)
                        {
                            string shareTitle  = act.ShareTitle;
                            string description = act.Description;
                            if (shareTitle.Contains("{{店铺名称}}") || description.Contains("{{店铺名称}}"))
                            {
                                HttpCookie cookie = new HttpCookie("Vshop-ReferralId");
                                if ((cookie != null) && (cookie.Value != null))
                                {
                                    DistributorsInfo userIdDistributors = new DistributorsInfo();
                                    userIdDistributors = DistributorsBrower.GetUserIdDistributors(int.Parse(cookie.Value));
                                    description        = description.Replace("{{店铺名称}}", userIdDistributors.StoreName);
                                    shareTitle         = shareTitle.Replace("{{店铺名称}}", userIdDistributors.StoreName);
                                }
                                else
                                {
                                    SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                                    description = description.Replace("{{店铺名称}}", masterSettings.SiteName);
                                    shareTitle  = shareTitle.Replace("{{店铺名称}}", masterSettings.SiteName);
                                }
                            }
                            if (shareTitle.Contains("{{微信昵称}}"))
                            {
                                shareTitle = shareTitle.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            if (description.Contains("{{微信昵称}}"))
                            {
                                description = description.Replace("{{微信昵称}}", currentMember.UserName);
                            }
                            string webUrlStart = Globals.GetWebUrlStart();
                            this.litItemParams.Text = string.Concat(new object[] { webUrlStart, act.ImgUrl, "|", shareTitle.Replace("|", "|"), "|", Globals.GetWebUrlStart(), "/Vshop/getredpager.aspx?id=", defaultView[0]["RedPagerActivityId"], "&userid=", currentMember.UserId, "&ReferralId=", Globals.GetCurrentDistributorId(), "|", description.Replace("|", "|") });
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx?t=1");
                    }
                }
                else
                {
                    orderRedPager = ShareActHelper.GetOrderRedPager(str, -100);
                    if (orderRedPager.Rows.Count > 0)
                    {
                        HttpContext.Current.Response.Redirect(string.Concat(new object[] { "/Vshop/getredpager.aspx?id=", orderRedPager.Rows[0]["RedPagerActivityId"].ToString(), "&userid=", currentMember.UserId, "&ReferralId=", Globals.GetCurrentDistributorId() }));
                        HttpContext.Current.Response.End();
                    }
                    else
                    {
                        HttpContext.Current.Response.Redirect("/vshop/MemberCenter.aspx?t=2");
                    }
                }
            }
            else
            {
                HttpContext.Current.Response.Redirect("/default.aspx");
                HttpContext.Current.Response.End();
            }
            PageTitle.AddSiteNameTitle("分享助力");
        }
Example #28
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);
        }
Example #29
0
        protected override void AttachChildControls()
        {
            PageTitle.AddSiteNameTitle("店铺推广");
            int        num           = Globals.RequestQueryNum("ReferralId");
            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if ((num > 0) && (currentMember == null))
            {
                this.Page.Response.Redirect("/default.aspx?ReferralId=" + num);
                this.Page.Response.End();
            }
            if (!int.TryParse(this.Page.Request.QueryString["UserId"], out this.userId))
            {
                base.GotoResourceNotFound("");
            }
            DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(this.userId);

            if (userIdDistributors == null)
            {
                base.GotoResourceNotFound("");
            }
            this.litStroeDesc = (Literal)this.FindControl("litStroeDesc");
            this.litLinkurl   = (Literal)this.FindControl("litLinkurl");
            this.litStoreurl  = (Literal)this.FindControl("litStoreurl");
            string urlToEncode = Globals.FullPath("/Default.aspx?ReferralId=" + this.userId);

            this.litLinkurl.Text  = urlToEncode;
            this.litStoreurl.Text = urlToEncode;
            this.Logoimage        = (Image)this.FindControl("Logoimage");
            this.storeCode        = (HtmlImage)this.FindControl("storeCode");
            this.storeFollowCode  = (HtmlImage)this.FindControl("storeFollowCode");
            if (!string.IsNullOrEmpty(userIdDistributors.Logo))
            {
                this.Logoimage.ImageUrl = Globals.HostPath(this.Page.Request.Url) + userIdDistributors.Logo;
            }
            else
            {
                userIdDistributors.Logo = "/Utility/pics/headLogo.jpg";
            }
            this.storeCode.Src       = "/Api/CreatQRCode.ashx?code=" + Globals.UrlEncode(urlToEncode) + "&Logo=" + userIdDistributors.Logo;
            this.storeFollowCode.Src = "";
            ScanInfos info = ScanHelp.GetScanInfosByUserId(this.userId, 0, "WX");

            if (info == null)
            {
                ScanHelp.CreatNewScan(this.userId, "WX", 0);
                info = ScanHelp.GetScanInfosByUserId(this.userId, 0, "WX");
            }
            string qRImageUrlByTicket = "";

            if (!((info == null) || string.IsNullOrEmpty(info.CodeUrl)))
            {
                qRImageUrlByTicket = BarCodeApi.GetQRImageUrlByTicket(info.CodeUrl);
            }
            else
            {
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(true);
                string       token          = TokenApi.GetToken_Message(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret);
                if (TokenApi.CheckIsRightToken(token))
                {
                    string str4 = BarCodeApi.CreateTicket(token, info.Sceneid, "QR_LIMIT_SCENE", "2592000");
                    if (!string.IsNullOrEmpty(str4))
                    {
                        qRImageUrlByTicket  = BarCodeApi.GetQRImageUrlByTicket(str4);
                        info.CodeUrl        = str4;
                        info.CreateTime     = DateTime.Now;
                        info.LastActiveTime = DateTime.Now;
                        ScanHelp.updateScanInfosCodeUrl(info);
                    }
                }
            }
            if (!string.IsNullOrEmpty(qRImageUrlByTicket))
            {
                this.storeFollowCode.Src = "/Api/CreatQRCode.ashx?Combin=" + Globals.UrlEncode(qRImageUrlByTicket) + "&Logo=" + userIdDistributors.Logo;
            }
            else
            {
                this.storeFollowCode.Src = "";
            }
            this.litStroeName      = (Literal)this.FindControl("litStroeName");
            this.litStroeName.Text = userIdDistributors.StoreName;
            this.litStroeDesc.Text = userIdDistributors.StoreDescription;
        }
Example #30
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>";
                }
            }
        }