public int GetCount(ProductListModel productListInfo) { var result = 0; string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString(); if (string.IsNullOrEmpty(userClientId)) { return(0); } string clientIds = new CommonService().GetClientIds(userClientId); if (clientIds.Contains("self")) { clientIds = "'" + clientIds.Replace(",", "','") + "'"; } var conditions = new List <Condition>(); conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "ClientId", DbColumnName = "client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = " ", Logic = "" }); if (!string.IsNullOrEmpty(productListInfo.WaresName)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "WaresName", DbColumnName = "wares_name", ParamValue = "%" + productListInfo.WaresName + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(productListInfo.WaresTypeId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "WaresTypeId", DbColumnName = "wares_type_id", ParamValue = productListInfo.WaresTypeId, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } result = GenerateDal.CountByConditions(CommonSqlKey.GetProductListAllCount, conditions); return(result); }
public int GetCount(CashEquipmentModel cashEquipmentInfo) { 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 = "b.client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = "", Logic = "" }); result = GenerateDal.CountByConditions(CommonSqlKey.GetCashEquipmentCount, conditions); return(result); }
public List <CashEquipmentModel> GetAll(CashEquipmentModel cashEquipmentInfo) { 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 = "b.client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = "", Logic = "" }); conditions.AddRange(CreatePaginConditions(cashEquipmentInfo.PageIndex, cashEquipmentInfo.PageSize)); return(GenerateDal.LoadByConditions <CashEquipmentModel>(CommonSqlKey.GetCashEquipmentList, conditions)); }
/// <summary> /// 取支付笔数 /// </summary> /// <returns></returns> public List <ClassModel> GetPayNumbers(string clientId) { string userClientId = clientId; if (string.IsNullOrEmpty(userClientId)) { userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString(); } if (string.IsNullOrEmpty(userClientId)) { return(null); } var result = new List <ClassModel>(); 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 = "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 = " ", ParamName = "", DbColumnName = "", ParamValue = "a.trade_status", Operation = ConditionOperate.GroupBy, RightBrace = "", Logic = "" }); result = GenerateDal.LoadByConditions <ClassModel>(CommonSqlKey.GetPayNumbers, conditions); return(result); }
public List <CommonDic> GetMachines(CommonDic commonDic, int pageIndex, int pageSize) { string clientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString(); if (string.IsNullOrEmpty(clientId)) { return(null); } var conditions = new List <Condition>(); string clientIds = new CommonService().GetClientIds(clientId); if (clientIds.Contains("self")) { clientIds = "'" + clientIds.Replace(",", "','") + "'"; } conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "ClientId", DbColumnName = "client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = "", Logic = "" }); if (!string.IsNullOrEmpty(commonDic.Name)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "MachineId", DbColumnName = " machine_id ", ParamValue = "%" + commonDic.Name + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); conditions.Add(new Condition { LeftBrace = " Or ", ParamName = "Remark", DbColumnName = " remark ", ParamValue = "%" + commonDic.Name + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } conditions.AddRange(CreatePaginConditions(pageIndex, pageSize)); List <CommonDic> machines = GenerateDal.LoadByConditions <CommonDic>(CommonSqlKey.GetMachineDic, conditions); return(machines); }
public List <ProductConfigModel> GetAll(ProductConfigModel productConfigInfo) { string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString(); if (string.IsNullOrEmpty(userClientId)) { return(null); } var result = new List <ProductConfigModel>(); 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(productConfigInfo.WaresConfigName)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "WaresConfigName", DbColumnName = "b.wares_config_name", ParamValue = "%" + productConfigInfo.WaresConfigName + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } conditions.AddRange(CreatePaginConditions(productConfigInfo.PageIndex, productConfigInfo.PageSize)); result = GenerateDal.LoadByConditions <ProductConfigModel>(CommonSqlKey.GetProductConfigAll, conditions); return(result); }
public List <MachineConfigModel> GetAll(MachineConfigModel machineConfigInfo) { string 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 = "a.client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = " ", Logic = "" }); if (!string.IsNullOrEmpty(machineConfigInfo.MachineId)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "MachineId", DbColumnName = "a.machine_id", ParamValue = "%" + machineConfigInfo.MachineId + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } conditions.AddRange(CreatePaginConditions(machineConfigInfo.PageIndex, machineConfigInfo.PageSize)); return(GenerateDal.LoadByConditions <MachineConfigModel>(CommonSqlKey.GetMachineConfig, conditions)); }
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)); }
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); }
/// <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)); }
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); }
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)); }
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); }
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)); }
/// <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); }
/// <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)); }
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)); }
public List <PrivilegeModel> GetAll(PrivilegeModel privilegeInfo) { 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(privilegeInfo.PrivilegeName)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "PrivilegeName", DbColumnName = "a.privilege_name", ParamValue = "%" + privilegeInfo.PrivilegeName + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(privilegeInfo.PrincipleType)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "PrincipleType", DbColumnName = "a.principle_type", ParamValue = privilegeInfo.PrincipleType, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(privilegeInfo.PrincipleGroup)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "PrincipleGroup", DbColumnName = "a.principle_group", ParamValue = privilegeInfo.PrincipleGroup, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } conditions.AddRange(CreatePaginConditions(privilegeInfo.PageIndex, privilegeInfo.PageSize)); return(GenerateDal.LoadByConditions <PrivilegeModel>(CommonSqlKey.GetPrivilegeList, conditions)); }
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); }
public List <ActivityModel> GetAll(ActivityModel activityInfo) { 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 <ActivityModel>(); conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "ClientId", DbColumnName = "a.client_id", ParamValue = clientIds, Operation = ConditionOperate.INWithNoPara, RightBrace = " ", Logic = "" }); if (!string.IsNullOrEmpty(activityInfo.Name)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "Name", DbColumnName = "a.name", ParamValue = "%" + activityInfo.Name + "%", Operation = ConditionOperate.Like, RightBrace = "", Logic = "" }); } if (!string.IsNullOrEmpty(activityInfo.ActivityType)) { conditions.Add(new Condition { LeftBrace = " AND ", ParamName = "ActivityType", DbColumnName = "a.activity_type", ParamValue = activityInfo.ActivityType, Operation = ConditionOperate.Equal, RightBrace = "", Logic = "" }); } conditions.AddRange(CreatePaginConditions(activityInfo.PageIndex, activityInfo.PageSize)); result = GenerateDal.LoadByConditions <ActivityModel>(CommonSqlKey.GetActivityList, conditions); return(result); }
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); }
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)); }
/// <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)); }