예제 #1
0
        public List <PictureModel> GetAll(PictureModel pictureInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(pictureInfo.FileType))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "FileType",
                    DbColumnName = "a.file_type",
                    ParamValue   = pictureInfo.FileType,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }


            if (!string.IsNullOrEmpty(pictureInfo.Belong))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "Belong",
                    DbColumnName = "a.belong",
                    ParamValue   = pictureInfo.Belong,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(pictureInfo.PicName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "PicName",
                    DbColumnName = "a.pic_name",
                    ParamValue   = pictureInfo.PicName,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "ResourceUrl",
                DbColumnName = "",
                ParamValue   = ConfigHandler.ResourceUrl,
                Operation    = ConditionOperate.None,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "UploadTime",
                DbColumnName = "upload_time",
                ParamValue   = "desc",
                Operation    = ConditionOperate.OrderBy,
                RightBrace   = "",
                Logic        = ""
            });



            conditions.AddRange(CreatePaginConditions(pictureInfo.PageIndex, pictureInfo.PageSize));

            return(GenerateDal.LoadByConditions <PictureModel>(CommonSqlKey.GetPictureList, conditions));
        }
예제 #2
0
        public List <ProductGroupModel> GetAll(ProductGroupModel productListInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            var result = new List <ProductGroupModel>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(productListInfo.WaresName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "WaresName",
                    DbColumnName = "a.wares_name",
                    ParamValue   = "%" + productListInfo.WaresName + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(productListInfo.WaresTypeId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "WaresTypeId",
                    DbColumnName = "a.wares_type_id",
                    ParamValue   = productListInfo.WaresTypeId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            conditions.AddRange(CreatePaginConditions(productListInfo.PageIndex, productListInfo.PageSize));
            result = GenerateDal.LoadByConditions <ProductGroupModel>(CommonSqlKey.GetProductGroupList, conditions);



            return(result);
        }
예제 #3
0
        public int GetCount(PictureModel pictureInfo)
        {
            var result = 0;

            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }
            var conditions = new List <Condition>();

            string clientIds = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(pictureInfo.FileType))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "FileType",
                    DbColumnName = "a.file_type",
                    ParamValue   = pictureInfo.FileType,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(pictureInfo.Belong))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "Belong",
                    DbColumnName = "a.belong",
                    ParamValue   = pictureInfo.Belong,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }


            result = GenerateDal.CountByConditions(CommonSqlKey.GetPictureListCount, conditions);

            return(result);
        }
예제 #4
0
        public int GetCount(UserModel userInfo)
        {
            var result = 0;


            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }

            /*
             * var dics = new Dictionary<string, object>();
             * dics.Add("UserAccount", userInfo.UserAccount + "%");
             * dics.Add("UserName", userInfo.UserName + "%");
             *
             *
             *
             *
             * if (userStatus == "100" || userStatus == "99")
             * {
             *  dics.Add("ClientFatherId", "self");
             * }
             * else
             * {
             *  dics.Add("ClientFatherId", userClientId);
             * }
             *
             *
             * result = GenerateDal.CountByDictionary<UserModel>(CommonSqlKey.GetUserCount, dics);
             */
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.usr_client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(userInfo.UserAccount))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserAccount",
                    DbColumnName = "a.usr_account",
                    ParamValue   = "%" + userInfo.UserAccount + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(userInfo.UserName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserName",
                    DbColumnName = "a.usr_name",
                    ParamValue   = "%" + userInfo.UserName + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            result = GenerateDal.CountByConditions(CommonSqlKey.GetUserCount, conditions);
            return(result);
        }
예제 #5
0
        public List <UserModel> GetAll(UserModel userInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }

            /*
             * var dics = new Dictionary<string, object>();
             * dics.Add("UserAccount", userInfo.UserAccount + "%");
             * dics.Add("UserName", userInfo.UserName + "%");
             * if (userInfo.PageIndex == 1)
             * {
             *  dics.Add("PageIndex", userInfo.PageIndex-1);
             * }
             * else
             * {
             *  dics.Add("PageIndex", userInfo.PageIndex);
             * }
             * dics.Add("PageSize", userInfo.PageSize);
             */

            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.usr_client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(userInfo.UserAccount))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserAccount",
                    DbColumnName = "a.usr_account",
                    ParamValue   = "%" + userInfo.UserAccount + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(userInfo.UserName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserName",
                    DbColumnName = "a.usr_name",
                    ParamValue   = "%" + userInfo.UserName + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }



            conditions.AddRange(CreatePaginConditions(userInfo.PageIndex, userInfo.PageSize));



            return(GenerateDal.LoadByConditions <UserModel>(CommonSqlKey.GetUser, conditions));
        }
예제 #6
0
        public List <MachineListModel> GetAll(MachineListModel machineListInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(machineListInfo.MachineId))
            {
                conditions.Add(new Condition {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = "%" + machineListInfo.MachineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.ClientText))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "ClientName",
                    DbColumnName = "b.client_name",
                    ParamValue   = "%" + machineListInfo.ClientText + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.UserAccount))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserAccount",
                    DbColumnName = "c.usr_account",
                    ParamValue   = "%" + machineListInfo.UserAccount + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.TypeId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TypeId",
                    DbColumnName = "a.type_id",
                    ParamValue   = machineListInfo.TypeId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "LatestOnline",
                DbColumnName = "LatestOnline",
                ParamValue   = "asc",
                Operation    = ConditionOperate.OrderBy,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.AddRange(CreatePaginConditions(machineListInfo.PageIndex, machineListInfo.PageSize));

            return(GenerateDal.LoadByConditions <MachineListModel>(CommonSqlKey.GetMachineList, conditions));
        }
예제 #7
0
        public int GetCount(SaleModel saleInfo)
        {
            var result = 0;

            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "c.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(saleInfo.MachineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "b.machine_id",
                    ParamValue   = "%" + saleInfo.MachineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.PayType))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "PayType",
                    DbColumnName = "pay_type",
                    ParamValue   = saleInfo.PayType,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (saleInfo.TradeStatus != 0)
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeStatus",
                    DbColumnName = "trade_status",
                    ParamValue   = saleInfo.TradeStatus,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.SaleDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "sales_date",
                    ParamValue   = saleInfo.SaleDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.SaleDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "sales_date",
                    ParamValue   = Convert.ToDateTime(saleInfo.SaleDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.TradeNo))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeNo",
                    DbColumnName = "trade_no",
                    ParamValue   = "%" + saleInfo.TradeNo.Trim() + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }



            result = GenerateDal.CountByConditions(CommonSqlKey.GetSaleListAllCount, conditions);



            return(result);
        }
예제 #8
0
        public int GetCount(ProductTypeModel productTypeInfo)
        {
            var result = 0;

            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }

            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(productTypeInfo.WaresTypeName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "WaresTypeName",
                    DbColumnName = "a.wares_type_name",
                    ParamValue   = "%" + productTypeInfo.WaresTypeName + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(productTypeInfo.ClientName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "ClientName",
                    DbColumnName = "b.client_name",
                    ParamValue   = "%" + productTypeInfo.ClientName + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }



            result = GenerateDal.CountByConditions(CommonSqlKey.GetProductTypeCount, conditions);

            return(result);
        }
예제 #9
0
        public int GetCount(MachineListModel machineListInfo)
        {
            var result = 0;

            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "a.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(machineListInfo.MachineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = "%" + machineListInfo.MachineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.ClientText))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "ClientName",
                    DbColumnName = "b.client_name",
                    ParamValue   = "%" + machineListInfo.ClientText + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.UserAccount))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "UserAccount",
                    DbColumnName = "c.usr_account",
                    ParamValue   = "%" + machineListInfo.UserAccount + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineListInfo.TypeId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TypeId",
                    DbColumnName = "a.type_id",
                    ParamValue   = machineListInfo.TypeId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }


            result = GenerateDal.CountByConditions(CommonSqlKey.GetMachineListCount, conditions);

            return(result);
        }
예제 #10
0
        public DataTable GetProductStatistic(string salesDateStart, string salesDateEnd, string productName, string clientId, string machineId, string tradeStatus, int pageIndex, int pageSize)
        {
            string userClientId = clientId;

            if (string.IsNullOrEmpty(userClientId))
            {
                userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
            }

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var conditions = new List <Condition>();

            string clientIds = new CommonService().GetClientIds(userClientId.ToString());

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "TradeStatus",
                DbColumnName = "a.trade_status",
                ParamValue   = tradeStatus,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(salesDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.pay_date",
                    ParamValue   = salesDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(salesDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.pay_date",
                    ParamValue   = Convert.ToDateTime(salesDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = machineId.Trim(),
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(productName))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "ProductName",
                    DbColumnName = "a.wares_name",
                    ParamValue   = "%" + productName.Trim() + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            conditions.Add(new Condition
            {
                LeftBrace    = "",
                ParamName    = "",
                DbColumnName = "",
                ParamValue   = "a.wares_name",
                Operation    = ConditionOperate.GroupBy,
                RightBrace   = "",
                Logic        = ""
            });


            conditions.AddRange(CreatePaginConditions(pageIndex, pageSize));
            return(GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetProductStatistic, conditions));
        }
예제 #11
0
        public List <SaleModel> GetAll(SaleModel saleInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var    result     = new List <SaleModel>();
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(saleInfo.MachineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = "%" + saleInfo.MachineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.PayType))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "PayType",
                    DbColumnName = "a.pay_type",
                    ParamValue   = saleInfo.PayType,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (saleInfo.TradeStatus != 0)
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeStatus",
                    DbColumnName = "a.trade_status",
                    ParamValue   = saleInfo.TradeStatus,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.SaleDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.sales_date",
                    ParamValue   = saleInfo.SaleDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.SaleDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.sales_date",
                    ParamValue   = Convert.ToDateTime(saleInfo.SaleDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.TradeNo))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeNo",
                    DbColumnName = "a.trade_no",
                    ParamValue   = "%" + saleInfo.TradeNo.Trim() + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });
            }



            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "SalesDate",
                DbColumnName = "a.sales_date",
                ParamValue   = "desc",
                Operation    = ConditionOperate.OrderBy,
                RightBrace   = "",
                Logic        = ""
            });
            conditions.AddRange(CreatePaginConditions(saleInfo.PageIndex, saleInfo.PageSize));
            result = GenerateDal.LoadByConditions <SaleModel>(CommonSqlKey.GetPickSales, conditions);



            return(result);
        }
예제 #12
0
        /// <summary>
        /// 取销售额根据机器进行分类
        /// </summary>
        /// <returns></returns>
        public List <ClassModel> GetGroupMoneyByMachine(string salesDateStart, string salesDateEnd, string clientId, bool needPage = true, int pageIndex = 1, int pageSize = 10)
        {
            string userClientId = clientId;

            if (string.IsNullOrEmpty(userClientId))
            {
                userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
            }

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var conditions = new List <Condition>();

            string clientIds = new CommonService().GetClientIds(userClientId.ToString());

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND (",
                ParamName    = "ClientIdA",
                DbColumnName = "b.client_id",
                ParamValue   = userClientId,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = " OR ",
                ParamName    = "ClientIdB",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ) ",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "TradeStatus",
                DbColumnName = "a.trade_status",
                ParamValue   = 2,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(salesDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.pay_date",
                    ParamValue   = salesDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(salesDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.pay_date",
                    ParamValue   = Convert.ToDateTime(salesDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            conditions.Add(new Condition
            {
                LeftBrace    = "",
                ParamName    = "",
                DbColumnName = "",
                ParamValue   = "a.machine_id",
                Operation    = ConditionOperate.GroupBy,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "Data",
                DbColumnName = "SUM(a.trade_amount*a.reality_sale_number)",
                ParamValue   = "DESC",
                Operation    = ConditionOperate.OrderBy,
                RightBrace   = "",
                Logic        = ""
            });

            if (needPage)
            {
                conditions.AddRange(CreatePaginConditions(pageIndex, pageSize));
            }

            return(GenerateDal.LoadByConditions <ClassModel>(CommonSqlKey.GetGroupMoneyByMachine, conditions));
        }
예제 #13
0
        /// <summary>
        /// 取销售额
        /// </summary>
        /// <returns></returns>
        public List <ClassModel> GetGroupSalesMoney(string salesDateStart, string salesDateEnd, string type, string clientId)
        {
            //var clientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
            string userClientId = clientId;

            if (string.IsNullOrEmpty(userClientId))
            {
                userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
            }
            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var conditions = new List <Condition>();

            string clientIds = new CommonService().GetClientIds(userClientId.ToString());

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND (",
                ParamName    = "ClientIdA",
                DbColumnName = "b.client_id",
                ParamValue   = userClientId,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = " OR ",
                ParamName    = "ClientIdB",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ) ",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "TradeStatus",
                DbColumnName = "a.trade_status",
                ParamValue   = 2,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(salesDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.pay_date",
                    ParamValue   = salesDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(salesDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.pay_date",
                    ParamValue   = Convert.ToDateTime(salesDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            if (type == "year")
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = "",
                    ParamName    = "",
                    DbColumnName = "",
                    ParamValue   = "year(a.pay_date)",
                    Operation    = ConditionOperate.GroupBy,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            else if (type == "month")
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = "",
                    ParamName    = "",
                    DbColumnName = "",
                    ParamValue   = "year(a.pay_date),month(a.pay_date)",
                    Operation    = ConditionOperate.GroupBy,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            else if (type == "day")
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = "",
                    ParamName    = "",
                    DbColumnName = "",
                    ParamValue   = "year(a.pay_date),month(a.pay_date),day(pay_date)",
                    Operation    = ConditionOperate.GroupBy,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            else if (type == "week")
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = "",
                    ParamName    = "",
                    DbColumnName = "",
                    ParamValue   = "week(a.pay_date)",
                    Operation    = ConditionOperate.GroupBy,
                    RightBrace   = "",
                    Logic        = ""
                });
            }


            return(GenerateDal.LoadByConditions <ClassModel>(CommonSqlKey.GetGroupSalesMoney, conditions));
        }
예제 #14
0
        /// <summary>
        /// 统计金额
        /// </summary>
        /// <param name="saleInfo"></param>
        /// <returns></returns>
        public DataTable GetStatisticSalesMoneyByDate(SaleModel saleInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }

            DataTable result     = new DataTable();
            var       conditions = new List <Condition>();
            string    clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(saleInfo.SaleDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.pay_date",
                    ParamValue   = saleInfo.SaleDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(saleInfo.SaleDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.pay_date",
                    ParamValue   = saleInfo.SaleDateEnd,
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }



            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "",
                DbColumnName = "a.pay_interface",
                ParamValue   = "",
                Operation    = ConditionOperate.GroupBy,
                RightBrace   = "",
                Logic        = ""
            });

            result = GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetStatisticSalesMoneyByDate, conditions);

            return(result);
        }
예제 #15
0
        /// <summary>
        /// 取机器的销售额
        /// </summary>
        /// <returns></returns>
        public DataTable GetSalesAmountByMachine(string salesDateStart, string salesDateEnd, string machineId, bool needPage, int pageIndex, int pageSize)
        {
            var clientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(clientId))
            {
                return(null);
            }
            var conditions = new List <Condition>();

            if (string.IsNullOrEmpty(clientId.ToString()))
            {
                return(new DataTable());
            }
            string clientIds = new CommonService().GetClientIds(clientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });

            if (!string.IsNullOrEmpty(salesDateStart))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateStart",
                    DbColumnName = "a.pay_date",
                    ParamValue   = salesDateStart,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(salesDateEnd))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "SaleDateEnd",
                    DbColumnName = "a.pay_date",
                    ParamValue   = Convert.ToDateTime(salesDateEnd).AddDays(1),
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND (",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = "%" + machineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = "",
                    Logic        = ""
                });

                conditions.Add(new Condition
                {
                    LeftBrace    = " OR ",
                    ParamName    = "Remark",
                    DbColumnName = "b.remark",
                    ParamValue   = "%" + machineId + "%",
                    Operation    = ConditionOperate.Like,
                    RightBrace   = ")",
                    Logic        = ""
                });
            }

            conditions.Add(new Condition
            {
                LeftBrace    = "",
                ParamName    = "",
                DbColumnName = "",
                ParamValue   = "a.machine_id",
                Operation    = ConditionOperate.GroupBy,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = "  ",
                ParamName    = "Total",
                DbColumnName = "total",
                ParamValue   = "desc",
                Operation    = ConditionOperate.OrderBy,
                RightBrace   = "",
                Logic        = ""
            });

            if (needPage)
            {
                conditions.AddRange(CreatePaginConditions(pageIndex, pageSize));
            }


            return(GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetSalesAmountByMachine, conditions));
        }
예제 #16
0
        public List <MachineLocationModel> GetAll(MachineLocationModel machineLocationInfo)
        {
            string userClientId = machineLocationInfo.ClientId;

            // string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
            if (string.IsNullOrEmpty(userClientId))
            {
                userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
                // return null;
            }
            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var    conditions = new List <Condition>();
            string clientIds  = new CommonService().GetClientIds(userClientId);

            if (clientIds.Contains("self"))
            {
                clientIds = "'" + clientIds.Replace(",", "','") + "'";
            }
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "ClientId",
                DbColumnName = "b.client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = " ",
                Logic        = ""
            });
            if (!string.IsNullOrEmpty(machineLocationInfo.MachineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "a.machine_id",
                    ParamValue   = machineLocationInfo.MachineId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (string.IsNullOrEmpty(machineLocationInfo.MachineId) && string.IsNullOrEmpty(machineLocationInfo.StartLong))
            {
                return(null);
            }

            if (!string.IsNullOrEmpty(machineLocationInfo.StartLong))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "StartLong",
                    DbColumnName = "a.longitude",
                    ParamValue   = machineLocationInfo.StartLong,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineLocationInfo.EndLong))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "EndLong",
                    DbColumnName = "a.longitude",
                    ParamValue   = machineLocationInfo.EndLong,
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineLocationInfo.StartLati))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "StartLati",
                    DbColumnName = "a.latitude",
                    ParamValue   = machineLocationInfo.StartLati,
                    Operation    = ConditionOperate.GreaterThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }

            if (!string.IsNullOrEmpty(machineLocationInfo.EndLati))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "EndLati",
                    DbColumnName = "a.latitude",
                    ParamValue   = machineLocationInfo.EndLati,
                    Operation    = ConditionOperate.LessThan,
                    RightBrace   = "",
                    Logic        = ""
                });
            }


            // conditions.AddRange(CreatePaginConditions(machineLocationInfo.PageIndex, machineLocationInfo.PageSize));

            return(GenerateDal.LoadByConditions <MachineLocationModel>(CommonSqlKey.GetMachineLocationList, conditions));
        }