예제 #1
0
        public static void DistributorGradeChange(DistributorsInfo distributor, string orderid, int newDistributorGradeid)
        {
            DistributorGradeInfo distributorGradeInfo = DistributorGradeBrower.GetDistributorGradeInfo(newDistributorGradeid);

            if (distributorGradeInfo != null && distributorGradeInfo.AddCommission > 0m)
            {
                try
                {
                    MemberInfo member = MemberProcessor.GetMember(distributor.UserId, true);
                    Messenger.SendWeiXinMsg_DistributorGradeChange(member, distributorGradeInfo.Name);
                }
                catch
                {
                }
                SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
                if (masterSettings.IsAddCommission == 1)
                {
                    try
                    {
                        DateTime t  = DateTime.Parse(masterSettings.AddCommissionStartTime);
                        DateTime t2 = DateTime.Parse(masterSettings.AddCommissionEndTime).AddDays(1.0);
                        if (DateTime.Now > t && DateTime.Now < t2)
                        {
                            decimal num = distributor.ReferralRequestBalance + distributor.ReferralBlance;
                            DistributorGradeCommissionInfo distributorGradeCommissionInfo = new DistributorGradeCommissionInfo();
                            distributorGradeCommissionInfo.UserId             = distributor.UserId;
                            distributorGradeCommissionInfo.Commission         = distributorGradeInfo.AddCommission;
                            distributorGradeCommissionInfo.PubTime            = DateTime.Now;
                            distributorGradeCommissionInfo.OperAdmin          = "system";
                            distributorGradeCommissionInfo.Memo               = "升级奖励";
                            distributorGradeCommissionInfo.OrderID            = orderid;
                            distributorGradeCommissionInfo.OldCommissionTotal = num;
                            if (!string.IsNullOrEmpty(distributorGradeCommissionInfo.OrderID))
                            {
                                distributorGradeCommissionInfo.ReferralUserId = new OrderDao().GetOrderReferralUserId(distributorGradeCommissionInfo.OrderID);
                            }
                            else
                            {
                                distributorGradeCommissionInfo.OrderID = "U" + DistributorsBrower.GenerateOrderId();
                            }
                            distributorGradeCommissionInfo.CommType = 3;
                            if (distributorGradeCommissionInfo.ReferralUserId == 0)
                            {
                                distributorGradeCommissionInfo.ReferralUserId = distributorGradeCommissionInfo.UserId;
                                distributorGradeCommissionInfo.CommType       = 4;
                            }
                            DistributorGradeCommissionBrower.AddCommission(distributorGradeCommissionInfo);
                            NoticeInfo noticeInfo = new NoticeInfo();
                            noticeInfo.Title = "恭喜分销商获得升级奖励佣金¥" + distributorGradeInfo.AddCommission.ToString("F2");
                            StringBuilder stringBuilder = new StringBuilder();
                            stringBuilder.Append(string.Concat(new string[]
                            {
                                "<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>"
                            }));
                            stringBuilder.Append(string.Concat(new string[]
                            {
                                "<p class='textlist'>自",
                                t.ToString("yyyy年MM月dd日"),
                                "至",
                                t2.ToString("yyyy年MM月dd日"),
                                ",分销商等级提升将获得系统奖励的额外佣金。</p>"
                            }));
                            stringBuilder.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>");
                            System.Data.DataTable allDistributorGrade = DistributorGradeBrower.GetAllDistributorGrade();
                            int count = allDistributorGrade.Rows.Count;
                            for (int i = 0; i < count; i++)
                            {
                                stringBuilder.Append(string.Concat(new string[]
                                {
                                    "<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>"
                                }));
                            }
                            stringBuilder.Append("</tbody></table>");
                            noticeInfo.Memo     = stringBuilder.ToString();
                            noticeInfo.Author   = "system";
                            noticeInfo.AddTime  = DateTime.Now;
                            noticeInfo.IsPub    = 1;
                            noticeInfo.PubTime  = new DateTime?(DateTime.Now);
                            noticeInfo.SendType = 0;
                            noticeInfo.SendTo   = 0;
                            NoticeBrowser.SaveNotice(noticeInfo);
                        }
                    }
                    catch (Exception ex)
                    {
                        Globals.Debuglog("升级奖励异常" + ex.Message, "_Debuglog.txt");
                    }
                }
            }
        }
예제 #2
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");
                    }
                }
            }
        }