public object GetGameInfo(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; if (string.IsNullOrEmpty(id)) { errMsg = "游戏机流水号不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iId = Convert.ToInt32(id); IData_GameInfoService data_GameInfoService = BLLContainer.Resolve <IData_GameInfoService>(resolveNew: true); if (!data_GameInfoService.Any(a => a.ID == iId)) { errMsg = "该游戏机信息不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>(resolveNew: true); int GameInfoId = dict_SystemService.GetModels(p => p.DictKey.Equals("游戏机档案维护")).FirstOrDefault().ID; var result = from a in data_GameInfoService.GetModels(p => p.ID == iId).FirstOrDefault().AsDictionary() join b in dict_SystemService.GetModels(p => p.PID == GameInfoId) on a.Key equals b.DictKey into b1 from b in b1.DefaultIfEmpty() select new { name = a.Key, value = a.Value, comment = b != null ? b.Comment : string.Empty }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public static bool IsEffectiveStore(string mobile, ref XCCloudService.Model.XCCloudRS232.t_member memberModel, out string errMsg) { errMsg = string.Empty; XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>(); var model = memberService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.t_member>(); if (model == null) { errMsg = "会员信息不存在"; return(false); } else if (model.Lock == 1) { errMsg = "会员已被锁定"; return(false); } else { memberModel = model; return(true); } }
public object AddFoods(Dictionary <string, object> dicParas) { try { string MobileToken = dicParas.ContainsKey("mobileToken") ? dicParas["mobileToken"].ToString() : string.Empty; //获取手机令牌 string DeviceToken = dicParas.ContainsKey("deviceToken") ? dicParas["deviceToken"].ToString() : string.Empty; //获取设备token string FoodName = dicParas.ContainsKey("foodname") ? dicParas["foodname"].ToString() : string.Empty; //获取套餐名称 string FoodPrice = dicParas.ContainsKey("foodprice") ? dicParas["foodprice"].ToString() : string.Empty; //获取套餐价格 string CoinQuantity = dicParas.ContainsKey("coinquantity") ? dicParas["coinquantity"].ToString() : string.Empty; //获取币数量 string IsQuickFood = dicParas.ContainsKey("isquickfood") ? dicParas["isquickfood"].ToString() : string.Empty; //获取是否允许散客购买0不允许,1允许 string FoodState = dicParas.ContainsKey("foodstate") ? dicParas["foodstate"].ToString() : string.Empty; //获取是否有效 1有效 IMerchService merchService = BLLContainer.Resolve <IMerchService>("XCCloudRS232"); var merchlist = merchService.GetModels(x => x.Token == MobileToken && x.State == 1).FirstOrDefault <Base_MerchInfo>(); if (merchlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "手机令牌无效")); } var devicelist = DeviceBusiness.GetDeviceModel(DeviceToken); if (devicelist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备令牌无效")); } t_foods foods = new t_foods(); IFoodsService foodsService = BLLContainer.Resolve <IFoodsService>("XCCloudRS232"); foods.MerchID = merchlist.ID; foods.DeviceID = devicelist.ID; foods.FoodName = FoodName; foods.FoodPrice = Convert.ToDecimal(FoodPrice); foods.IsQuickFood = int.Parse(IsQuickFood); foods.FoodState = int.Parse(FoodState); foods.CoinQuantity = int.Parse(CoinQuantity); foodsService.Add(foods); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } catch (Exception e) { throw e; } }
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 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)); } }
/// <summary> /// H5页面微信授权 /// </summary> private void H5AuthCommon(string code) { string accsess_token = string.Empty; string refresh_token = string.Empty; string openId = string.Empty; string errMsg = string.Empty; try { if (TokenMana.GetTokenForScanQR(code, out accsess_token, out refresh_token, out openId, out errMsg)) { bool isReg = false; IMobileTokenService mobileTokenService = BLLContainer.Resolve <IMobileTokenService>(); var mobileTokenModel = mobileTokenService.GetModels(p => p.OpenId.Equals(openId)).FirstOrDefault <t_MobileToken>(); if (mobileTokenModel != null) { IMemberTokenService memberTokenService = BLLContainer.Resolve <IMemberTokenService>(); var memberTokenModel = mobileTokenService.GetModels(p => p.OpenId.Equals(openId)).FirstOrDefault <t_MobileToken>(); if (memberTokenModel != null) { isReg = true; } } string redirectUrl = string.Format("{0}?openId={1}&isReg={2}", CommonConfig.H5WeiXinAuthRedirectUrl, openId, Convert.ToInt32(isReg)); Response.Redirect(redirectUrl); } else { LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Common, TxtLogFileType.Day, "errMsg:" + errMsg); //重定向的错误页面 Response.Redirect(WeiXinConfig.RedirectErrorPage); } } catch (Exception e) { LogHelper.SaveLog(TxtLogType.WeiXin, TxtLogContentType.Exception, TxtLogFileType.Day, "Exception:" + e.Message); } }
public object GetStoreList(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); var result = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)) select new { StoreID = a.StoreID, StoreName = a.StoreName }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetParamList(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty; //验证参数信息 if (!checkParams(dicParas, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } IData_ParametersService data_ParameterService = BLLContainer.Resolve <IData_ParametersService>(); var data_Parameter = data_ParameterService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Parameter)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetGameInfoList(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>(resolveNew: true); int GameTypeId = dict_SystemService.GetModels(p => p.DictKey.Equals("游戏机类型")).FirstOrDefault().ID; IData_GameInfoService data_GameInfoService = BLLContainer.Resolve <IData_GameInfoService>(resolveNew: true); var data_GameInfo = from a in data_GameInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)) join b in dict_SystemService.GetModels(p => p.PID == GameTypeId) on a.GameType equals b.DictValue into b1 from b in b1.DefaultIfEmpty() orderby a.GameID select new { ID = a.ID, GameID = a.GameID, GameName = a.GameName, GameTypeStr = b != null ? b.DictKey : string.Empty, PushReduceFromCard = a.PushReduceFromCard, AllowElecPushStr = a.AllowElecPush != null ? (a.AllowElecPush == 1 ? "启用" : "禁用") : "", LotteryModeStr = a.LotteryMode != null ? (a.LotteryMode == 1 ? "启用" : "禁用") : "", ReadCatStr = a.ReadCat != null ? (a.ReadCat == 1 ? "启用" : "禁用") : "", StateStr = !string.IsNullOrEmpty(a.State) ? (a.State == "1" ? "启用" : "禁用") : "" }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_GameInfo)); } 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)); } }
public object GetOrdersDetails(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; int orderFlwId = (dicParas.ContainsKey("id") && Utils.isNumber(dicParas["id"])) ? Convert.ToInt32(dicParas["id"]) : 0; IFlw_OrderService flw_OrderService = BLLContainer.Resolve <IFlw_OrderService>(); if (!flw_OrderService.Any(p => p.ID == orderFlwId)) { errMsg = "该订单不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@id", orderFlwId); string sql = @"select d.*, e.StoreName, f.DictKey as FoodTypeStr, g.DictKey as RechargeTypeStr, h.DictKey as FoodStateStr 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 " + " left join Base_StoreInfo e on d.StoreID=e.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) f on convert(varchar, d.FoodType)=f.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) g on convert(varchar, d.RechargeType)=g.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) h on convert(varchar, d.FoodState)=h.DictValue " + " where a.ID=@id "; var dbContext = DbContextFactory.CreateByModelNamespace(typeof(Data_FoodInfo).Namespace); var data_FoodInfo = dbContext.Database.SqlQuery <Data_FoodInfoModel>(sql, parameters).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_FoodInfo)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object getLotteryInfo(Dictionary <string, object> dicParas) { string gameName = string.Empty; string headInfo = string.Empty; string barCode = dicParas.ContainsKey("barCode") ? dicParas["barCode"].ToString() : string.Empty; if (string.IsNullOrEmpty(barCode)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入条码编号")); } XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]); StoreBusiness store = new StoreBusiness(); string errMsg = string.Empty; StoreCacheModel storeModel = null; StoreBusiness storeBusiness = new StoreBusiness(); if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } if (storeModel.StoreDBDeployType == 0) { XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService lotteryService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService>(storeModel.StoreDBName); XCCloudService.BLL.IBLL.XCGame.IHeadService headService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IHeadService>(storeModel.StoreDBName); XCCloudService.BLL.IBLL.XCGame.IGameService gameService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IGameService>(storeModel.StoreDBName); var lotteryModel = lotteryService.GetModels(p => p.Barcode.Equals(barCode)).FirstOrDefault <flw_lottery>(); if (lotteryModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "彩票信息不存在")); } if (!string.IsNullOrEmpty(lotteryModel.HeadID)) { //var headModel = headService.GetModels(p => p.HeadAddress.Equals(lotteryModel.HeadID)).FirstOrDefault<t_head>(); headInfo = lotteryModel.HeadID; } else { headInfo = lotteryModel.WorkStation; } if (!string.IsNullOrEmpty(lotteryModel.GameID)) { var gameModel = gameService.GetModels(p => p.GameID.Equals(lotteryModel.GameID)).FirstOrDefault <t_game>(); if (gameModel != null) { gameName = gameModel.GameName; } else { gameName = string.Empty; } } else { gameName = string.Empty; } XCCloudService.BLL.IBLL.XCGame.IParametersService parametersService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IParametersService>(storeModel.StoreDBName); var paramDateValidityModel = parametersService.GetModels(p => p.System.Equals("rbnBackDateValidity", StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_parameters>(); if (paramDateValidityModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "返分卡有效期参数未设置,不能兑换")); } int state = Convert.ToInt32(lotteryModel.State); string stateName = lotteryModel.State == 1 ? "已兑" : "未兑"; if (state != 1) { DateTime dateTime = Convert.ToDateTime(lotteryModel.PrintTime).AddDays(Convert.ToDouble(paramDateValidityModel.ParameterValue)); if (System.DateTime.Now > dateTime) { state = 2; stateName = "已过期"; } } string printTime = Convert.ToDateTime(lotteryModel.PrintTime).ToString("yyyy-MM-dd HH:mm:ss"); string realTime = Convert.ToDateTime(lotteryModel.RealTime).ToString("yyyy-MM-dd HH:mm:ss"); var obj = new { id = lotteryModel.id, lottery = lotteryModel.LotteryCount, //彩票数 gameName = gameName, //游戏机名 headInfo = headInfo, //出票位置 state = stateName, //小票状态 makeTime = printTime.Substring(0, 10) == "0001-01-01" ? "" : printTime, //出票时间 }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj)); } else if (storeModel.StoreDBDeployType == 1) { string sn = System.Guid.NewGuid().ToString().Replace("-", ""); UDPSocketCommonQueryAnswerModel answerModel = null; string radarToken = string.Empty; //string storeId, string storePassword, string barCode,string icCardId,string mobileName, string phone, string operate, out string errMsg if (DataFactory.SendDataLotteryQuery(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, barCode, out radarToken, out errMsg)) { } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } answerModel = null; int whileCount = 0; while (answerModel == null && whileCount <= 25) { //获取应答缓存数据 whileCount++; System.Threading.Thread.Sleep(1000); answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1); } if (answerModel != null) { LotteryQueryResultNotifyRequestModel model = (LotteryQueryResultNotifyRequestModel)(answerModel.Result); //移除应答缓存数据 UDPSocketCommonQueryAnswerBusiness.Remove(sn); if (model.Result_Code == "1") { var obj = new { id = model.Result_Data.Id, lottery = model.Result_Data.Lottery, //彩票数 gameName = model.Result_Data.GameName, //游戏机名 headInfo = model.Result_Data.HeadInfo, //出票位置 state = model.Result_Data.State, //小票状态 makeTime = model.Result_Data.PrintDate //出票时间 }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj)); } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg)); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应")); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店配置无效")); } }
public object exchangeLottery(Dictionary <string, object> dicParas) { XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]); string barCode = dicParas.ContainsKey("barCode") ? dicParas["barCode"].ToString() : string.Empty; string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty; string mobileName = dicParas.ContainsKey("mobileName") ? dicParas["mobileName"].ToString() : string.Empty; if (string.IsNullOrEmpty(barCode)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入条码编号")); } StoreBusiness store = new StoreBusiness(); string errMsg = string.Empty; StoreCacheModel storeModel = null; StoreBusiness storeBusiness = new StoreBusiness(); if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } if (storeModel.StoreDBDeployType == 0) { XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService lotteryService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFlwLotteryService>(storeModel.StoreDBName); XCCloudService.BLL.IBLL.XCGame.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IMemberService>(storeModel.StoreDBName); XCCloudService.BLL.IBLL.XCGame.IScheduleService scheduleService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IScheduleService>(storeModel.StoreDBName); System.DateTime startTime = System.DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"); System.DateTime endTime = System.DateTime.Parse(System.DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"); var lotteryModel = lotteryService.GetModels(p => p.Barcode.Equals(barCode)).FirstOrDefault <flw_lottery>(); var memberModel = memberService.GetModels(p => p.ICCardID.ToString().Equals(icCardId)).FirstOrDefault <t_member>(); var scheduleModel = scheduleService.GetModels(p => (p.OpenTime >= startTime && p.OpenTime <= endTime && p.UserID == userTokenModel.XCGameUserId && p.State.Equals("0"))).FirstOrDefault <flw_schedule>(); if (scheduleModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "用户班次信息不存在")); } if (lotteryModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "彩票信息不存在")); } if (lotteryModel.State == 1) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "当前彩票已使用")); } if (memberModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员信息不存在")); } XCCloudService.BLL.IBLL.XCGame.IParametersService parametersService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IParametersService>(storeModel.StoreDBName); var paramDateValidityModel = parametersService.GetModels(p => p.System.Equals("rbnBackDateValidity", StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_parameters>(); if (paramDateValidityModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "返分卡有效期参数未设置,不能兑换")); } DateTime dateTime = Convert.ToDateTime(lotteryModel.PrintTime).AddDays(Convert.ToInt32(paramDateValidityModel.ParameterValue)); if (System.DateTime.Now > dateTime) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "已过期,不能兑换")); } using (TransactionScope ts = new TransactionScope()) { try { lotteryModel.State = 1; lotteryModel.RealTime = System.DateTime.Now; lotteryModel.ICCardID = int.Parse(icCardId); lotteryModel.UserID = userTokenModel.XCGameUserId; lotteryModel.ScheduleID = scheduleModel.ID; lotteryModel.WorkStation = userTokenModel.Mobile; memberModel.Lottery = Convert.ToInt32(memberModel.Lottery) + lotteryModel.LotteryCount; memberModel.ModTime = System.DateTime.Now; lotteryService.Update(lotteryModel); memberService.Update(memberModel); ts.Complete(); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } catch (Exception e) { throw e; } } } else if (storeModel.StoreDBDeployType == 1) { string sn = System.Guid.NewGuid().ToString().Replace("-", ""); UDPSocketCommonQueryAnswerModel answerModel = null; string radarToken = string.Empty; //发送彩票操作 if (DataFactory.SendDataLotteryOperate(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, barCode, icCardId, "0", mobileName, userTokenModel.Mobile, out radarToken, out errMsg)) { } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } answerModel = null; int whileCount = 0; while (answerModel == null && whileCount <= 25) { //获取应答缓存数据 whileCount++; System.Threading.Thread.Sleep(1000); answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1); } if (answerModel != null) { LotteryOperateResultNotifyRequestModel model = (LotteryOperateResultNotifyRequestModel)(answerModel.Result); //移除应答缓存数据 UDPSocketCommonQueryAnswerBusiness.Remove(sn); if (model.Result_Code == "1") { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg)); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应")); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, "门店配置无效")); } }
public ActionResult CreateBid(int productType, string bidDate, string bidStartTime, string bidEndTime, Nullable <decimal> estimateAmount, Nullable <decimal> currentPriceLower, Nullable <decimal> currentPriceUpper, Nullable <int> bidCount, Nullable <decimal> amountMin, Nullable <int> bidManner) { string errMsg = string.Empty; #region 验证参数 if (productType == 0) { errMsg = "产品类型不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidDate)) { errMsg = "竞价日期不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidStartTime)) { errMsg = "开始时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidEndTime)) { errMsg = "结束时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (estimateAmount == null) { errMsg = "预估量不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (estimateAmount <= 0) { errMsg = "预估量须大于0"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (currentPriceLower == null) { errMsg = "报价下限不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (currentPriceLower < 0) { errMsg = "报价下限须大于0"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (currentPriceUpper == null) { errMsg = "报价上限不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (currentPriceUpper < 0) { errMsg = "报价上限须大于0"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (currentPriceUpper < currentPriceLower) { errMsg = "报价上限须大于报价下限"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } #endregion IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); var data_BidManage = new Data_BidManage(); data_BidManage.ProductType = productType; data_BidManage.BidDate = Convert.ToDateTime(bidDate); data_BidManage.BidStartTime = Convert.ToDateTime(bidDate + " " + bidStartTime); data_BidManage.BidEndTime = Convert.ToDateTime(bidDate + " " + bidEndTime); data_BidManage.EstimateAmount = estimateAmount; data_BidManage.CurrentPriceLower = currentPriceLower; data_BidManage.CurrentPriceUpper = currentPriceUpper; data_BidManage.BidCount = bidCount; data_BidManage.AmountMin = amountMin; data_BidManage.BidManner = bidManner; data_BidManage.Publisher = (Session["loginUser"] as UserInfoCacheModel).UserName; data_BidManage.PublishTime = DateTime.Now; if (!data_BidManageService.Add(data_BidManage)) { return(RedirectToAction("Index", "BidManage", new { errMsg = "更新数据库失败" })); } return(RedirectToAction("Index", "BidManage", new { errMsg = "添加成功" })); }
public ActionResult UpdateBid(int id, int productType, string bidDate, string bidStartTime, string bidEndTime, Nullable <decimal> estimateAmount, Nullable <decimal> currentPriceLower, Nullable <decimal> currentPriceUpper, Nullable <int> bidCount, Nullable <decimal> amountMin, Nullable <int> bidManner) { string errMsg = string.Empty; #region 验证参数 if (id == 0) { errMsg = "竞价标的Id不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (productType == 0) { errMsg = "产品类型不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidDate)) { errMsg = "竞价日期不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidStartTime)) { errMsg = "开始时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } if (string.IsNullOrEmpty(bidEndTime)) { errMsg = "结束时间不能为空"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } #endregion IData_BidManageService data_BidManageService = BLLContainer.Resolve <IData_BidManageService>(); if (data_BidManageService.GetCount(p => p.ID == id) == 0) { errMsg = "该竞价标的不存在"; return(RedirectToAction("Index", "BidManage", new { errMsg = errMsg })); } var data_BidManage = data_BidManageService.GetModels(p => p.ID == id).FirstOrDefault(); data_BidManage.ProductType = productType; data_BidManage.BidDate = Convert.ToDateTime(bidDate); data_BidManage.BidStartTime = Convert.ToDateTime(bidDate + " " + bidStartTime); data_BidManage.BidEndTime = Convert.ToDateTime(bidDate + " " + bidEndTime); data_BidManage.EstimateAmount = estimateAmount; data_BidManage.CurrentPriceLower = currentPriceLower; data_BidManage.CurrentPriceUpper = currentPriceUpper; data_BidManage.BidCount = bidCount; data_BidManage.AmountMin = amountMin; data_BidManage.BidManner = bidManner; if (!data_BidManageService.Update(data_BidManage)) { return(RedirectToAction("Index", "BidManage", new { errMsg = "更新数据库失败" })); } return(RedirectToAction("Index", "BidManage", new { errMsg = "更新成功" })); }
public object PublishBill(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? dicParas["id"].ToString() : string.Empty; string title = dicParas.ContainsKey("title") ? dicParas["title"].ToString() : string.Empty; string publishType = dicParas.ContainsKey("publishType") ? dicParas["publishType"].ToString() : string.Empty; string promotionType = dicParas.ContainsKey("promotionType") ? dicParas["promotionType"].ToString() : string.Empty; string picturePath = dicParas.ContainsKey("picturePath") ? dicParas["picturePath"].ToString() : string.Empty; string pagePath = dicParas.ContainsKey("pagePath") ? dicParas["pagePath"].ToString() : string.Empty; #region 验证参数 if (!string.IsNullOrEmpty(id) && !Utils.isNumber(id)) { errMsg = "海报ID格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(title)) { errMsg = "标题不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(publishType)) { errMsg = "展示方式不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(promotionType)) { errMsg = "活动类别不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(pagePath)) { errMsg = "活动内容不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (title.Length > 50) { errMsg = "标题不能超过50字"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(publishType)) { errMsg = "展示方式须为整形"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(promotionType)) { errMsg = "活动类别须为整形"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion Data_BillInfo data_BillInfoModel = new Data_BillInfo(); IData_BillInfoService data_BillInfoService = BLLContainer.Resolve <IData_BillInfoService>(); if (!data_BillInfoService.Any(p => p.ID.ToString().Equals(id, StringComparison.OrdinalIgnoreCase))) { data_BillInfoModel.Title = title; data_BillInfoModel.PublishType = Convert.ToInt32(publishType); data_BillInfoModel.PromotionType = Convert.ToInt32(promotionType); data_BillInfoModel.PicturePath = picturePath; data_BillInfoModel.PagePath = pagePath; data_BillInfoModel.State = 1; data_BillInfoModel.Time = DateTime.Now; data_BillInfoModel.ReleaseTime = DateTime.Now; if (!data_BillInfoService.Add(data_BillInfoModel)) { errMsg = "发布海报失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } else { data_BillInfoModel = data_BillInfoService.GetModels(p => p.ID.ToString().Equals(id, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <Data_BillInfo>(); data_BillInfoModel.Title = title; data_BillInfoModel.PublishType = Convert.ToInt32(publishType); data_BillInfoModel.PromotionType = Convert.ToInt32(promotionType); data_BillInfoModel.PicturePath = picturePath; data_BillInfoModel.PagePath = pagePath; data_BillInfoModel.State = 1; data_BillInfoModel.ReleaseTime = DateTime.Now; if (!data_BillInfoService.Update(data_BillInfoModel)) { errMsg = "发布海报失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object getProject(Dictionary <string, object> dicParas) { try { string Barcode = dicParas.ContainsKey("barcode") ? dicParas["barcode"].ToString() : string.Empty; if (string.IsNullOrEmpty(Barcode)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门票条码无效")); } ITicketService ticketService = BLLContainer.Resolve <ITicketService>(); var ticketlist = ticketService.GetModels(x => x.TicketNo == Barcode).FirstOrDefault <t_ticket>(); if (ticketlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到门店号")); } int storeids = int.Parse(ticketlist.StoreId); IStoreService storeService = BLLContainer.Resolve <IStoreService>(); var menlist = storeService.GetModels(x => x.id == storeids).FirstOrDefault <t_store>(); if (menlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, "门店号无效")); } string dbname = menlist.store_dbname; IProject_buy_codelistService project_Buy_CodelistService = BLLContainer.Resolve <IProject_buy_codelistService>(dbname); var projectlist = project_Buy_CodelistService.GetModels(x => x.Barcode == Barcode).FirstOrDefault <flw_project_buy_codelist>(); if (projectlist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.F, "", Result_Code.T, "未查询到门票信息")); } Project_buy_codelistModel project_Buy_CodelistModel = new Project_buy_codelistModel(); project_Buy_CodelistModel.ID = projectlist.ID; if (projectlist.EndTime != null) { project_Buy_CodelistModel.EndTimes = Convert.ToDateTime(projectlist.EndTime).ToString("yyyy-MM-dd"); } IProjectService projectService = BLLContainer.Resolve <IProjectService>(dbname); var projectlist1 = projectService.GetModels(x => x.id == projectlist.ProjectID).FirstOrDefault <t_project>(); if (projectlist1 != null) { project_Buy_CodelistModel.ProjectName = projectlist1.ProjectName; } if (projectlist.State == 0) { project_Buy_CodelistModel.State = "未使用"; } if (projectlist.State == 1) { project_Buy_CodelistModel.State = "已使用"; } if (projectlist.State == 2) { project_Buy_CodelistModel.State = "被锁定"; } if (projectlist.ProjectType == 0) { project_Buy_CodelistModel.ProjectType = "次数"; } if (projectlist.ProjectType == 1) { project_Buy_CodelistModel.ProjectType = "有效期"; } project_Buy_CodelistModel.RemainCount = Convert.ToInt32(projectlist.RemainCount); return(ResponseModelFactory <Project_buy_codelistModel> .CreateModel(isSignKeyReturn, project_Buy_CodelistModel)); } catch (Exception e) { throw e; } }
public object CheckUser(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string token = string.Empty; string userName = dicParas.ContainsKey("userName") ? dicParas["userName"].ToString() : string.Empty; string password = dicParas.ContainsKey("password") ? dicParas["password"].ToString() : string.Empty; if (string.IsNullOrWhiteSpace(userName)) { errMsg = "用户名不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrWhiteSpace(password)) { errMsg = "密码不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } password = Utils.MD5(password); UserLogResponseModel userLogResponseModel = new UserLogResponseModel(); IBase_UserInfoService base_UserInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); if (base_UserInfoService.Any(p => p.LogName.Equals(userName, StringComparison.OrdinalIgnoreCase) && p.LogPassword.Equals(password, StringComparison.OrdinalIgnoreCase))) { var base_UserInfoModel = base_UserInfoService.GetModels(p => p.LogName.Equals(userName, StringComparison.OrdinalIgnoreCase) && p.LogPassword.Equals(password, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <Base_UserInfo>(); int userId = base_UserInfoModel.UserID; int userType = (int)base_UserInfoModel.UserType; int logType = (int)RoleType.XcUser; //默认普通员工登录 int isXcAdmin = base_UserInfoModel.Auditor ?? 0; int switchable = base_UserInfoModel.Switchable ?? 0; if (userType == (int)UserType.Xc && isXcAdmin == 0) { logType = (int)RoleType.XcAdmin; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType); } else if (userType == (int)UserType.Store || userType == (int)UserType.StoreBoss) { logType = (int)RoleType.StoreUser; string storeId = base_UserInfoModel.StoreID; IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); if (!base_StoreInfoService.Any(a => a.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该门店不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } string merchId = base_StoreInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; var dataModel = new UserDataModel { StoreID = storeId, MerchID = merchId }; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); } else { logType = (int)RoleType.MerchUser; string merchId = base_UserInfoModel.MerchID; IBase_MerchantInfoService base_MerchantInfoService = BLLContainer.Resolve <IBase_MerchantInfoService>(); if (!base_MerchantInfoService.Any(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商户不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_MerchantInfoModel = base_MerchantInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); var dataModel = new MerchDataModel { MerchID = merchId, MerchType = base_MerchantInfoModel.MerchType, CreateType = base_MerchantInfoModel.CreateType, CreateUserID = base_MerchantInfoModel.CreateUserID }; userLogResponseModel.Token = XCCloudUserTokenBusiness.SetUserToken(userId.ToString(), logType, dataModel); userLogResponseModel.MerchTag = base_MerchantInfoModel.MerchTag; } userLogResponseModel.LogType = logType; userLogResponseModel.UserType = userType; userLogResponseModel.Switchable = switchable; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, userLogResponseModel)); } else { errMsg = "用户名或密码错误"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
private bool Recharge(XCGameManaDeviceStoreType deviceStoreType, string mobile, string xcGameDBName, string storeId, int icCardId, int memberLevelId, int foodId, string orderId, string money, int coins, int balance, string paymentype, string deviceId, int deviceIdentityId, out string foodName, out string errMsg) { foodName = string.Empty; errMsg = string.Empty; balance += coins; if (deviceStoreType == XCGameManaDeviceStoreType.Store) { //验证套餐信息 XCCloudService.BLL.IBLL.XCGame.IFoodsService foodservice = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFoodsService>(xcGameDBName); var foodModel = foodservice.GetModels(p => p.FoodID == foodId).FirstOrDefault <XCCloudService.Model.XCGame.t_foods>(); if (foodModel == null) { errMsg = "套餐明细不存在"; return(false); } foodName = foodModel.FoodName; //验证班次信息 XCCloudService.BLL.IBLL.XCGame.IScheduleService scheduleService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IScheduleService>(xcGameDBName); var schedulelist = scheduleService.GetModels(p => p.State.Equals("0", StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCGame.flw_schedule>(); if (schedulelist == null) { errMsg = "相关班次不存在"; return(false); } string sql = "exec RechargeFood @Balance,@ICCardID,@FoodID,@CoinQuantity,@Point,@MemberLevelID,@UserID,@ScheduleID,@WorkStation,@MacAddress,@OrderID,@FoodName,@Money,@Paymentype,@Return output "; SqlParameter[] parameters = new SqlParameter[15]; parameters[0] = new SqlParameter("@Balance", balance); parameters[1] = new SqlParameter("@ICCardID", icCardId); parameters[2] = new SqlParameter("@FoodID", foodId); parameters[3] = new SqlParameter("@CoinQuantity", coins); parameters[4] = new SqlParameter("@Point", "0"); parameters[5] = new SqlParameter("@MemberLevelID", memberLevelId); parameters[6] = new SqlParameter("@UserID", Convert.ToInt32(schedulelist.UserID)); parameters[7] = new SqlParameter("@ScheduleID", schedulelist.ID.ToString()); parameters[8] = new SqlParameter("@WorkStation", schedulelist.WorkStation); parameters[9] = new SqlParameter("@MacAddress", ""); parameters[10] = new SqlParameter("@OrderID", orderId); parameters[11] = new SqlParameter("@FoodName", foodModel.FoodName); parameters[12] = new SqlParameter("@Money", money); parameters[13] = new SqlParameter("@Paymentype", paymentype); parameters[14] = new SqlParameter("@Return", 0); parameters[14].Direction = System.Data.ParameterDirection.Output; XCCloudService.BLL.IBLL.XCGame.IFoodsaleService foodsale = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFoodsaleService>(xcGameDBName); XCCloudService.Model.XCGame.flw_food_sale member = foodsale.SqlQuery(sql, parameters).FirstOrDefault <XCCloudService.Model.XCGame.flw_food_sale>(); } else if (deviceStoreType == XCGameManaDeviceStoreType.Merch) { XCCloudService.BLL.IBLL.XCCloudRS232.IFoodSaleService foodsale = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IFoodSaleService>(); XCCloudService.Model.XCCloudRS232.flw_food_sale flwFood = new Model.XCCloudRS232.flw_food_sale(); flwFood.OrderID = orderId; flwFood.MerchID = int.Parse(storeId); flwFood.ICCardID = icCardId; flwFood.DeviceID = deviceIdentityId; flwFood.FlowType = 1; flwFood.CoinQuantity = coins; flwFood.TotalMoney = decimal.Parse(money); flwFood.Point = 0; flwFood.Balance = balance; flwFood.Note = string.Empty; flwFood.PayType = PayBusiness.GetPaymentTypeId(paymentype); flwFood.PayTime = System.DateTime.Now; flwFood.PayState = 1; flwFood.PayTotal = 0; XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IMemberService>(); var memberModel = memberService.GetModels(p => p.Mobile.Equals(mobile, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <XCCloudService.Model.XCCloudRS232.t_member>(); memberModel.Balance = Convert.ToInt32(memberModel.Balance) + coins; using (var transactionScope = new System.Transactions.TransactionScope(TransactionScopeOption.RequiresNew)) { foodsale.Add(flwFood); memberService.Update(memberModel); transactionScope.Complete(); } return(true); } else { errMsg = "门店类型不正确"; } return(true); }
public object register(Dictionary <string, object> dicParas) { //MerchID,DeviceName,DeviceType,SN,Token,QRURL,Status,motor1,motor2,nixie_tube_type,motor2_coin,motor1_coin,FromDevice,ToCard,SSR,alert_value string deviceName = dicParas.ContainsKey("deviceName") ? dicParas["deviceName"].ToString() : string.Empty; string deviceType = dicParas.ContainsKey("deviceType") ? dicParas["deviceType"].ToString() : string.Empty; string sn = dicParas.ContainsKey("sn") ? dicParas["sn"].ToString() : string.Empty; string qrUrl = dicParas.ContainsKey("qrUrl") ? dicParas["qrUrl"].ToString() : string.Empty; string motor1 = dicParas.ContainsKey("motor1") ? dicParas["motor1"].ToString() : string.Empty; string motor2 = dicParas.ContainsKey("motor2") ? dicParas["motor2"].ToString() : string.Empty; string nixie_tube_type = dicParas.ContainsKey("nixie_tube_type") ? dicParas["nixie_tube_type"].ToString() : string.Empty; string motor2_coin = dicParas.ContainsKey("motor2_coin") ? dicParas["motor2_coin"].ToString() : string.Empty; string motor1_coin = dicParas.ContainsKey("motor1_coin") ? dicParas["motor1_coin"].ToString() : string.Empty; string fromDevice = dicParas.ContainsKey("fromDevice") ? dicParas["fromDevice"].ToString() : string.Empty; string toCard = dicParas.ContainsKey("toCard") ? dicParas["toCard"].ToString() : string.Empty; string ssr = dicParas.ContainsKey("ssr") ? dicParas["ssr"].ToString() : string.Empty; string alert_value = dicParas.ContainsKey("alert_value") ? dicParas["alert_value"].ToString() : string.Empty; if (int.Parse(deviceType) < 0 || int.Parse(deviceType) > 4) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备类型不正确")); } XCCloudService.BLL.IBLL.XCCloudRS232.IDeviceService xcCloudRS232DeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IDeviceService>(); XCCloudService.BLL.IBLL.XCGameManager.IDeviceService xcGameManaDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IDeviceService>(); var xcCloudRS232DeviceModel = xcCloudRS232DeviceService.GetModels(p => p.SN.Equals(sn)).FirstOrDefault <Base_DeviceInfo>(); if (xcCloudRS232DeviceModel == null) { string deviceToken = DeviceManaBusiness.GetDeviceToken(); bool isExist = false; while (isExist == false) { if (xcGameManaDeviceService.GetCount(p => p.TerminalNo.Equals(deviceToken)) == 0 && xcCloudRS232DeviceService.GetCount(p => p.SN.Equals(deviceToken)) == 0) { isExist = true; } else { deviceToken = DeviceManaBusiness.GetDeviceToken(); } System.Threading.Thread.Sleep(100); } Base_DeviceInfo deviceModel = new Base_DeviceInfo(); deviceModel.MerchID = 0; deviceModel.DeviceName = deviceName; deviceModel.DeviceType = int.Parse(deviceType); deviceModel.SN = sn; deviceModel.Token = deviceToken; deviceModel.QRURL = qrUrl; deviceModel.Status = 1; deviceModel.motor1 = int.Parse(motor1); deviceModel.motor2 = int.Parse(motor2); deviceModel.nixie_tube_type = int.Parse(nixie_tube_type); deviceModel.motor1_coin = int.Parse(motor1_coin); deviceModel.motor2_coin = int.Parse(motor2_coin); deviceModel.FromDevice = int.Parse(fromDevice); deviceModel.ToCard = int.Parse(toCard); deviceModel.SSR = int.Parse(ssr); deviceModel.alert_value = int.Parse(alert_value); xcCloudRS232DeviceService.Add(deviceModel); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备信息已存在")); } }
public object SaveJackpotInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string merchId = userTokenKeyModel.DataModel.MerchID; string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; string activeName = dicParas.ContainsKey("activeName") ? (dicParas["activeName"] + "") : string.Empty; string threshold = dicParas.ContainsKey("threshold") ? (dicParas["threshold"] + "") : string.Empty; string concerned = dicParas.ContainsKey("concerned") ? (dicParas["concerned"] + "") : string.Empty; string startTime = dicParas.ContainsKey("startTime") ? (dicParas["startTime"] + "") : string.Empty; string endTime = dicParas.ContainsKey("endTime") ? (dicParas["endTime"] + "") : string.Empty; object[] jackpotLevels = dicParas.ContainsKey("jackpotLevels") ? (object[])dicParas["jackpotLevels"] : null; int iId = 0; int.TryParse(id, out iId); #region 验证参数 if (string.IsNullOrEmpty(threshold)) { errMsg = "消费门槛不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(threshold)) { errMsg = "消费门槛格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(threshold) < 0) { errMsg = "消费门槛不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(startTime) || string.IsNullOrEmpty(endTime)) { errMsg = "活动时间不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToDateTime(startTime) > Convert.ToDateTime(endTime)) { errMsg = "开始时间不能晚于结束时间"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion //开启EF事务 using (TransactionScope ts = new TransactionScope()) { try { IData_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>(); var data_JackpotInfo = data_JackpotInfoService.GetModels(p => p.ID == iId).FirstOrDefault() ?? new Data_JackpotInfo(); data_JackpotInfo.ActiveName = activeName; data_JackpotInfo.Concerned = !string.IsNullOrEmpty(concerned) ? Convert.ToInt32(concerned) : (int?)null; data_JackpotInfo.StartTime = Convert.ToDateTime(startTime); data_JackpotInfo.EndTime = Convert.ToDateTime(endTime); data_JackpotInfo.MerchInfo = merchId; data_JackpotInfo.Threshold = Convert.ToInt32(threshold); if (data_JackpotInfo.ID <= 0) { //新增 if (!data_JackpotInfoService.Add(data_JackpotInfo)) { errMsg = "添加抽奖规则信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } else { //修改 if (!data_JackpotInfoService.Update(data_JackpotInfo)) { errMsg = "修改抽奖规则信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } iId = data_JackpotInfo.ID; if (jackpotLevels != null && jackpotLevels.Count() >= 0) { //先删除已有数据,后添加 IData_Jackpot_LevelService data_Jackpot_LevelService = BLLContainer.Resolve <IData_Jackpot_LevelService>(); var data_Jackpot_Level = data_Jackpot_LevelService.GetModels(p => p.ActiveID == iId); foreach (var model in data_Jackpot_Level) { data_Jackpot_LevelService.DeleteModel(model); } foreach (IDictionary <string, object> el in jackpotLevels) { if (el != null) { var dicPara = new Dictionary <string, object>(el, StringComparer.OrdinalIgnoreCase); string goodId = dicPara.ContainsKey("goodId") ? dicPara["goodId"].ToString() : string.Empty; string levelName = dicPara.ContainsKey("levelName") ? (dicPara["levelName"] + "") : string.Empty; string goodCount = dicPara.ContainsKey("goodCount") ? (dicPara["goodCount"] + "") : string.Empty; string probability = dicPara.ContainsKey("probability") ? (dicPara["probability"] + "") : string.Empty; if (string.IsNullOrEmpty(goodId)) { errMsg = "商品ID不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(levelName)) { errMsg = "奖品等级不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(goodCount)) { errMsg = "奖品数量不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(goodCount)) { errMsg = "奖品数量格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(goodCount) < 0) { errMsg = "奖品数量不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(probability)) { errMsg = "中奖概率不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(probability)) { errMsg = "中奖概率格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToDecimal(probability) < 0) { errMsg = "中奖概率不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var data_Jackpot_LevelModel = new Data_Jackpot_Level(); data_Jackpot_LevelModel.ActiveID = iId; data_Jackpot_LevelModel.LevelName = levelName; data_Jackpot_LevelModel.GoodCount = Convert.ToInt32(goodCount); data_Jackpot_LevelModel.Probability = Convert.ToDecimal(probability); data_Jackpot_LevelModel.GoodID = Convert.ToInt32(goodId); data_Jackpot_LevelService.AddModel(data_Jackpot_LevelModel); } else { errMsg = "提交数据包含空对象"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } if (!data_Jackpot_LevelService.SaveChanges()) { errMsg = "保存抽奖规则信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } ts.Complete(); } catch (Exception ex) { errMsg = ex.Message; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object AddGoodStorage(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string logId = userTokenKeyModel.LogId; string errMsg = string.Empty; string barCode = dicParas.ContainsKey("barCode") ? (dicParas["barCode"] + "") : string.Empty; string price = dicParas.ContainsKey("price") ? (dicParas["price"] + "") : string.Empty; string storageCount = dicParas.ContainsKey("storageCount") ? (dicParas["storageCount"] + "") : string.Empty; string totalPrice = dicParas.ContainsKey("totalPrice") ? (dicParas["totalPrice"] + "") : string.Empty; string discount = dicParas.ContainsKey("discount") ? (dicParas["discount"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; #region 参数验证 if (string.IsNullOrEmpty(barCode)) { errMsg = "商品条码barCode不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(price)) { errMsg = "入库单价price不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(storageCount)) { errMsg = "入库数量storageCount不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(totalPrice)) { errMsg = "入库总额totalPrice不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(storageCount)) { errMsg = "入库数量storageCount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(price)) { errMsg = "入库单价price格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(totalPrice)) { errMsg = "入库总额totalPrice格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(discount) && !Utils.IsDecimal(discount)) { errMsg = "优惠金额discount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion IData_GoodStorageService data_GoodStorageService = BLLContainer.Resolve <IData_GoodStorageService>(); var data_GoodStorage = new Data_GoodStorage(); Utils.GetModel(dicParas, ref data_GoodStorage); data_GoodStorage.StoreID = storeId; data_GoodStorage.RealTime = DateTime.Now; data_GoodStorage.UserID = Convert.ToInt32(logId); if (!data_GoodStorageService.Add(data_GoodStorage)) { errMsg = "添加商品入库信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (DbEntityValidationException e) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, e.EntityValidationErrors.ToErrors())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object getUser(Dictionary <string, object> dicParas) { string UserName = dicParas.ContainsKey("UserName") ? dicParas["UserName"].ToString() : string.Empty; string imgCode = dicParas.ContainsKey("imgCode") ? dicParas["imgCode"].ToString() : string.Empty; if (string.IsNullOrEmpty(UserName)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入用户名")); } if (string.IsNullOrEmpty(imgCode)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "请输入验证码")); } if (!FilterMobileBusiness.IsTestSMS) { if (!ValidateImgCache.Exist(imgCode.ToUpper())) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "验证码无效")); } } IUserRegisterService userervice = BLLContainer.Resolve <IUserRegisterService>(); var menulist = userervice.GetModels(p => p.UserName.Equals(UserName, StringComparison.OrdinalIgnoreCase)).FirstOrDefault <t_UserRegister>(); if (menulist == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "未查询到该用户")); } string Mobile = menulist.Mobile; //短信模板 string templateId = "2"; string key = string.Empty; if (!FilterMobileBusiness.IsTestSMS && !FilterMobileBusiness.ExistMobile(Mobile)) { string smsCode = string.Empty; if (SMSBusiness.GetSMSCode(out smsCode)) { key = Mobile + "_" + smsCode; SMSCodeCache.Add(key, Mobile, CacheExpires.SMSCodeExpires); string errMsg = string.Empty; if (SMSBusiness.SendSMSCode(templateId, Mobile, smsCode, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "发送验证码出错")); } } else { key = Mobile + "_" + "123456"; SMSCodeCache.Add(key, Mobile, CacheExpires.SMSCodeExpires); return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, "")); } }
public object getfoods(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; TokenType tokenType = TokenType.Member; StoreCacheModel storeModel = null; List <XCCloudService.Model.XCGame.t_foods> xcGameFoodsList = null; List <XCCloudService.Model.XCCloudRS232.t_foods> rs232FoodsList = null; //获取token模式 MobileTokenModel mobileTokenModel = null; XCGameMemberTokenModel memberTokenModel = null; if (!XCCloudService.Business.XCGame.MeberAndMobileTokenBusiness.GetTokenData(dicParas, out tokenType, ref mobileTokenModel, ref memberTokenModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } //验证门店 StoreBusiness store = new StoreBusiness(); if (!store.IsEffectiveStore(memberTokenModel.StoreId, ref storeModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg)); } if (storeModel.StoreType == 0) { XCCloudService.BLL.IBLL.XCGame.IFoodsService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IFoodsService>(storeModel.StoreDBName); xcGameFoodsList = memberService.GetModels(p => p.FoodState.Equals("1") && p.FoodType.Equals("0") && p.ForeAuthorize.ToString().Equals("0")).ToList <XCCloudService.Model.XCGame.t_foods>(); } else if (storeModel.StoreType == 1) { XCCloudService.BLL.IBLL.XCCloudRS232.IFoodsService memberService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCCloudRS232.IFoodsService>(); rs232FoodsList = memberService.GetModels(p => p.FoodState == 1).ToList <XCCloudService.Model.XCCloudRS232.t_foods>(); } //根据查询结果输出 if (xcGameFoodsList == null && rs232FoodsList == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "套餐明细信息不存在")); } else { if (xcGameFoodsList != null) { List <FoodsResponseModel> foodsResponseModel = Utils.GetCopyList <FoodsResponseModel, XCCloudService.Model.XCGame.t_foods>(xcGameFoodsList); SetFoodsResponseModelList(foodsResponseModel); return(ResponseModelFactory <List <FoodsResponseModel> > .CreateModel(isSignKeyReturn, foodsResponseModel)); } else { List <FoodsResponseModel> foodsResponseModel = Utils.GetCopyList <FoodsResponseModel, XCCloudService.Model.XCCloudRS232.t_foods>(rs232FoodsList); SetFoodsResponseModelList(foodsResponseModel); return(ResponseModelFactory <List <FoodsResponseModel> > .CreateModel(isSignKeyReturn, foodsResponseModel)); } } } catch (Exception e) { throw e; } }
public object register(Dictionary <string, object> dicParas) { try { string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty; string mcuId = dicParas.ContainsKey("mcuId") ? dicParas["mcuId"].ToString() : string.Empty; XCCloudService.Model.CustomModel.XCGameManager.StoreCacheModel storeCacheModel = null; string errMsg = string.Empty; string deviceToken = string.Empty; //验证门店信息 XCCloudService.Business.XCGameMana.StoreBusiness xcGameManaStoreBusiness = new XCCloudService.Business.XCGameMana.StoreBusiness(); if (!xcGameManaStoreBusiness.IsEffectiveStore(storeId, ref storeCacheModel, out errMsg)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店不存在")); } //获取子库中是否存在mcuId XCCloudService.BLL.IBLL.XCGame.IDeviceService xcGameDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGame.IDeviceService>(storeCacheModel.StoreDBName); var xcGameDeviceModel = xcGameDeviceService.GetModels(p => p.MCUID.Equals(mcuId)).FirstOrDefault <XCCloudService.Model.XCGame.t_device>(); if (xcGameDeviceModel == null) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "设备不存在")); } //获取总库中是否存在 XCCloudService.BLL.IBLL.XCGameManager.IDeviceService xcGameManaDeviceService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.IDeviceService>(); var xcGameManaDeviceModel = xcGameManaDeviceService.GetModels(p => p.StoreType == (int)(XCGameManaDeviceStoreType.Store) && p.DeviceId.Equals(mcuId)).FirstOrDefault <XCCloudService.Model.XCGameManager.t_device>(); if (xcGameManaDeviceModel != null) { if (!xcGameManaDeviceModel.DeviceName.Equals(xcGameDeviceModel.name) || !xcGameManaDeviceModel.DeviceType.Equals(xcGameDeviceModel.type)) { xcGameManaDeviceModel.DeviceType = xcGameDeviceModel.type; xcGameManaDeviceModel.DeviceName = xcGameDeviceModel.name; xcGameManaDeviceService.Update(xcGameManaDeviceModel); } deviceToken = xcGameManaDeviceModel.TerminalNo; } else { deviceToken = DeviceManaBusiness.GetDeviceToken(); bool isExist = false; while (isExist == false) { if (xcGameManaDeviceService.GetCount(p => p.TerminalNo.Equals(deviceToken)) == 0) { isExist = true; } else { deviceToken = DeviceManaBusiness.GetDeviceToken(); } System.Threading.Thread.Sleep(100); } xcGameManaDeviceModel = new XCCloudService.Model.XCGameManager.t_device(); xcGameManaDeviceModel.DeviceId = xcGameDeviceModel.MCUID; xcGameManaDeviceModel.TerminalNo = deviceToken; xcGameManaDeviceModel.DeviceName = xcGameDeviceModel.name; xcGameManaDeviceModel.DeviceType = xcGameDeviceModel.type; xcGameManaDeviceModel.StoreId = storeId; xcGameManaDeviceModel.Note = xcGameDeviceModel.note; xcGameManaDeviceModel.StoreType = (int)(XCGameManaDeviceStoreType.Store); xcGameManaDeviceService.Add(xcGameManaDeviceModel); } var obj = new { deviceToken = deviceToken }; return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj)); } catch (Exception e) { throw e; } }
public object SetSub(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? dicParas["id"].ToString() : string.Empty; string dictKey = dicParas.ContainsKey("dictKey") ? dicParas["dictKey"].ToString() : string.Empty; string dictValue = dicParas.ContainsKey("dictValue") ? dicParas["dictValue"].ToString() : string.Empty; string comment = dicParas.ContainsKey("comment") ? dicParas["comment"].ToString() : string.Empty; string enabled = dicParas.ContainsKey("enabled") ? dicParas["enabled"].ToString() : string.Empty; string merchId = dicParas.ContainsKey("merchId") ? dicParas["merchId"].ToString() : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; if (userTokenKeyModel.LogType == (int)RoleType.MerchUser) { merchId = userTokenKeyModel.DataModel.MerchID; } if (string.IsNullOrWhiteSpace(id)) { errMsg = "选中节点id不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } try { Convert.ToInt32(id); } catch (Exception ex) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, ex.Message)); } //验证参数信息 if (!checkParams(dicParas, out errMsg)) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>(); int iId = Convert.ToInt32(id); if (!dict_SystemService.Any(p => p.ID == iId)) { errMsg = "选中节点数据库不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } Dict_System dict_System = dict_SystemService.GetModels(p => p.ID == iId).FirstOrDefault <Dict_System>(); if (dict_System.PID == null || !dict_SystemService.Any(p => p.ID == dict_System.PID)) { errMsg = "主节点不可修改"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int pId = Convert.ToInt32(dict_System.PID.Value); if (dict_SystemService.Any(p => p.ID != iId && p.PID.Value == pId && p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase))) { errMsg = "同一级别下存在重名的节点"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrWhiteSpace(merchId)) { if (dict_SystemService.Any(p => p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase) && (p.MerchID == null || p.MerchID.Trim() == string.Empty))) { errMsg = "不能与公有节点重名"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } dict_System.DictKey = dictKey; dict_System.DictValue = dictValue; dict_System.Comment = comment; dict_System.Enabled = Convert.ToInt32(enabled); if (dicParas.ContainsKey("merchId")) { dict_System.MerchID = dicParas["merchId"].ToString(); } if (!dict_SystemService.Update(dict_System)) { errMsg = "修改子节点失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, default(Dict_System))); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object DelJackpotInfo(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; if (string.IsNullOrEmpty(id)) { errMsg = "规则ID不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iId = Convert.ToInt32(id); IData_Jackpot_LevelService data_Jackpot_LevelService = BLLContainer.Resolve <IData_Jackpot_LevelService>(); IData_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>(); IData_Jackpot_MatrixService data_Jackpot_MatrixService = BLLContainer.Resolve <IData_Jackpot_MatrixService>(); if (data_Jackpot_MatrixService.Any(a => a.ActiveID == iId)) { errMsg = "该抽奖规则已使用不能删除"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!data_JackpotInfoService.Any(a => a.ID == iId)) { errMsg = "该抽奖规则信息不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } //开启EF事务 using (TransactionScope ts = new TransactionScope()) { try { var data_JackpotInfo = data_JackpotInfoService.GetModels(p => p.ID == iId).FirstOrDefault(); data_JackpotInfoService.DeleteModel(data_JackpotInfo); var data_Jackpot_Level = data_Jackpot_LevelService.GetModels(p => p.ActiveID == iId); foreach (var model in data_Jackpot_Level) { data_Jackpot_LevelService.DeleteModel(model); } if (!data_JackpotInfoService.SaveChanges()) { errMsg = "删除抽奖规则信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } ts.Complete(); } catch (Exception ex) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, ex.Message)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object AddGoodInventory(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string logId = userTokenKeyModel.LogId; string errMsg = string.Empty; string barCode = dicParas.ContainsKey("barCode") ? (dicParas["barCode"] + "") : string.Empty; string inventoryType = dicParas.ContainsKey("inventoryType") ? (dicParas["inventoryType"] + "") : string.Empty; string inventoryIndex = dicParas.ContainsKey("inventoryIndex") ? (dicParas["inventoryIndex"] + "") : string.Empty; string predictCount = dicParas.ContainsKey("predictCount") ? (dicParas["predictCount"] + "") : string.Empty; string inventoryCount = dicParas.ContainsKey("inventoryCount") ? (dicParas["inventoryCount"] + "") : string.Empty; string totalPrice = dicParas.ContainsKey("totalPrice") ? (dicParas["totalPrice"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; #region 参数验证 if (string.IsNullOrEmpty(barCode)) { errMsg = "商品条码barCode不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(inventoryType)) { errMsg = "盘点类别inventoryType不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(inventoryIndex) && !Utils.isNumber(inventoryIndex)) { errMsg = "盘点位置索引inventoryIndex格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(predictCount)) { errMsg = "预估数量predictCount不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(inventoryCount)) { errMsg = "盘点数量inventoryCount不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(totalPrice)) { errMsg = "库存金额totalPrice不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(predictCount)) { errMsg = "预估数量predictCount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(inventoryCount)) { errMsg = "盘点数量inventoryCount格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.IsDecimal(totalPrice)) { errMsg = "库存金额totalPrice格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion IData_GoodInventoryService data_GoodInventoryService = BLLContainer.Resolve <IData_GoodInventoryService>(); var data_GoodInventory = new Data_GoodInventory(); Utils.GetModel(dicParas, ref data_GoodInventory); data_GoodInventory.StoreID = storeId; data_GoodInventory.InventoryTime = DateTime.Now; data_GoodInventory.UserID = Convert.ToInt32(logId); if (!data_GoodInventoryService.Add(data_GoodInventory)) { errMsg = "添加商品盘点信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (DbEntityValidationException e) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, e.EntityValidationErrors.ToErrors())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public ActionResult UserRegister(Base_UserInfo base_UserInfo) { var json = new JsonHelper() { Msg = "录入成功", Status = "n" }; try { if (!string.IsNullOrWhiteSpace(base_UserInfo.Mobile) && !Utils.CheckMobile(base_UserInfo.Mobile)) { json.Msg = "非法的手机号码"; return(Json(json, JsonRequestBehavior.AllowGet)); } if (!string.IsNullOrWhiteSpace(base_UserInfo.Mail) && !Utils.IsValidEmail(base_UserInfo.Mail)) { json.Msg = "非法的邮箱地址"; return(Json(json, JsonRequestBehavior.AllowGet)); } if (UserBusiness.IsEffectiveUser(base_UserInfo.UserName)) { json.Msg = "用户名已存在,请更换一个名称"; return(Json(json, JsonRequestBehavior.AllowGet)); } base_UserInfo.UserType = (int)UserType.Customer; base_UserInfo.State = (int)UserState.Normal; base_UserInfo.Password = Utils.MD5(base_UserInfo.Password); IBase_UserInfoService base_UserInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); if (!base_UserInfoService.Add(base_UserInfo)) { json.Msg = "数据库更新失败"; } else { json.Status = "y"; json.Msg = "注册成功"; json.ReUrl = "../home/index"; UserBusiness.Init(); Utils.FormSignOut(); var authTicket = new FormsAuthenticationTicket(1, base_UserInfo.UserName, DateTime.Now, DateTime.Now.AddDays(1), base_UserInfo.REMEMBER_ME, base_UserInfo.ID.ToString()); HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, FormsAuthentication.Encrypt(authTicket)); if (authTicket.IsPersistent) { cookie.Expires = authTicket.Expiration; } Response.Cookies.Add(cookie); Session["loginUser"] = UserBusiness.GetUser(base_UserInfo.UserName); Session.Timeout = 300; } } catch (Exception e) { json.Msg = e.Message; } return(Json(json, JsonRequestBehavior.AllowGet)); }
public object SaveGoodsInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; string id = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty; string barCode = dicParas.ContainsKey("barCode") ? (dicParas["barCode"] + "") : string.Empty; string goodType = dicParas.ContainsKey("goodType") ? (dicParas["goodType"] + "") : string.Empty; string minValue = dicParas.ContainsKey("minValue") ? (dicParas["minValue"] + "") : string.Empty; string maxValue = dicParas.ContainsKey("maxValue") ? (dicParas["maxValue"] + "") : string.Empty; string goodName = dicParas.ContainsKey("goodName") ? (dicParas["goodName"] + "") : string.Empty; string price = dicParas.ContainsKey("price") ? (dicParas["price"] + "") : string.Empty; string points = dicParas.ContainsKey("points") ? (dicParas["points"] + "") : string.Empty; string note = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty; #region 参数验证 if (!string.IsNullOrEmpty(id) && !Utils.isNumber(id)) { errMsg = "商品ID格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(barCode)) { errMsg = "商品条码barCode不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(goodType)) { errMsg = "商品类别goodType不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(minValue) || string.IsNullOrEmpty(maxValue)) { errMsg = "库存警戒线不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!Utils.isNumber(minValue) || !Utils.isNumber(maxValue)) { errMsg = "库存警戒线格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(minValue) < 0 || Convert.ToInt32(maxValue) < 0) { errMsg = "库存警戒线不能为负数"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (Convert.ToInt32(minValue) > Convert.ToInt32(maxValue)) { errMsg = "库存警戒线下限须小于上限"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(price) && !Utils.IsDecimal(price)) { errMsg = "零售价格格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (!string.IsNullOrEmpty(points) && (!Utils.isNumber(points) || Convert.ToInt32(points) < 0)) { errMsg = "零售积分格式不正确"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } #endregion IBase_StoreInfoService base_StoreInfoService = BLLContainer.Resolve <IBase_StoreInfoService>(); var merchId = base_StoreInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault().MerchID; IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>(); if (string.IsNullOrEmpty(id)) { if (base_GoodsInfoService.Any(a => a.Barcode.Equals(barCode, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商品条码已使用"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_GoodsInfo = new Base_GoodsInfo(); Utils.GetModel(dicParas, ref base_GoodsInfo); base_GoodsInfo.MerchID = merchId; base_GoodsInfo.Status = 1; if (!base_GoodsInfoService.Add(base_GoodsInfo)) { errMsg = "添加商品信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } else { int iId = Convert.ToInt32(id); if (!base_GoodsInfoService.Any(a => a.ID == iId)) { errMsg = "该商品信息不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (base_GoodsInfoService.Any(a => a.ID != iId && a.Barcode.Equals(barCode, StringComparison.OrdinalIgnoreCase))) { errMsg = "该商品条码已使用"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var base_GoodsInfo = base_GoodsInfoService.GetModels(p => p.ID == iId).FirstOrDefault(); Utils.GetModel(dicParas, ref base_GoodsInfo); if (!base_GoodsInfoService.Update(base_GoodsInfo)) { errMsg = "修改商品信息失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (DbEntityValidationException e) { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, e.EntityValidationErrors.ToErrors())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }