public object QueryJackpotInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[1]; string sqlWhere = string.Empty; parameters[0] = new SqlParameter("@MerchId", merchId); if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.* from Data_JackpotInfo a where a.MerchInfo=@MerchId"; sql = sql + sqlWhere; IData_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>(); var data_JackpotInfo = data_JackpotInfoService.SqlQuery <Data_JackpotInfo>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_JackpotInfo)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryPushRule(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select b.GameID, b.GameName, a.ID, a.MemberLevelName, a.Week, a.Allow_Out, a.Allow_In, a.Coin, a.Level, a.StartTime as ST, a.EndTime as ET from Data_Push_Rule a " + " inner join Data_GameInfo b on a.GameIndexID=b.ID " + " where b.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IData_Push_RuleService data_Push_RuleService = BLLContainer.Resolve <IData_Push_RuleService>(); var data_Push_Rule = data_Push_RuleService.SqlQuery <Data_Push_RuleList>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Push_Rule)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryWorkstation(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.* from Data_Workstation a where a.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IData_WorkstationService data_WorkstationService = BLLContainer.Resolve <IData_WorkstationService>(); var data_Workstation = data_WorkstationService.SqlQuery(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Workstation)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryFreeRule(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select c.ID, b.GameID, b.GameName, d.MemberLevelName as MemberLevelName, (case c.RuleType when 0 then '模拟机' when 1 then '博彩机' else '' end) as RuleTypeStr, " + " c.NeedCoin, c.FreeCoin, c.ExitCoin, c.StartTime as ST, c.EndTime as ET, c.State from Data_GameFreeRule_List a " + " inner join Data_GameInfo b on a.GameIndexID=b.ID " + " inner join Data_GameFreeRule c on a.RuleID=c.ID " + " left join Data_MemberLevel d on c.MemberLevelID=d.MemberLevelID" + " where b.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IData_GameFreeRuleService data_GameFreeRuleService = BLLContainer.Resolve <IData_GameFreeRuleService>(); var data_GameFreeRule = data_GameFreeRuleService.SqlQuery <Data_GameFreeRuleList>(sql, parameters).ToList(); var linq = from a in data_GameFreeRule group a by new { ID = a.ID } into g select new { g.Key.ID, GameID = string.Join("|", g.Select(p => p.GameID)), GameName = string.Join("|", g.Select(p => p.GameName)), MemberLevelName = g.Max(p => p.MemberLevelName), RuleTypeStr = g.Max(p => p.RuleTypeStr), NeedCoin = g.Max(p => p.NeedCoin), FreeCoin = g.Max(p => p.FreeCoin), ExitCoin = g.Max(p => p.ExitCoin), StartTime = g.Max(p => p.StartTime), EndTime = g.Max(p => p.EndTime), State = g.Max(p => p.State) }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetMerchList(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; //代理商仅能查所属商户,普通商户或大客户只能查自己,莘宸管理员可以查所有商户 SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (userTokenKeyModel.LogType == (int)RoleType.MerchUser) { var merchIdDataModel = userTokenKeyModel.DataModel as MerchDataModel; Array.Resize(ref parameters, parameters.Length + 1); if (merchIdDataModel.MerchType == (int)MerchType.Agent) { parameters[parameters.Length - 1] = new SqlParameter("@logId", userTokenKeyModel.LogId); sqlWhere = sqlWhere + " and a.CreateUserID=@logId"; } else { parameters[parameters.Length - 1] = new SqlParameter("@merchId", merchIdDataModel.MerchID); sqlWhere = sqlWhere + " and a.MerchID=@merchId"; } } if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.MerchID, a.MerchName, a.Mobil, b.DictKey as MerchTypeStr, a.MerchAccount, d.DictKey as AllowCreateSubStr, a.AllowCreateCount, c.DictKey as MerchStatusStr from Base_MerchantInfo a " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='商户类别' and a.PID=0) b on convert(varchar, a.MerchType)=b.DictValue " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='商户状态' and a.PID=0) c on convert(varchar, a.MerchStatus)=c.DictValue " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='创建子账号' and a.PID=0) d on convert(varchar, a.AllowCreateSub)=d.DictValue " + " where 1=1 "; sql = sql + sqlWhere; var dbContext = DbContextFactory.CreateByModelNamespace(typeof(Base_MerchantInfo).Namespace); var base_MerchantInfo = dbContext.Database.SqlQuery <Base_MerchantInfoListModel>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, base_MerchantInfo)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetOrders(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@merchId", merchId); string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "b.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select b.ID, a.StoreID, a.StoreName, b.OrderID, b.FoodCount, b.OrderSource, b.CreateTime, b.PayType, b.OrderStatus," + " c.DictKey as OrderSourceStr, d.DictKey as PayTypeStr, e.DictKey as OrderStatusStr, f.FoodName from Base_StoreInfo a " + " inner join Flw_Order b on a.StoreID=b.StoreID " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='订单来源' and a.PID=0) c on convert(varchar, b.OrderSource)=c.DictValue " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='支付通道' and a.PID=0) d on convert(varchar, b.PayType)=d.DictValue " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='订单状态' and a.PID=0) e on convert(varchar, b.OrderStatus)=e.DictValue " + " left join (select top 1 a.ID as OrderFlwID, d.FoodName from Flw_Order a inner join Flw_Order_Detail b on a.ID=b.OrderFlwID " + " inner join Flw_Food_Sale c on b.FoodFlwID=c.ID " + " inner join Data_FoodInfo d on c.FoodID=d.FoodID) f on b.ID=f.OrderFlwID " + " where a.MerchID=@merchId "; sql = sql + sqlWhere; var dbContext = DbContextFactory.CreateByModelNamespace(typeof(Flw_Order).Namespace); var flw_Orders = dbContext.Database.SqlQuery <Flw_OrdersModel>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, flw_Orders)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryCouponInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[1]; string sqlWhere = string.Empty; parameters[0] = new SqlParameter("@MerchId", merchId); if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.ID, a.CouponName, b.DictKey as CouponTypeStr, a.PublishCount, (a.PublishCount - isnull(c.UseCount, 0) - isnull(d.UseCount, 0)) as LeftCount, " + " (case when a.StartTime is null or a.StartTime='' then '' else convert(varchar,a.StartTime,23) end) as StartTime, (case when a.EndTime is null or a.EndTime='' then '' else convert(varchar,a.EndTime,23) end) as EndTime, " + " a.Context from Data_CouponInfo a" + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='优惠券类别' and a.PID=0) b on convert(varchar, a.CouponType)=b.DictValue " + " left join (select a.ID as CouponID, count(c.ID) as UseCount from Data_CouponInfo a inner join Data_CouponList b on a.ID=b.CouponID inner join Flw_CouponUse c on b.ID=c.CouponCode) c on a.ID=c.CouponID " + " left join (select a.ID as CouponID, count(b.ID) as UseCount from Data_CouponInfo a inner join Flw_CouponUse b on a.ID=b.CouponID) d on a.ID=d.CouponID " + " where a.MerchID=@MerchId"; sql = sql + sqlWhere; IData_CouponInfoService data_CouponInfoService = BLLContainer.Resolve <IData_CouponInfoService>(); var data_CouponInfo = data_CouponInfoService.SqlQuery <Data_CouponInfoModel>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_CouponInfo)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryGoodInventory(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.ID, c.DictKey as InventoryTypeStr, (case when a.InventoryType=1 then d.WorkStation when a.InventoryType=3 then e.HeadName else '' end) as InventoryIndexName, a.InventoryTime, a.UserID, b.RealName, a.InventoryCount, a.Note from Data_GoodInventory a " + " left join Base_UserInfo b on a.UserID=b.UserID " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='盘点类别' and a.PID=0) c on convert(varchar, a.InventoryType)=c.DictValue " + " left join Data_Workstation d on a.InventoryType=1 and a.InventoryIndex=d.ID " + " left join Data_Head e on a.InventoryType=3 and a.InventoryIndex=e.ID " + " where a.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IData_GoodInventoryService data_GoodInventoryService = BLLContainer.Resolve <IData_GoodInventoryService>(); var data_GoodInventory = data_GoodInventoryService.SqlQuery <Data_GoodInventoryList>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_GoodInventory)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryReloadGifts(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.ID, (case when a.RealTime is null or a.RealTime='' then '' else convert(varchar,a.RealTime,23) end) as RealTime, c.HeadName, d.DictKey as ReloadTypeName, b.LogName, a.ReloadCount, a.Note from Data_Reload a " + " left join Base_UserInfo b on a.UserID=b.UserID " + " left join Data_Head c on a.DeviceID=c.ID " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='安装类别' and a.PID=0) d on convert(varchar, a.ReloadType)=d.DictValue " + " where b.StoreID='" + storeId + "' and deviceType=2 and ReloadType=3 " + " order by c.HeadName, a.RealTime desc"; sql = sql + sqlWhere; IData_ReloadService data_ReloadService = BLLContainer.Resolve <IData_ReloadService>(); var data_Reload = data_ReloadService.SqlQuery <Data_ReloadModelList>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Reload)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryGoodsInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null; SqlParameter[] parameters = new SqlParameter[0]; string sqlWhere = string.Empty; if (conditions != null && conditions.Length > 0) { if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } string sql = @"select a.ID, a.GoodName, a.Price, a.Points, a.Note, c.DictKey as GoodTypeStr from Base_GoodsInfo a " + " left join Base_StoreInfo b on a.MerchID=b.MerchID " + " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='商品类别' and a.PID=0) c on convert(varchar, a.GoodType)=c.DictValue " + " where a.Status=1 and b.StoreID='" + storeId + "'"; sql = sql + sqlWhere; IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>(); var base_GoodsInfo = base_GoodsInfoService.SqlQuery <Base_GoodsInfoList>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, base_GoodsInfo)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }