Example #1
0
        private static bool CheckGroupReadToRun(ProductGroupBuyingEntity groupBuyingItem, bool isAbandon)
        {
            //如果团购类型为抽奖(6),则不需下列操作
            if (groupBuyingItem.GroupBuyingTypeSysNo == 6)
            {
                return(true);
            }

            //读取原价
            decimal originalPrice    = GroupBuyingDA.GetOriginalPrice(groupBuyingItem.ProductSysNo, groupBuyingItem.IsByGroup);
            decimal groupBuyingPrice = 0;
            List <ProductGroupBuying_PriceEntity> gbPriceList = GroupBuyingDA.GetProductGroupBuying_PriceList(groupBuyingItem);

            bool result = true;

            foreach (ProductGroupBuying_PriceEntity gbPrice in gbPriceList)
            {
                if (originalPrice <= gbPrice.GroupBuyingPrice)
                {
                    groupBuyingPrice = gbPrice.GroupBuyingPrice;
                    result           = false;
                }
            }

            //Check不通过需要发送邮件
            if (!result)
            {
                string mailtype = "";

                if (isAbandon)
                {
                    mailtype = "已被系统自动作废";
                    SetAbandon(groupBuyingItem);
                }
                else
                {
                    mailtype = "一小时后将被系统自动作废,请修改团购信息";
                }

                string mailTo      = GroupBuyingDA.GetUserEmailByUserName(groupBuyingItem.InUser);
                string mailSubject = string.Format("团购商品{0}Item# " + groupBuyingItem.ProductID, mailtype);


                StringBuilder mailInfo = new StringBuilder();

                mailInfo.AppendLine("Hi 创建人、PMCC:");
                mailInfo.AppendLine(string.Format("   商品" + groupBuyingItem.ProductID + "的团购价" + groupBuyingPrice.ToString("0.00") + "大于等于了原价" + originalPrice.ToString("0.00") + ",{0}。", mailtype));
                mailInfo.AppendLine("该邮件由系统自动发出,请勿回复!");
                mailInfo.AppendLine("其中" + groupBuyingPrice.ToString("0.00") + "为团购价;" + originalPrice.ToString("0.00") + "为原价;");


                GroupBuyingDA.SendMailAbandonGroupBuyingInfo(mailTo, mailInfo.ToString(), mailSubject);
            }

            return(result);
        }