Пример #1
0
        //根据设备id取机器id
        public string GetMachineIdByDeviceId(string deviceId)
        {
            var conditions = new List <Condition>();

            if (string.IsNullOrEmpty(deviceId))
            {
                return("");
            }

            conditions.Add(new Condition
            {
                LeftBrace    = " AND ",
                ParamName    = "DeviceId",
                DbColumnName = "device_id",
                ParamValue   = deviceId,
                Operation    = ConditionOperate.Equal,
                RightBrace   = "",
                Logic        = ""
            });
            var lstMachine = GenerateDal.LoadByConditions <MachineListModel>(CommonSqlKey.GetMachineIdByDeviceId, conditions);

            if (lstMachine.Count == 0)
            {
                return("");
            }
            else
            {
                return(lstMachine[0].MachineId);
            }
        }
Пример #2
0
        //根据商品id取商品名称
        private string GetProductNameByWaresId(string waresId)
        {
            var conditions = new List <Condition>();

            if (!string.IsNullOrEmpty(waresId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "WaresId",
                    DbColumnName = "wares_id",
                    ParamValue   = waresId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            DataTable result = GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetProductNameByWaresId, conditions);

            if (result.Rows.Count > 0)
            {
                return(result.Rows[0][0].ToString());
            }
            else
            {
                return("");
            }
        }
Пример #3
0
        public int DeleteData(string id)
        {
            MachineCabinetModel machineCabinetInfo = new MachineCabinetModel();

            machineCabinetInfo.CabinetId = id;
            return(GenerateDal.Delete <MachineCabinetModel>(CommonSqlKey.DeleteMachineCabinet, machineCabinetInfo));
        }
Пример #4
0
        public List <WebSettingModel> GetAll(WebSettingModel webSettingInfo)
        {
            string userClientId = string.Empty;

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

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

            return(GenerateDal.LoadByConditions <WebSettingModel>(CommonSqlKey.GetWechatInfo, conditions));
        }
Пример #5
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public int DeleteData(string id)
        {
            ProductConfigModel productConfigInfo = new ProductConfigModel();

            productConfigInfo.WaresConfigId = id;
            return(GenerateDal.Delete <ProductConfigModel>(CommonSqlKey.DeleteProductConfig, productConfigInfo));
        }
Пример #6
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public int DeleteData(string id)
        {
            ProductGroupRelationModel productListInfo = new ProductGroupRelationModel();

            productListInfo.WaresGroupId = id;
            return(GenerateDal.Delete <ProductGroupRelationModel>(CommonSqlKey.DeleteProductGroupRelation, productListInfo));
        }
Пример #7
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public int DeleteData(string id)
        {
            MachineLocationModel machineLocationInfo = new MachineLocationModel();

            machineLocationInfo.MachineId = id;
            return(GenerateDal.Delete <MachineLocationModel>(CommonSqlKey.DeleteMachineLocation, machineLocationInfo));
        }
Пример #8
0
        private string GetCabinetIdByMachine(string machineId)
        {
            var conditions = new List <Condition>();

            if (!string.IsNullOrEmpty(machineId))
            {
                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "MachineId",
                    DbColumnName = "b.machine_id",
                    ParamValue   = machineId,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
            }
            DataTable dt = GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetCabinetId, conditions);

            if (dt.Rows.Count > 0)
            {
                return(dt.Rows[0][0].ToString());
            }
            else
            {
                return("");
            }
        }
Пример #9
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);
        }
Пример #10
0
        //机器端设置现金价格
        public int PostCashPrice(List <PriceAndMaxStockModel> lstPriceAndStock, string machineId)
        {
            try
            {
                GenerateDal.BeginTransaction();
                foreach (PriceAndMaxStockModel priceAndStock in lstPriceAndStock)
                {
                    TunnelConfigModel tc = new TunnelConfigModel();
                    tc.MachineId    = machineId;
                    tc.TunnelId     = priceAndStock.tid;
                    tc.CashPrices   = priceAndStock.p1;
                    tc.IcPrices     = priceAndStock.p1;
                    tc.WpayPrices   = priceAndStock.p1;
                    tc.AlipayPrices = priceAndStock.p1;


                    GenerateDal.Update(CommonSqlKey.UpdateCashPrice, tc);
                }
                PostToMachine(machineId, "p");
                //操作日志
                operationService.PostData(new OperationLogModel()
                {
                    MachineId = machineId, OptContent = "机器端设置价格和库存"
                });
                GenerateDal.CommitTransaction();
            }
            catch (Exception e)
            {
                //GenerateDal.RollBack();
                return(0);
            }
            return(1);
        }
Пример #11
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public int DeleteData(string id)
        {
            ConfigModel configInfo = new ConfigModel();

            configInfo.Id = id;
            return(GenerateDal.Delete <ConfigModel>(CommonSqlKey.DeletePayConfig, configInfo));
        }
Пример #12
0
        public int GetCount(ProductForMachineModel machineInfo)
        {
            var result = 0;


            var conditions = new List <Condition>();

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

            result = GenerateDal.LoadDataTableByConditions(CommonSqlKey.GetProductByMachineCount, conditions).Rows.Count;

            return(result);
        }
Пример #13
0
        public List <ConfigModel> GetAll(ConfigModel configInfo)
        {
            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 = "client_id",
                ParamValue   = clientIds,
                Operation    = ConditionOperate.INWithNoPara,
                RightBrace   = "",
                Logic        = ""
            });

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

            return(GenerateDal.LoadByConditions <ConfigModel>(CommonSqlKey.GetPayConfigList, conditions));
        }
Пример #14
0
        public List <TotalMoneyModel> GetAll(TotalMoneyModel totalMoneyInfo)
        {
            string userClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();

            if (string.IsNullOrEmpty(userClientId))
            {
                return(null);
            }
            var userStatus = HttpContextHandler.GetHeaderObj("Sts").ToString();

            if (string.IsNullOrEmpty(userStatus))
            {
                return(null);
            }
            var dics = new Dictionary <string, object>();

            if (userStatus == "100" || userStatus == "99")
            {
                dics.Add("ClientId", "self");
            }
            else
            {
                dics.Add("ClientId", userClientId);
            }



            return(GenerateDal.Load <TotalMoneyModel>(CommonSqlKey.GetTotalMoneyByClient, dics));
        }
Пример #15
0
        // 根据订单号更新出货结果
        public int PutPayResultByOrderNo(string tradeNo, bool result)
        {
            try
            {
                var conditions = new List <Condition>();

                conditions.Add(new Condition
                {
                    LeftBrace    = " AND ",
                    ParamName    = "TradeNo",
                    DbColumnName = "trade_no",
                    ParamValue   = tradeNo,
                    Operation    = ConditionOperate.Equal,
                    RightBrace   = "",
                    Logic        = ""
                });
                List <SaleModel> lstSaleModel = GenerateDal.LoadByConditions <SaleModel>(CommonSqlKey.GetSalesByNo, conditions);
                if (lstSaleModel.Count == 0)
                {
                    return(2);
                }
                GenerateDal.BeginTransaction();

                SaleModel saleModel = lstSaleModel[0];
                if (saleModel != null && saleModel.TradeStatus == 1)
                {
                    //SaleModel saleInfo = new SaleModel();
                    saleModel.SalesDate         = DateTime.Now;
                    saleModel.RealitySaleNumber = 1;
                    if (result)
                    {
                        saleModel.TradeStatus = 2;
                    }
                    else
                    {
                        saleModel.RealitySaleNumber = 0;
                        saleModel.TradeStatus       = 5;
                        UpdateAddCurrStock(saleModel.MachineId, saleModel.GoodsId, 1);
                    }
                    GenerateDal.Update(CommonSqlKey.UpdatePayResult, saleModel);
                }
                GenerateDal.CommitTransaction();
                RefundService refund = new RefundService();
                if (saleModel.PayInterface == "微信")
                {
                    refund.PostRefundW(lstSaleModel);
                }
                else if (saleModel.PayInterface == "支付宝")
                {
                    refund.PostRefundA(lstSaleModel);
                }
            }
            catch (Exception e)
            {
                return(0);
            }

            return(1);
        }
Пример #16
0
        public int GetCount(PrivilegeModel privilegeInfo)
        {
            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 = "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        = ""
                });
            }

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

            return(result);
        }
Пример #17
0
        public List <AuthModel> GetAll(AuthModel authInfo)
        {
            //var x = HttpContextHandler.GetHeaderObj("UserAccount");
            var conditions = new List <Condition>();

            conditions.AddRange(CreatePaginConditions(authInfo.PageIndex, authInfo.PageSize));
            return(GenerateDal.LoadByConditions <AuthModel>(CommonSqlKey.GetAuth, conditions));
        }
Пример #18
0
        //心跳包
        public DataTable GetBeepHeart(string machineId)
        {
            IDictionary <string, object> dicParam = new Dictionary <string, object>();

            dicParam.Add("P_MachineId", machineId);
            UpdateMachineInlineTime(machineId);
            return(GenerateDal.LoadDataTable(CommonSqlKey.GetBeepHeart, dicParam));
        }
Пример #19
0
        /// <summary>
        /// 新增/修改会员信息
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(MachineLocationModel machineLocationInfo)
        {
            int result;

            result = GenerateDal.Create(machineLocationInfo);

            return(result);
        }
Пример #20
0
 public int UpdateData(WebSettingModel webSettingInfo)
 {
     if (string.IsNullOrEmpty(webSettingInfo.ClientId))
     {
         webSettingInfo.ClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
     }
     return(GenerateDal.Update(CommonSqlKey.UpdateWechatInfo, webSettingInfo));
 }
Пример #21
0
        /// <summary>
        /// 新增/修改会员信息
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(TunnelInfoModel tunnelInfoInfo)
        {
            int result;

            tunnelInfoInfo.UpdateDate = DateTime.Now;
            result = GenerateDal.Create(tunnelInfoInfo);

            return(result);
        }
Пример #22
0
        public int UpdateMachineInlineTime(string machineId)
        {
            MachineListModel machineList = new MachineListModel();

            machineList.MachineId  = machineId;
            machineList.LatestDate = DateTime.Now;

            return(GenerateDal.Update(CommonSqlKey.UpdateMachineInlineTime, machineList));
        }
Пример #23
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);
        }
Пример #24
0
 public int PostData(WebSettingModel webSettingInfo)
 {
     if (string.IsNullOrEmpty(webSettingInfo.ClientId))
     {
         webSettingInfo.ClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString();
     }
     webSettingInfo.Id = Guid.NewGuid().ToString();
     return(GenerateDal.Create <WebSettingModel>(webSettingInfo));
 }
Пример #25
0
        //支付后更新减库存
        private void UpdateCurrStock(string machineId, string tunnelId, int saleNumber)
        {
            TunnelInfoModel tunnelInfo = new TunnelInfoModel();

            tunnelInfo.MachineId  = machineId;
            tunnelInfo.GoodsStuId = tunnelId;
            tunnelInfo.CurrStock  = saleNumber;
            GenerateDal.Execute(CommonSqlKey.UpdateCurrStock, tunnelInfo);
        }
Пример #26
0
        public int UpdateData(ProductListModel productListInfo)
        {
            productListInfo.UpdateDate = DateTime.Now;
            string userAccount = HttpContextHandler.GetHeaderObj("UserAccount").ToString();

            productListInfo.Creator    = userAccount;
            productListInfo.UpdateDate = DateTime.Now;
            return(GenerateDal.Update(CommonSqlKey.UpdateProductList, productListInfo));
        }
Пример #27
0
        /// <summary>
        /// 新增/修改会员信息
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(CashEquipmentModel cashEquipmentInfo)
        {
            int result;

            result = GenerateDal.Create(cashEquipmentInfo);


            return(result);
        }
Пример #28
0
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public int DeleteData(string id)
        {
            CashEquipmentModel cashEquipmentInfo = new CashEquipmentModel();

            cashEquipmentInfo.Id = id;
            return(GenerateDal.Delete <CashEquipmentModel>(CommonSqlKey.DeleteCashSale, cashEquipmentInfo));

            return(0);
        }
Пример #29
0
        //向机器下行当前补货库存
        public DataTable GetToMachineStock(string machineId, int startNo, int len)
        {
            var conditions = new List <Condition>();

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



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

            conditions.Add(new Condition
            {
                LeftBrace    = "",
                ParamName    = "Index",
                DbColumnName = "",
                ParamValue   = startNo,
                Operation    = ConditionOperate.LimitIndex,
                RightBrace   = "",
                Logic        = ""
            });

            conditions.Add(new Condition
            {
                LeftBrace    = "",
                ParamName    = "Length",
                DbColumnName = "",
                ParamValue   = len,
                Operation    = ConditionOperate.LimitLength,
                RightBrace   = "",
                Logic        = ""
            });


            return(GenerateDal.LoadDataTableByConditions(CommonSqlKey.ToMachineStock, conditions));
        }
Пример #30
0
        /// <summary>
        /// 新增/修改会员信息
        /// </summary>
        /// <param name="memberInfo"></param>
        /// <returns></returns>
        public int PostData(ActivityPrivilegeRelationModel relationInfo)
        {
            int result;

            result = GenerateDal.Create(relationInfo);



            return(result);
        }