Ejemplo n.º 1
0
        protected override void AttachChildControls()
        {
            this.litIsEnable    = (HtmlInputHidden)this.FindControl("litIsEnable");
            this.litIsMember    = (HtmlInputHidden)this.FindControl("litIsMember");
            this.litExpenditure = (HtmlInputHidden)this.FindControl("litExpenditure");
            this.litminMoney    = (HtmlInputHidden)this.FindControl("litminMoney");
            this.litProds       = (HtmlInputHidden)this.FindControl("litProds");
            this.litProdOK      = (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       = (HtmlInputHidden)this.FindControl("UserBindName");
                this.UserBindName.Value = currentMember.UserBindName;
                decimal expenditure = 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   num3 = 0M;
                    DataTable userOrderPaidWaitFinish = OrderHelper.GetUserOrderPaidWaitFinish(currentMemberUserId);
                    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;
                            }
                        }
                    }
                    expenditure += num3;
                    if (!masterSettings.DistributorApplicationCondition)
                    {
                        if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                        {
                            this.IsEnable = "2";
                        }
                        else
                        {
                            this.IsEnable = "4";
                        }
                    }
                    else
                    {
                        int finishedOrderMoney = masterSettings.FinishedOrderMoney;
                        this.litminMoney.Value = finishedOrderMoney.ToString();
                        if ((finishedOrderMoney > 0) && (expenditure >= finishedOrderMoney))
                        {
                            if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                            {
                                this.IsEnable = "2";
                            }
                            else
                            {
                                this.IsEnable = "4";
                            }
                        }
                        if (masterSettings.EnableDistributorApplicationCondition && !string.IsNullOrEmpty(masterSettings.DistributorProductsDate))
                        {
                            if (!string.IsNullOrEmpty(masterSettings.DistributorProducts))
                            {
                                this.litProds.Value = masterSettings.DistributorProducts;
                                if (masterSettings.DistributorProductsDate.Contains("|"))
                                {
                                    DateTime result = new DateTime();
                                    DateTime time2  = new DateTime();
                                    DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[0].ToString(), out result);
                                    DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[1].ToString(), out time2);
                                    if ((result.CompareTo(DateTime.Now) > 0) || (time2.CompareTo(DateTime.Now) < 0))
                                    {
                                        this.litProds.Value    = "";
                                        this.litIsEnable.Value = "0";
                                    }
                                    else if (MemberProcessor.CheckMemberIsBuyProds(currentMemberUserId, this.litProds.Value, new DateTime?(result), new DateTime?(time2)))
                                    {
                                        if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                                        {
                                            this.IsEnable        = "2";
                                            this.litProdOK.Value = "(已购买指定商品,在" + time2.ToString("yyyy-MM-dd") + "之前申请有效)";
                                        }
                                        else
                                        {
                                            this.IsEnable = "4";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                this.IsEnable = "6";
                            }
                        }
                    }
                }
                this.litExpenditure.Value = expenditure.ToString("F2");
            }
            else
            {
                this.litIsMember.Value = "0";
            }
            this.litIsEnable.Value = this.IsEnable;
            PageTitle.AddSiteNameTitle("申请分销商");
        }
Ejemplo n.º 2
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();
            }
        }
        protected override void AttachChildControls()
        {
            this.litAddTips          = (Literal)this.FindControl("litAddTips");
            this.litIsEnable         = (HtmlInputHidden)this.FindControl("litIsEnable");
            this.litIsMember         = (HtmlInputHidden)this.FindControl("litIsMember");
            this.litExpenditure      = (HtmlInputHidden)this.FindControl("litExpenditure");
            this.litMemberAmountPass = (HtmlInputHidden)this.FindControl("litMemberAmountPass");
            this.litminMoney         = (HtmlInputHidden)this.FindControl("litminMoney");
            this.litProds            = (HtmlInputHidden)this.FindControl("litProds");
            this.litProdOK           = (HtmlInputHidden)this.FindControl("litProdOK");
            int          currentMemberUserId = Globals.GetCurrentMemberUserId(false);
            SiteSettings masterSettings      = SettingsManager.GetMasterSettings(true);

            if (masterSettings.DistributorApplicationCondition && (masterSettings.RechargeMoneyToDistributor > 0M))
            {
                if (MemberAmountProcessor.GetUserMaxAmountDetailed(currentMemberUserId) >= masterSettings.RechargeMoneyToDistributor)
                {
                    this.IsMemberAmountPass = true;
                    this.litAddTips.Text    = "<li class=\"pl50\"><a href=\"/Vshop/MemberRecharge.aspx\" style=\"color:red\"><i class=\"iconfont icon-tubiaoweb09 mr5 pull-left\"></i>一次性预存" + masterSettings.RechargeMoneyToDistributor.ToString("F2").Replace(".00", "") + "元,即可成为分销商!</a><p class=\"success\">已达成</p></li>";
                }
                else
                {
                    this.litAddTips.Text = "<li class=\"pl50\"><a href=\"/Vshop/MemberRecharge.aspx\" style=\"color:red\"><i class=\"iconfont icon-tubiaoweb09 mr5 pull-left\"></i>一次性预存" + masterSettings.RechargeMoneyToDistributor.ToString("F2").Replace(".00", "") + "元,即可成为分销商!</a></li>";
                }
            }
            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       = (HtmlInputHidden)this.FindControl("UserBindName");
                this.UserBindName.Value = currentMember.UserBindName;
                decimal expenditure = 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
                {
                    if (VshopBrowser.IsPassAutoToDistributor(currentMember, true) && !SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                    {
                        DistributorsBrower.MemberAutoToDistributor(currentMember);
                        this.Page.Response.Redirect("/Vshop/DistributorCenter.aspx", true);
                        this.Page.Response.End();
                        return;
                    }
                    decimal   num4 = 0M;
                    DataTable userOrderPaidWaitFinish = OrderHelper.GetUserOrderPaidWaitFinish(currentMemberUserId);
                    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)
                            {
                                num4 += total;
                            }
                        }
                    }
                    expenditure += num4;
                    if (!masterSettings.DistributorApplicationCondition)
                    {
                        if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                        {
                            this.IsEnable = "2";
                        }
                        else
                        {
                            this.IsEnable = "4";
                        }
                    }
                    else
                    {
                        int finishedOrderMoney = masterSettings.FinishedOrderMoney;
                        this.litminMoney.Value = finishedOrderMoney.ToString();
                        if ((finishedOrderMoney > 0) && (expenditure >= finishedOrderMoney))
                        {
                            if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                            {
                                this.IsEnable = "2";
                            }
                            else
                            {
                                this.IsEnable = "4";
                            }
                        }
                        if (masterSettings.EnableDistributorApplicationCondition && !string.IsNullOrEmpty(masterSettings.DistributorProductsDate))
                        {
                            if (!string.IsNullOrEmpty(masterSettings.DistributorProducts))
                            {
                                this.litProds.Value = masterSettings.DistributorProducts;
                                if (masterSettings.DistributorProductsDate.Contains("|"))
                                {
                                    DateTime result = new DateTime();
                                    DateTime time2  = new DateTime();
                                    DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[0].ToString(), out result);
                                    DateTime.TryParse(masterSettings.DistributorProductsDate.Split(new char[] { '|' })[1].ToString(), out time2);
                                    if ((result.CompareTo(DateTime.Now) > 0) || (time2.CompareTo(DateTime.Now) < 0))
                                    {
                                        this.litProds.Value    = "";
                                        this.litIsEnable.Value = "0";
                                    }
                                    else if (MemberProcessor.CheckMemberIsBuyProds(currentMemberUserId, this.litProds.Value, new DateTime?(result), new DateTime?(time2)))
                                    {
                                        if (SystemAuthorizationHelper.CheckDistributorIsCanAuthorization())
                                        {
                                            this.IsEnable        = "2";
                                            this.litProdOK.Value = "(已购买指定商品,在" + time2.ToString("yyyy-MM-dd") + "之前申请有效)";
                                        }
                                        else
                                        {
                                            this.IsEnable = "4";
                                        }
                                    }
                                }
                            }
                            else
                            {
                                this.IsEnable = "6";
                            }
                        }
                    }
                }
                this.litExpenditure.Value = expenditure.ToString("F2");
                if (this.IsMemberAmountPass)
                {
                    this.litMemberAmountPass.Value = "1";
                }
            }
            else
            {
                this.litIsMember.Value = "0";
            }
            this.litIsEnable.Value = this.IsEnable;
            PageTitle.AddSiteNameTitle("申请分销商");
        }
Ejemplo n.º 4
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();
            }
        }