//根据设备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); } }
//根据商品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(""); } }
public int DeleteData(string id) { MachineCabinetModel machineCabinetInfo = new MachineCabinetModel(); machineCabinetInfo.CabinetId = id; return(GenerateDal.Delete <MachineCabinetModel>(CommonSqlKey.DeleteMachineCabinet, machineCabinetInfo)); }
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)); }
/// <summary> /// 删除用户 /// </summary> /// <returns></returns> public int DeleteData(string id) { ProductConfigModel productConfigInfo = new ProductConfigModel(); productConfigInfo.WaresConfigId = id; return(GenerateDal.Delete <ProductConfigModel>(CommonSqlKey.DeleteProductConfig, productConfigInfo)); }
/// <summary> /// 删除用户 /// </summary> /// <returns></returns> public int DeleteData(string id) { ProductGroupRelationModel productListInfo = new ProductGroupRelationModel(); productListInfo.WaresGroupId = id; return(GenerateDal.Delete <ProductGroupRelationModel>(CommonSqlKey.DeleteProductGroupRelation, productListInfo)); }
/// <summary> /// 删除用户 /// </summary> /// <returns></returns> public int DeleteData(string id) { MachineLocationModel machineLocationInfo = new MachineLocationModel(); machineLocationInfo.MachineId = id; return(GenerateDal.Delete <MachineLocationModel>(CommonSqlKey.DeleteMachineLocation, machineLocationInfo)); }
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(""); } }
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); }
//机器端设置现金价格 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); }
/// <summary> /// 删除用户 /// </summary> /// <returns></returns> public int DeleteData(string id) { ConfigModel configInfo = new ConfigModel(); configInfo.Id = id; return(GenerateDal.Delete <ConfigModel>(CommonSqlKey.DeletePayConfig, configInfo)); }
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); }
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)); }
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)); }
// 根据订单号更新出货结果 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); }
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); }
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)); }
//心跳包 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)); }
/// <summary> /// 新增/修改会员信息 /// </summary> /// <param name="memberInfo"></param> /// <returns></returns> public int PostData(MachineLocationModel machineLocationInfo) { int result; result = GenerateDal.Create(machineLocationInfo); return(result); }
public int UpdateData(WebSettingModel webSettingInfo) { if (string.IsNullOrEmpty(webSettingInfo.ClientId)) { webSettingInfo.ClientId = HttpContextHandler.GetHeaderObj("UserClientId").ToString(); } return(GenerateDal.Update(CommonSqlKey.UpdateWechatInfo, webSettingInfo)); }
/// <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); }
public int UpdateMachineInlineTime(string machineId) { MachineListModel machineList = new MachineListModel(); machineList.MachineId = machineId; machineList.LatestDate = DateTime.Now; return(GenerateDal.Update(CommonSqlKey.UpdateMachineInlineTime, machineList)); }
//一键补货操作 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); }
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)); }
//支付后更新减库存 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); }
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)); }
/// <summary> /// 新增/修改会员信息 /// </summary> /// <param name="memberInfo"></param> /// <returns></returns> public int PostData(CashEquipmentModel cashEquipmentInfo) { int result; result = GenerateDal.Create(cashEquipmentInfo); return(result); }
/// <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); }
//向机器下行当前补货库存 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)); }
/// <summary> /// 新增/修改会员信息 /// </summary> /// <param name="memberInfo"></param> /// <returns></returns> public int PostData(ActivityPrivilegeRelationModel relationInfo) { int result; result = GenerateDal.Create(relationInfo); return(result); }