Пример #1
0
        /// <summary>
        /// 取机器各个状态数
        /// </summary>
        /// <returns></returns>
        public int CheckMachineId(string machineId, string deviceId)
        {
            var conditions = new List <Condition>();

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

            conditions.Add(new Condition
            {
                LeftBrace    = " OR ",
                ParamName    = "DeviceId",
                DbColumnName = "device_id",
                ParamValue   = deviceId,
                Operation    = ConditionOperate.Equal,
                RightBrace   = ")",
                Logic        = ""
            });
            return(GenerateDal.CountByConditions(CommonSqlKey.CheckMachineId, conditions));
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        //根据client id取名下机器数量
        public int GetMachineCountByClientId(string clientId)
        {
            var result = 0;

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

            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        = ""
            });
            result = GenerateDal.CountByConditions(CommonSqlKey.GetMachineListCount, conditions);

            return(result);
        }
Пример #5
0
        public int GetCount(MachineCabinetModel machineCabinetInfo)
        {
            var result = 0;



            var conditions = new List <Condition>();

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



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

            return(result);
        }
Пример #6
0
        //一键补货操作
        public int GetFullfilGood(string machineId)
        {
            try
            {
                TunnelInfoModel tunnelInfo = new TunnelInfoModel();
                tunnelInfo.MachineId = machineId;
                //int delResult = GenerateDal.Delete<TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo);
                var conditions = new List <Condition>();

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

                int resultStatusCount = GenerateDal.CountByConditions(CommonSqlKey.IsExistTunnelInfo, conditions);
                int resultConfigCount = GenerateDal.CountByConditions(CommonSqlKey.GetTunnelConfigCount, conditions);
                if (resultStatusCount == resultConfigCount)
                {
                    GenerateDal.Execute <TunnelInfoModel>(CommonSqlKey.UpdateFullfilGoodsOneKey, tunnelInfo);
                }
                else
                {
                    GenerateDal.Delete <TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo);
                    GenerateDal.Execute <TunnelInfoModel>(CommonSqlKey.FullfilGoodsOneKey, tunnelInfo);
                }

                //往机器下行表里插入库存改变的数据
                PostToMachine(machineId, "st");
                //机器管理操作日志
                operationService.PostData(new OperationLogModel()
                {
                    MachineId = machineId, OptContent = "一键补货"
                });

                /*
                 * GenerateDal.BeginTransaction();
                 * TunnelInfoModel tunnelInfo = new TunnelInfoModel();
                 * tunnelInfo.MachineId = machineId;
                 * GenerateDal.Delete<TunnelInfoModel>(CommonSqlKey.DeleteTunnelStatusByMachine, tunnelInfo);
                 * GenerateDal.Execute<TunnelInfoModel>(CommonSqlKey.FullfilGoodsOneKey, tunnelInfo);
                 *
                 * GenerateDal.CommitTransaction();
                 */
            }
            catch (Exception e)
            {
                //GenerateDal.RollBack();
                return(0);
            }
            return(1);
        }
Пример #7
0
        public int GetCount(AuthModel authInfo)
        {
            var result = 0;

            var conditions = new List <Condition>();


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

            return(result);
        }
Пример #8
0
        public int GetMachinesCount(CommonDic commonDic, int pageIndex, int pageSize)
        {
            string clientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(clientId))
            {
                return(0);
            }
            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        = ""
                });
            }

            return(GenerateDal.CountByConditions(CommonSqlKey.GetMachineDicCount, conditions));
        }
Пример #9
0
        private int CheckUserName(string name)
        {
            var conditions = new List <Condition>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "UserAccount",
                DbColumnName = "usr_account",
                ParamValue   = name,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });
            return(GenerateDal.CountByConditions(CommonSqlKey.CheckUserExist, conditions));
        }
Пример #10
0
        public int GetCount(WechatMemberModel wechatMemberInfo)
        {
            var result = 0;

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

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

            if (userClientId != "self")
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "ClientId",
                    DbColumnName = "a.client_id",
                    ParamValue   = userClientId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = " ",
                    Logic        = ""
                });
            }

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

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

            return(result);
        }
Пример #11
0
        private bool IsExistEquipmentInfo(string machineId)
        {
            int result     = 0;
            var conditions = new List <Condition>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "MachineId",
                DbColumnName = "machine_id",
                ParamValue   = machineId,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });
            result = GenerateDal.CountByConditions(CommonSqlKey.IsExistEquipmentInfo, conditions);

            return(result > 0);
        }
Пример #12
0
        public int GetCount(WebSettingModel webSettingInfo)
        {
            if (string.IsNullOrEmpty(webSettingInfo.Id))
            {
                return(0);
            }
            var conditions = new List <Condition>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "Id",
                DbColumnName = "id",
                ParamValue   = webSettingInfo.Id,
                Operation    = ConditionOperate.Equal,
                RightBrace   = " ",
                Logic        = ""
            });
            return(GenerateDal.CountByConditions(CommonSqlKey.IsExistWechat, conditions));
        }
Пример #13
0
        public int GetCount(TunnelConfigModel tunnelConfigInfo)
        {
            var result = 0;


            var conditions = new List <Condition>();

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

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



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

            return(result);
        }
Пример #14
0
        public int UpdateData(UserModel userInfo)
        {
            var conditions = new List <Condition>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "UserAccount",
                DbColumnName = "usr_account",
                ParamValue   = userInfo.UserAccount,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });
            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "Id",
                DbColumnName = "id",
                ParamValue   = userInfo.Id,
                Operation    = ConditionOperate.NotEqual,
                RightBrace   = "",
                Logic        = ""
            });
            int result = GenerateDal.CountByConditions(CommonSqlKey.CheckUserExist, conditions);

            if (result > 0)
            {
                return(-1);
            }
            // userInfo.UserPassword = Md5.md5(userInfo.UserPassword, 16);
            //操作日志
            OperationLogService operationService = new OperationLogService();

            operationService.PostData(new OperationLogModel()
            {
                Remark = userInfo.Id, OptContent = "更新用户"
            });
            return(GenerateDal.Update(CommonSqlKey.UpdateUser, userInfo));
        }
Пример #15
0
        //是否已存在此单
        public int GetCountByTradeNo(string tradeNo)
        {
            var result = 0;


            var conditions = new List <Condition>();

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "TradeNo",
                DbColumnName = "trade_no",
                ParamValue   = tradeNo,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });

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

            return(result);
        }
Пример #16
0
        public int GetCount(MachineTypeModel machineTypeInfo)
        {
            var result = 0;

            var conditions = new List <Condition>();

            var conditionAccount = new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "TypeName",
                DbColumnName = "type_name",
                ParamValue   = machineTypeInfo.TypeName + "%",
                Operation    = ConditionOperate.RightLike,
                RightBrace   = "",
                Logic        = ""
            };

            conditions.Add(conditionAccount);
            if (!string.IsNullOrEmpty(machineTypeInfo.TypeType.ToString()))
            {
                var conditionUserName = new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TypeType",
                    DbColumnName = "type_type",
                    ParamValue   = machineTypeInfo.TypeType,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                };
                conditions.Add(conditionUserName);
            }



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

            return(result);
        }
Пример #17
0
        //判断是否往退款表里插入成功
        public int IsRefundSucceed(string tradeNo)
        {
            var result = 0;


            var conditions = new List <Condition>();

            if (!string.IsNullOrEmpty(tradeNo))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeNo",
                    DbColumnName = "trade_no",
                    ParamValue   = tradeNo,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
                result = GenerateDal.CountByConditions(CommonSqlKey.IsRefundSucceed, conditions);
            }

            return(result);
        }
Пример #18
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);
        }
Пример #19
0
        public int GetProductStatisticCount(string salesDateStart, string salesDateEnd, string productName, string clientId, string machineId, string tradeStatus)
        {
            var result = 0;

            string userClientId = clientId;

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

            if (string.IsNullOrEmpty(userClientId))
            {
                return(0);
            }
            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        = ""
                });
            }



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

            return(result);
        }
Пример #20
0
        public int GetSalesAmountByMachineCount(string salesDateStart, string salesDateEnd, string machineId, bool needPage, int pageIndex, int pageSize)
        {
            var result = 0;

            var clientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(clientId))
            {
                return(0);
            }
            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 = "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        = ""
                });
            }


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

            return(result);
        }
Пример #21
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);
        }
Пример #22
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);
        }
Пример #23
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);
        }