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

📄 order.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
        public ArrayList GetTotalofMoneyAndReceiptByUserName(string userName)
        {
            string sqlString = "select Isnull(sum(MoneyTotal),0) , Isnull(sum(MoneyReceipt),0) from PE_Orders Where UserName=@UserName";
            return GetDataofExecute(sqlString, new Parameters("@UserName", DbType.String, userName));
        }

        public int GetTotalOfOrder()
        {
            return this.m_TotalOfOrder;
        }

        public ArrayList GetTotalofthisMoneyAndReceipt(string field)
        {
            ArrayList list = new ArrayList();
            if (string.IsNullOrEmpty(m_ThisSearchCondition))
            {
                list.Add("search error");
                list.Add("search error");
                return list;
            }
            string str = "";
            string str3 = field;
            if (str3 != null)
            {
                if (!(str3 == "ClientName"))
                {
                    if (str3 == "ProductName")
                    {
                        str = "PE_CommonProduct P inner join (PE_OrderItem I inner join PE_Orders O on I.OrderID = O.OrderID) on P.ProductID = I.ProductID and P.TableName = I.TableName";
                        goto Label_007E;
                    }
                    if (str3 == "QQ")
                    {
                        str = "PE_Contacter T inner join PE_Orders O on T.ClientID = O.ClientID";
                        goto Label_007E;
                    }
                }
                else
                {
                    str = "PE_Orders O inner join PE_Client C on O.ClientID = C.ClientID";
                    goto Label_007E;
                }
            }
            str = "PE_Orders O";
        Label_007E:
            return GetDataofExecute("select Isnull(sum(O.MoneyTotal),0),Isnull(sum(O.MoneyReceipt),0) from " + str + " where " + m_ThisSearchCondition, null);
        }

        private static DbCommand GetUpdateComm(Database db, string proName, OrderInfo orderInfo)
        {
            DbCommand storedProcCommand = db.GetStoredProcCommand(proName);
            db.AddInParameter(storedProcCommand, "@OrderID", DbType.Int32, orderInfo.OrderId);
            db.AddInParameter(storedProcCommand, "@ContacterName", DbType.String, orderInfo.ContacterName);
            db.AddInParameter(storedProcCommand, "@UserName", DbType.String, orderInfo.UserName);
            db.AddInParameter(storedProcCommand, "@AgentName", DbType.String, orderInfo.AgentName);
            db.AddInParameter(storedProcCommand, "@Functionary", DbType.String, orderInfo.Functionary);
            db.AddInParameter(storedProcCommand, "@MoneyTotal", DbType.Currency, orderInfo.MoneyTotal);
            db.AddInParameter(storedProcCommand, "@MoneyGoods", DbType.Currency, orderInfo.MoneyGoods);
            db.AddInParameter(storedProcCommand, "@NeedInvoice", DbType.Boolean, orderInfo.NeedInvoice);
            db.AddInParameter(storedProcCommand, "@InvoiceContent", DbType.String, orderInfo.InvoiceContent);
            db.AddInParameter(storedProcCommand, "@Remark", DbType.String, orderInfo.Remark);
            db.AddInParameter(storedProcCommand, "@BeginDate", DbType.DateTime, orderInfo.BeginDate);
            db.AddInParameter(storedProcCommand, "@Address", DbType.String, orderInfo.Address);
            db.AddInParameter(storedProcCommand, "@ZipCode", DbType.String, orderInfo.ZipCode);
            db.AddInParameter(storedProcCommand, "@Mobile", DbType.String, orderInfo.Mobile);
            db.AddInParameter(storedProcCommand, "@Phone", DbType.String, orderInfo.Phone);
            db.AddInParameter(storedProcCommand, "@Email", DbType.String, orderInfo.Email);
            db.AddInParameter(storedProcCommand, "@PaymentType", DbType.Int32, orderInfo.PaymentType);
            db.AddInParameter(storedProcCommand, "@DeliverType", DbType.Int32, orderInfo.DeliverType);
            db.AddInParameter(storedProcCommand, "@Discount_Payment", DbType.Double, orderInfo.DiscountPayment);
            db.AddInParameter(storedProcCommand, "@Charge_Deliver", DbType.Currency, orderInfo.ChargeDeliver);
            db.AddInParameter(storedProcCommand, "@Status", DbType.Int32, (int) orderInfo.Status);
            db.AddInParameter(storedProcCommand, "@PresentMoney", DbType.Currency, orderInfo.PresentMoney);
            db.AddInParameter(storedProcCommand, "@PresentPoint", DbType.Int32, orderInfo.PresentPoint);
            db.AddInParameter(storedProcCommand, "@PresentExp", DbType.Int32, orderInfo.PresentExp);
            db.AddInParameter(storedProcCommand, "@MoneyReceipt", DbType.Currency, orderInfo.MoneyReceipt);
            db.AddInParameter(storedProcCommand, "@DeliverStatus", DbType.Int32, (int) orderInfo.DeliverStatus);
            db.AddInParameter(storedProcCommand, "@EnableDownload", DbType.Boolean, orderInfo.EnableDownload);
            db.AddInParameter(storedProcCommand, "@Memo", DbType.String, orderInfo.Memo);
            db.AddInParameter(storedProcCommand, "@OutOfStockProject", DbType.Int32, (int) orderInfo.OutOfStockProject);
            db.AddInParameter(storedProcCommand, "@OrderType", DbType.Int32, orderInfo.OrderType);
            db.AddInParameter(storedProcCommand, "@CouponID", DbType.Int32, orderInfo.CouponId);
            db.AddInParameter(storedProcCommand, "@InputTime", DbType.DateTime, orderInfo.InputTime);
            return storedProcCommand;
        }

        private static UserOrderCommonInfo GetUserOrderCommonInfo(NullableDataReader rdr)
        {
            UserOrderCommonInfo info = new UserOrderCommonInfo();
            info.ProductId = rdr.GetInt32("ProductId");
            info.TableName = rdr.GetString("TableName");
            info.ProductName = rdr.GetString("ProductName");
            info.Unit = rdr.GetString("Unit");
            info.Amount = rdr.GetInt32("Amount");
            info.BeginDate = rdr.GetDateTime("BeginDate");
            info.Price = rdr.GetDecimal("Price");
            info.TruePrice = rdr.GetDecimal("TruePrice");
            info.ServiceTerm = rdr.GetInt32("ServiceTerm");
            info.Remark = rdr.GetString("Remark");
            info.ServiceTermUnit = (ServiceTermUnit) rdr.GetInt32("ServiceTermUnit");
            info.OrderItemId = rdr.GetInt32("ItemId");
            return info;
        }

        public bool GoPause(int orderId)
        {
            return DBHelper.ExecuteSql("update PE_Orders set Status=4 where OrderID=@OrderID", new Parameters("@OrderID", DbType.Int32, orderId));
        }

        public bool GoRubbish(int orderId)
        {
            return DBHelper.ExecuteSql("update PE_Orders set Status=3 where OrderID=@OrderID", new Parameters("@OrderID", DbType.Int32, orderId));
        }

        private static string HighLevelSearch(string field, string keyword)
        {
            string str = "";
            if (!string.IsNullOrEmpty(keyword))
            {
                switch (field)
                {
                    case "OrderNum":
                        str = "O.OrderNum like '%" + keyword + "%' ";
                        break;

                    case "ClientName":
                        str = "C.ClientName like '%" + keyword + "%' or C.ShortedForm like '%" + keyword + "%' ";
                        break;

                    case "UserName":
                        str = "O.UserName like '%" + keyword + "%' ";
                        break;

                    case "RealUserName":
                        str = "O.UserName='" + keyword + "' and O.Status != 3 and O.Status !=4";
                        break;

                    case "AgentName":
                        str = "O.AgentName ='" + keyword + "'";
                        break;

                    case "ContacterName":
                        str = "O.ContacterName like '%" + keyword + "%' ";
                        break;

                    case "Address":
                        str = "O.Address like '%" + keyword + "%' ";
                        break;

                    case "Phone":
                        str = "O.Phone like '%" + keyword + "%' ";
                        break;

                    case "DateAndTime":
                        str = "datediff( dd ,O.InputTime,'" + keyword + "') = 0 ";
                        break;

                    case "Remark":
                        str = "O.Remark like '%" + keyword + "%' ";
                        break;

                    case "ProductName":
                        str = "P.ProductName like '%" + keyword + "%' ";
                        break;

                    case "QQ":
                        str = "T.QQ ='" + keyword + "'";
                        break;

                    case "Email":
                        str = "O.Email like '%" + keyword + "%' ";
                        break;

                    case "Mobile":
                        str = "O.Mobile like '%" + keyword + "%' ";
                        break;

                    case "InvoiceContent":
                        str = "O.InvoiceContent like '%" + keyword + "%' ";
                        break;

                    case "Memo":
                        str = "O.Memo like '%" + keyword + "%' ";
                        break;

                    case "Functionary":
                        str = "O.Functionary like '%" + keyword + "%' ";
                        break;
                }
            }
            m_ThisSearchCondition = str;
            return str;
        }

        private static bool NullProductName(string keyword)
        {
            return (!string.IsNullOrEmpty(keyword) && !string.IsNullOrEmpty(keyword.Split(new char[] { '|' })[0x12]));
        }

        private static OrderInfo OrderFromrdr(NullableDataReader rdr, string action)
        {
            OrderInfo info = new OrderInfo();
            info.OrderId = rdr.GetInt32("OrderID");
            info.OrderNum = rdr.GetString("OrderNum");
            info.UserName = rdr.GetString("UserName");
            info.ClientId = rdr.GetInt32("ClientID");
            info.ClientName = rdr.GetString("ClientName");
            info.MoneyTotal = rdr.GetDecimal("MoneyTotal");
            info.NeedInvoice = rdr.GetBoolean("NeedInvoice");
            info.Invoiced = rdr.GetBoolean("Invoiced");
            info.Remark = rdr.GetString("Remark");
            info.MoneyReceipt = rdr.GetDecimal("MoneyReceipt");
            info.InputTime = rdr.GetDateTime("InputTime");
            info.Status = (OrderStatus) rdr.GetInt32("Status");
            info.DeliverStatus = (DeliverStatus) rdr.GetInt32("DeliverStatus");
            if (string.IsNullOrEmpty(action))
            {
                info.EnableDownload = rdr.GetBoolean("EnableDownload");
                info.PresentMoney = rdr.GetDecimal("PresentMoney");
                info.PresentPoint = rdr.GetInt32("PresentPoint");
                info.PresentExp = rdr.GetInt32("PresentExp");
                info.DiscountPayment = rdr.GetDouble("Discount_Payment");
                info.ChargeDeliver = rdr.GetDecimal("Charge_Deliver");
            }
            info.AgentName = rdr.GetString("AgentName");
            info.Functionary = rdr.GetString("Functionary");
            info.InvoiceContent = rdr.GetString("InvoiceContent");
            info.BeginDate = rdr.GetDateTime("BeginDate");
            info.ContacterName = rdr.GetString("ContacterName");
            info.Address = rdr.GetString("Address");
            info.ZipCode = rdr.GetString("ZipCode");
            info.Mobile = rdr.GetString("Mobile");
            info.Phone = rdr.GetString("Phone");
            info.Email = rdr.GetString("Email");
            info.PaymentType = rdr.GetInt32("PaymentType");
            info.DeliverType = rdr.GetInt32("DeliverType");
            info.Memo = rdr.GetString("Memo");
            info.OutOfStockProject = (OutOfStockProject) rdr.GetInt32("OutOfStockProject");
            info.OrderType = rdr.GetInt32("OrderType");
            info.CouponId = rdr.GetInt32("CouponID");
            return info;
        }

        public bool Recieve(int orderId)
        {
            Parameters cmdParams = new Parameters();
            cmdParams.AddInParameter("@OrderID", DbType.Int32, orderId);
            return DBHelper.ExecuteSql("update PE_Orders set DeliverStatus=2 where OrderID=@OrderID", cmdParams);
        }

        public bool Transfer(int orderId, int clientId, string userName)
        {
            Parameters cmdParams = new Parameters();
            cmdParams.AddInParameter("@OrderID", DbType.Int32, orderId);
            cmdParams.AddInParameter("@ClientID", DbType.Int32, clientId);
            cmdParams.AddInParameter("@UserName", DbType.String, userName);
            return DBHelper.ExecuteSql("update PE_Orders set ClientID = @ClientID, UserName = @UserName where OrderID=@OrderID", cmdParams);
        }

        public bool Update(OrderInfo orderInfo)
        {
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand command = GetUpdateComm(db, "PR_Shop_Order_Update", orderInfo);
            try
            {
                return (db.ExecuteNonQuery(command) > 0);
            }
            catch
            {
                return false;
            }
        }

        public bool UpdateDeliverStatus(int orderId, DeliverStatus statusValue)
        {
            Parameters cmdParams = new Parameters();
            cmdParams.AddInParameter("@OrderID", DbType.Int32, orderId);
            cmdParams.AddInParameter("@DeliverStatus", DbType.Int32, (int) statusValue);
            return DBHelper.ExecuteSql("update PE_Orders set DeliverStatus=@DeliverStatus where OrderID = @OrderId", cmdParams);
        }

        public bool UserPayment(int orderId, decimal moneyReceipt, OrderStatus status)
        {
            Parameters cmdParams = new Parameters();
            cmdParams.AddInParameter("@OrderID", DbType.Int32, orderId);
            cmdParams.AddInParameter("@MoneyReceipt", DbType.Decimal, moneyReceipt);
            cmdParams.AddInParameter("@Status", DbType.Int32, (int) status);
            return DBHelper.ExecuteSql("update PE_Orders set MoneyReceipt=@MoneyReceipt,Status=@Status where OrderID=@OrderID", cmdParams);
        }
    }
}

⌨️ 快捷键说明

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