⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 order.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
        {
            return dal.GoRubbish(orderId);
        }

        private static void ProcessSubscriber(OrderFlowInfo orderFlowInfo, UserInfo userInfo)
        {
            if (!userInfo.IsNull)
            {
                ClientInfo clientInfo = new ClientInfo();
                CompanyInfo companyInfo = new CompanyInfo();
                ContacterInfo contacterInfo = new ContacterInfo();
                if ((userInfo.UserId > 0) && (userInfo.ClientId == 0))
                {
                    if (userInfo.UserType > UserType.Persional)
                    {
                        companyInfo = Company.GetCompayById(userInfo.CompanyId);
                        if (!companyInfo.IsNull)
                        {
                            string companyName = companyInfo.CompanyName;
                            companyName = string.IsNullOrEmpty(companyName) ? string.Empty : companyName;
                            clientInfo.ClientName = companyInfo.CompanyName;
                            clientInfo.ShortedForm = companyInfo.CompanyName.Substring(0, 6);
                            clientInfo.ClientType = 0;
                        }
                    }
                    else
                    {
                        clientInfo.ClientName = orderFlowInfo.ConsigneeName;
                        clientInfo.ShortedForm = orderFlowInfo.ConsigneeName;
                        clientInfo.ClientType = 1;
                    }
                    clientInfo.ClientId = companyInfo.ClientId = userInfo.ClientId = Client.GetMaxId() + 1;
                    clientInfo.ClientNum = Client.GetClientNum();
                    clientInfo.Area = -1;
                    clientInfo.ClientField = -1;
                    clientInfo.ValueLevel = -1;
                    clientInfo.CreditLevel = -1;
                    clientInfo.Importance = -1;
                    clientInfo.ConnectionLevel = -1;
                    clientInfo.SourceType = -1;
                    clientInfo.PhaseType = -1;
                    clientInfo.UpdateTime = clientInfo.CreateTime = DateTime.Now;
                    Client.Add(clientInfo);
                    userInfo.ClientId = clientInfo.ClientId;
                    Users.Update(userInfo);
                    Company.Update(companyInfo);
                    Contacter.UpdateClientForSameCompany(clientInfo.ClientId, userInfo.CompanyId);
                }
                if (userInfo.UserId > 0)
                {
                    StringBuilder builder = new StringBuilder();
                    if (orderFlowInfo.Country != "中华人民共和国")
                    {
                        builder.Append(orderFlowInfo.Country);
                    }
                    builder.Append(orderFlowInfo.Province);
                    builder.Append(orderFlowInfo.City);
                    builder.Append(orderFlowInfo.Area);
                    builder.Append(orderFlowInfo.Address);
                    if (!Contacter.Exists(userInfo.UserName))
                    {
                        contacterInfo.ContacterId = Contacter.GetMaxId() + 1;
                        contacterInfo.UserName = userInfo.UserName;
                        contacterInfo.ClientId = userInfo.ClientId;
                        contacterInfo.CreateTime = contacterInfo.UpdateTime = DateTime.Now;
                        contacterInfo.TrueName = orderFlowInfo.ConsigneeName;
                        contacterInfo.ZipCode = orderFlowInfo.ZipCode;
                        contacterInfo.Address = builder.ToString();
                        contacterInfo.Mobile = orderFlowInfo.Mobile;
                        contacterInfo.OfficePhone = contacterInfo.HomePhone = orderFlowInfo.HomePhone;
                        contacterInfo.Email = orderFlowInfo.Email;
                        contacterInfo.Education = -1;
                        contacterInfo.Income = -1;
                        contacterInfo.Sex = UserSexType.Secrecy;
                        contacterInfo.Marriage = UserMarriageType.Secrecy;
                        contacterInfo.Country = orderFlowInfo.Country;
                        contacterInfo.Province = orderFlowInfo.Province;
                        contacterInfo.City = orderFlowInfo.City;
                        Contacter.Add(contacterInfo);
                    }
                    else
                    {
                        contacterInfo = Contacter.GetContacterByUserName(userInfo.UserName);
                        if (!contacterInfo.IsNull)
                        {
                            if (contacterInfo.ClientId <= 0)
                            {
                                contacterInfo.ClientId = userInfo.ClientId;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.TrueName))
                            {
                                contacterInfo.TrueName = orderFlowInfo.ConsigneeName;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.ZipCode))
                            {
                                contacterInfo.ZipCode = orderFlowInfo.ZipCode;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.Address))
                            {
                                contacterInfo.Address = builder.ToString();
                            }
                            if (string.IsNullOrEmpty(contacterInfo.Mobile))
                            {
                                contacterInfo.Mobile = orderFlowInfo.Mobile;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.HomePhone))
                            {
                                contacterInfo.HomePhone = orderFlowInfo.HomePhone;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.Email))
                            {
                                contacterInfo.Email = orderFlowInfo.Email;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.Country))
                            {
                                contacterInfo.Country = orderFlowInfo.Country;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.Province))
                            {
                                contacterInfo.Province = orderFlowInfo.Province;
                            }
                            if (string.IsNullOrEmpty(contacterInfo.City))
                            {
                                contacterInfo.City = orderFlowInfo.City;
                            }
                            Contacter.Update(contacterInfo);
                        }
                    }
                    AddressInfo defaultAddressByUserName = Address.GetDefaultAddressByUserName(userInfo.UserName);
                    if (defaultAddressByUserName.IsNull)
                    {
                        defaultAddressByUserName.UserName = userInfo.UserName;
                        defaultAddressByUserName.Address = orderFlowInfo.Address;
                        defaultAddressByUserName.Area = orderFlowInfo.Area;
                        defaultAddressByUserName.City = orderFlowInfo.City;
                        defaultAddressByUserName.ConsigneeName = orderFlowInfo.ConsigneeName;
                        defaultAddressByUserName.Country = orderFlowInfo.Country;
                        defaultAddressByUserName.Province = orderFlowInfo.Province;
                        defaultAddressByUserName.HomePhone = orderFlowInfo.HomePhone;
                        defaultAddressByUserName.Mobile = orderFlowInfo.Mobile;
                        defaultAddressByUserName.ZipCode = orderFlowInfo.ZipCode;
                        defaultAddressByUserName.IsDefault = true;
                        Address.Add(defaultAddressByUserName);
                    }
                }
            }
        }

        public static bool Recieve(int orderId)
        {
            DeliverItem.UpdateReceive(orderId);
            return dal.Recieve(orderId);
        }

        public static bool SendCard(int orderId)
        {
            bool flag = true;
            bool flag2 = false;
            StringBuilder content = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();
            IList<OrderItemInfo> infoListByOrderId = OrderItem.GetInfoListByOrderId(orderId);
            int num = 0;
            StockInfo stockInfo = new StockInfo();
            stockInfo.Inputer = PEContext.Current.Admin.AdminName;
            stockInfo.InputTime = DateTime.Now;
            stockInfo.Remark = "交付点卡";
            stockInfo.StockId = StockManage.GetMaxId() + 1;
            stockInfo.StockNum = StockItem.GetShipmentNum();
            stockInfo.StockType = StockType.Shipment;
            foreach (OrderItemInfo info2 in infoListByOrderId)
            {
                if (Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Card) && Cards.GetCardByOrderItemId(info2.ProductId, info2.TableName, info2.ItemId).IsNull)
                {
                    IList<CardInfo> list2 = Cards.GetUnsoldCard(info2.TableName, info2.ProductId, info2.Amount);
                    if (list2.Count < info2.Amount)
                    {
                        builder2.Append("<li>" + info2.ProductName + "的充值卡数量已经不够交付!请先去充值卡管理中添加有关充值卡!</li>");
                        flag = false;
                    }
                    else
                    {
                        foreach (CardInfo info4 in list2)
                        {
                            info4.OrderItemId = info2.ItemId;
                            if (!Cards.Update(info4))
                            {
                                return false;
                            }
                            GetMessageOrMailofCard(content, info4, info2.ProductName);
                        }
                        AddStockItemBySendCard(stockInfo.StockId, info2);
                        num++;
                    }
                }
                if (!flag2 && Product.CharacterIsExists(info2.ProductCharacter, ProductCharacter.Practicality))
                {
                    flag2 = true;
                }
            }
            if (num > 0)
            {
                StockManage.Add(stockInfo);
            }
            if (flag)
            {
                if (!flag2)
                {
                    OrderInfo orderById = GetOrderById(orderId);
                    if (!orderById.IsNull)
                    {
                        orderById.DeliverStatus = DeliverStatus.Consignment;
                        Update(orderById);
                    }
                }
            }
            else
            {
                CustomException.ThrowBllException(builder2.ToString());
            }
            m_MessgeOrMailContentOfCard = GetMessageOrMailofCard(content.ToString()).ToString();
            return flag;
        }

        public static bool Transfer(int orderId, int clientId, string userName)
        {
            return dal.Transfer(orderId, clientId, userName);
        }

        public static bool Update(OrderInfo orderInfo)
        {
            return dal.Update(DoHtmlEncode(orderInfo));
        }

        public static bool UpdateDeliverStatus(int orderId, DeliverStatus statusValue)
        {
            return dal.UpdateDeliverStatus(orderId, statusValue);
        }

        public static void UpdateOrderInfo(OrderInfo orderInfo, IList<OrderItemInfo> orderItemInfoList)
        {
            decimal totalMoney = 0M;
            double goodsWeight = 0.0;
            decimal num3 = 0M;
            foreach (OrderItemInfo info in orderItemInfoList)
            {
                totalMoney += info.SubTotal;
                goodsWeight += DataConverter.CDouble(info.Weight) * info.Amount;
            }
            orderInfo.MoneyGoods = totalMoney;
            PackageInfo packageByGoodsWeight = Package.GetPackageByGoodsWeight(goodsWeight);
            if (!packageByGoodsWeight.IsNull)
            {
                goodsWeight += packageByGoodsWeight.PackageWeight;
            }
            num3 = DeliverCharge.GetDeliverCharge(orderInfo.DeliverType, goodsWeight, orderInfo.ZipCode, totalMoney, orderInfo.NeedInvoice);
            if (num3 > 0M)
            {
                totalMoney += num3;
            }
            orderInfo.MoneyTotal = totalMoney;
            orderInfo.ChargeDeliver = num3;
            Update(orderInfo);
        }

        private static void UpdateUserInfo(OrderInfo orderinfo, int TotalPresentExp, int TotalPresentPoint, int TotalPresentMoney)
        {
            if ((((orderinfo.PresentExp != 0) || (orderinfo.PresentMoney != 0M)) || ((orderinfo.PresentPoint != 0) || (TotalPresentExp != 0))) || ((TotalPresentMoney != 0) || (TotalPresentPoint != 0)))
            {
                UserInfo usersByUserName = Users.GetUsersByUserName(orderinfo.UserName);
                if ((orderinfo.PresentMoney > 0M) || (TotalPresentMoney > 0))
                {
                    usersByUserName.Balance = (usersByUserName.Balance + orderinfo.PresentMoney) + TotalPresentMoney;
                    BankrollItemInfo bankrollItemInfo = new BankrollItemInfo();
                    bankrollItemInfo.Inputer = "";
                    bankrollItemInfo.UserName = orderinfo.UserName;
                    bankrollItemInfo.ClientId = orderinfo.ClientId;
                    bankrollItemInfo.Money = orderinfo.PresentMoney + TotalPresentMoney;
                    bankrollItemInfo.MoneyType = 4;
                    bankrollItemInfo.Bank = "";
                    bankrollItemInfo.EBankId = 0;
                    bankrollItemInfo.OrderId = orderinfo.OrderId;
                    bankrollItemInfo.PaymentId = 0;
                    bankrollItemInfo.Remark = "购物返还现金券";
                    bankrollItemInfo.LogTime = new DateTime?(DateTime.Now);
                    bankrollItemInfo.DateAndTime = new DateTime?(DateTime.Now);
                    bankrollItemInfo.CurrencyType = 1;
                    BankrollItem.Add(bankrollItemInfo);
                }
                if ((orderinfo.PresentExp > 0) || (TotalPresentExp > 0))
                {
                    usersByUserName.UserExp = (usersByUserName.UserExp + orderinfo.PresentExp) + TotalPresentExp;
                }
                if ((orderinfo.PresentPoint > 0) || (TotalPresentPoint > 0))
                {
                    usersByUserName.UserPoint = (usersByUserName.UserPoint + orderinfo.PresentPoint) + TotalPresentPoint;
                    UserPointLogInfo userPointLogInfo = new UserPointLogInfo();
                    userPointLogInfo.UserName = usersByUserName.UserName;
                    userPointLogInfo.IncomePayOut = 1;
                    userPointLogInfo.LogTime = DateTime.Now;
                    userPointLogInfo.Point = orderinfo.PresentPoint + TotalPresentPoint;
                    userPointLogInfo.Remark = "购物返还" + SiteConfig.UserConfig.PointName;
                    UserPointLog.Add(userPointLogInfo);
                }
                Users.Update(usersByUserName);
            }
        }

        public static bool UserPayment(int orderId, decimal moneyReceipt, OrderStatus status)
        {
            return dal.UserPayment(orderId, moneyReceipt, status);
        }

        public static string MessgeOrMailContentOfCard
        {
            get
            {
                return m_MessgeOrMailContentOfCard;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -