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

📄 order.cs

📁 动易SiteFactory&#8482 网上商店系统1.0源代码
💻 CS
📖 第 1 页 / 共 3 页
字号:

                case "4":
                    str = "O.Status=0";
                    m_ThisSearchCondition = "Status=0";
                    return str;

                case "5":
                    str = "O.MoneyTotal>0 and O.MoneyReceipt=0 and O.Status != 3";
                    m_ThisSearchCondition = "MoneyTotal>0 and MoneyReceipt=0  and Status != 3";
                    return str;

                case "6":
                    str = "O.MoneyTotal>O.MoneyReceipt  and O.Status != 3";
                    m_ThisSearchCondition = "MoneyTotal > MoneyReceipt  and Status != 3";
                    return str;

                case "7":
                    str = "O.MoneyTotal<=O.MoneyReceipt and O.DeliverStatus<1  and O.Status != 3";
                    m_ThisSearchCondition = "MoneyTotal<=MoneyReceipt and DeliverStatus<1  and Status != 3";
                    return str;

                case "8":
                    str = "O.MoneyTotal<=O.MoneyReceipt and O.DeliverStatus=1";
                    m_ThisSearchCondition = "MoneyTotal<=MoneyReceipt and DeliverStatus=1";
                    return str;

                case "9":
                    str = "O.NeedInvoice=1 and O.Invoiced=0 and O.Status != 3";
                    m_ThisSearchCondition = "NeedInvoice=1 and Invoiced=0 and Status != 3";
                    return str;

                case "11":
                    str = "O.MoneyTotal<=O.MoneyReceipt and O.DeliverStatus=2 and O.Status>0 and O.Status<2";
                    m_ThisSearchCondition = "MoneyTotal<=MoneyReceipt and DeliverStatus=2 and Status>0 and Status<2";
                    return str;

                case "12":
                    str = "O.Status=2";
                    m_ThisSearchCondition = "Status=2";
                    return str;

                case "13":
                    str = "O.DeliverStatus = 1";
                    m_ThisSearchCondition = "DeliverStatus = 1";
                    return str;

                case "14":
                    str = "O.DeliverStatus = 2";
                    m_ThisSearchCondition = "DeliverStatus = 2";
                    return str;

                case "15":
                    return ("O.ClientID =" + keyword);

                case "16":
                    return "O.Status=3";

                case "17":
                    return "O.Status=4";

                case "18":
                    return ("O.Functionary='" + PEContext.Current.Admin.AdminName + "'");

                case "19":
                    return ("O.UserName='" + keyword + "'");

                case "10":
                    return HighLevelSearch(field, keyword);

                case "20":
                    return ComplexSearch(keyword);
            }
            return str;
        }

        public string GetLastFunctionary()
        {
            string str = "";
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql("select top 1 Functionary from PE_Orders where Functionary<>''order by OrderID Desc"))
            {
                if (reader.Read())
                {
                    str = reader.GetString("Functionary");
                }
            }
            return str;
        }

        public IList<OrderInfo> GetList(int startRowIndexId, int maxNumberRows, string searchType, string field, string keyword, string action)
        {
            string str;
            string str2;
            Database database = DatabaseFactory.CreateDatabase();
            IList<OrderInfo> list = new List<OrderInfo>();
            DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Common_GetList");
            database.AddInParameter(storedProcCommand, "@StartRows", DbType.Int32, startRowIndexId);
            database.AddInParameter(storedProcCommand, "@PageSize", DbType.Int32, maxNumberRows);
            database.AddInParameter(storedProcCommand, "@SortColumn", DbType.String, "O.OrderID");
            GetsqlStr(searchType, field, keyword, action, out str, out str2);
            database.AddInParameter(storedProcCommand, "@StrColumn", DbType.String, str);
            database.AddInParameter(storedProcCommand, "@TableName", DbType.String, str2);
            database.AddInParameter(storedProcCommand, "@Sorts", DbType.String, "DESC");
            database.AddInParameter(storedProcCommand, "@Filter", DbType.String, GetFilterString(searchType, field, keyword));
            database.AddOutParameter(storedProcCommand, "@Total", DbType.Int32, maxNumberRows);
            using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand)))
            {
                while (reader.Read())
                {
                    list.Add(OrderFromrdr(reader, action));
                }
            }
            this.m_TotalOfOrder = (int) database.GetParameterValue(storedProcCommand, "@Total");
            return list;
        }

        public IDictionary<int, string> GetListByUserName(string userName)
        {
            string str;
            IDictionary<int, string> dictionary = new Dictionary<int, string>();
            if (string.IsNullOrEmpty(userName))
            {
                str = "select top 50 OrderID,OrderNum from PE_Orders where MoneyReceipt = 0 and DeliverStatus<1 order by OrderID desc";
            }
            else
            {
                str = "select top 50 OrderID,OrderNum from PE_Orders where MoneyReceipt = 0 and DeliverStatus<1 and UserName = @UserName order by OrderID desc";
            }
            using (NullableDataReader reader = new NullableDataReader(DBHelper.ExecuteReaderSql(str, new Parameters("@UserName", DbType.String, userName))))
            {
                while (reader.Read())
                {
                    dictionary.Add(reader.GetInt32("OrderID"), reader.GetString("OrderNum"));
                }
            }
            return dictionary;
        }

        public int GetMaxId()
        {
            return DBHelper.GetMaxId("PE_Orders", "OrderID");
        }

        public OrderInfo GetMyOrderById(int orderId, string userName)
        {
            Parameters cmdParams = new Parameters();
            cmdParams.AddInParameter("@OrderId", DbType.Int32, orderId);
            cmdParams.AddInParameter("@UserName", DbType.String, userName);
            string strSql = "SELECT O.*,C.ShortedForm AS ClientName \r\n                           FROM PE_Orders O LEFT JOIN PE_Client C ON O.ClientID=C.ClientID \r\n                           WHERE OrderID = @OrderId and (UserName=@UserName or AgentName=@UserName)";
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql(strSql, cmdParams))
            {
                return GetOrderInfoByReader(reader);
            }
        }

        public OrderInfo GetOrderById(int orderId)
        {
            Database database = DatabaseFactory.CreateDatabase();
            DbCommand storedProcCommand = database.GetStoredProcCommand("PR_Shop_Order_GetByOrderId");
            database.AddInParameter(storedProcCommand, "@OrderId", DbType.Int32, orderId);
            using (NullableDataReader reader = new NullableDataReader(database.ExecuteReader(storedProcCommand)))
            {
                return GetOrderInfoByReader(reader);
            }
        }

        public OrderInfo GetOrderByOrderNum(string orderNum)
        {
            using (NullableDataReader reader = DBHelper.ExecuteReaderSql("SELECT O.*,C.ShortedForm AS ClientName FROM PE_Orders O LEFT JOIN PE_Client C ON O.ClientID=C.ClientID WHERE OrderNum = @OrderNum", new Parameters("@OrderNum", DbType.String, orderNum)))
            {
                return GetOrderInfoByReader(reader);
            }
        }

        private static OrderInfo GetOrderInfoByReader(NullableDataReader rdr)
        {
            if (rdr.Read())
            {
                return OrderFromrdr(rdr, "");
            }
            return new OrderInfo(true);
        }

        private static void GetPayStatusSql(StringBuilder output, int payStatus)
        {
            if (payStatus >= 0)
            {
                switch (payStatus)
                {
                    case 0:
                        output.Append(" And O.MoneyTotal>0 And O.MoneyReceipt=0");
                        return;

                    case 1:
                        output.Append(" And O.MoneyTotal>O.MoneyReceipt And O.MoneyReceipt>0");
                        return;

                    case 2:
                        output.Append(" And O.MoneyTotal<=O.MoneyReceipt  And O.MoneyReceipt>0");
                        return;

                    default:
                        return;
                }
            }
        }

        private static DbCommand GetProcdbComm(Database db, string proName, OrderInfo orderInfo)
        {
            DbCommand storedProcCommand = db.GetStoredProcCommand(proName);
            db.AddInParameter(storedProcCommand, "@OrderID", DbType.Int32, orderInfo.OrderId);
            db.AddInParameter(storedProcCommand, "@OrderNum", DbType.String, orderInfo.OrderNum);
            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, "@ClientID", DbType.Int32, orderInfo.ClientId);
            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, "@Invoiced", DbType.Boolean, orderInfo.Invoiced);
            db.AddInParameter(storedProcCommand, "@Remark", DbType.String, orderInfo.Remark);
            db.AddInParameter(storedProcCommand, "@MoneyReceipt", DbType.Currency, orderInfo.MoneyReceipt);
            db.AddInParameter(storedProcCommand, "@BeginDate", DbType.DateTime, orderInfo.BeginDate);
            db.AddInParameter(storedProcCommand, "@InputTime", DbType.DateTime, orderInfo.InputTime);
            db.AddInParameter(storedProcCommand, "@ContacterName", DbType.String, orderInfo.ContacterName);
            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, "@Status", DbType.Int32, (int) orderInfo.Status);
            db.AddInParameter(storedProcCommand, "@DeliverStatus", DbType.Int32, (int) orderInfo.DeliverStatus);
            db.AddInParameter(storedProcCommand, "@EnableDownload", DbType.Boolean, orderInfo.EnableDownload);
            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, "@Discount_Payment", DbType.Double, orderInfo.DiscountPayment);
            db.AddInParameter(storedProcCommand, "@Charge_Deliver", DbType.Currency, orderInfo.ChargeDeliver);
            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);
            return storedProcCommand;
        }

        private static void GetsqlStr(string searchType, string field, string keyword, string action, out string sqlStrColumn, out string sqlTableName)
        {
            string str = "PE_CommonProduct P inner join (PE_OrderItem I inner join (PE_Orders O left join PE_Client C On O.ClientID = C.ClientID) on I.OrderID = O.OrderID) on P.ProductID = I.ProductID and P.TableName = I.TableName";
            string str2 = "PE_Contacter T inner join (PE_Users U inner join (PE_Orders O left join PE_Client C On C.ClientID = O.ClientID) on U.UserName = O.UserName) on T.ClientID = U.ClientID";
            string str3 = "PE_Orders O left join PE_Client C on O.ClientID=C.ClientID";
            if (action == "outExcel")
            {
                if ((((searchType == "10") && (field == "ProductName")) && !string.IsNullOrEmpty(keyword)) || ((searchType == "20") && NullProductName(keyword)))
                {
                    sqlTableName = str;
                }
                else if (((searchType == "10") && (field == "QQ")) && !string.IsNullOrEmpty(keyword))
                {
                    sqlTableName = str2;
                }
                else
                {
                    sqlTableName = str3;
                }
            }
            else if (((searchType == "10") && (field == "ProductName")) || ((searchType == "20") && NullProductName(keyword)))
            {
                sqlTableName = str;
            }
            else if (((searchType == "10") && (field == "QQ")) && !string.IsNullOrEmpty(keyword))
            {
                sqlTableName = str2;
            }
            else
            {
                sqlTableName = str3;
            }
            sqlStrColumn = "O.*,isnull(C.ShortedForm,'') as ClientName";
        }

        public ArrayList GetTotalofMoneyAndReceipt()
        {
            string sqlString = "select Isnull(sum(MoneyTotal),0) , Isnull(sum(MoneyReceipt),0) from PE_Orders";
            return GetDataofExecute(sqlString, null);
        }

        public ArrayList GetTotalofMoneyAndReceiptByAgentName(string agentName)
        {
            string sqlString = "select Isnull(sum(MoneyTotal),0) , Isnull(sum(MoneyReceipt),0) from PE_Orders Where AgentName=@AgentName";
            return GetDataofExecute(sqlString, new Parameters("@AgentName", DbType.String, agentName));
        }

⌨️ 快捷键说明

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