public object GetMemberLevelInfo(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; string memberLevelID = dicParas.ContainsKey("memberLevelID") ? dicParas["memberLevelID"].ToString() : string.Empty; if (string.IsNullOrEmpty(memberLevelID)) { errMsg = "会员级别ID不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iMemberLevelID = Convert.ToInt32(memberLevelID); IData_MemberLevelService data_MemberLevelService = BLLContainer.Resolve <IData_MemberLevelService>(); if (!data_MemberLevelService.Any(a => a.MemberLevelID == iMemberLevelID)) { errMsg = "该会员级别不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var data_MemberLevelModel = data_MemberLevelService.GetModels(p => p.MemberLevelID == iMemberLevelID).FirstOrDefault(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_MemberLevelModel)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetStoreMemberLevel(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; IData_MemberLevelService data_MemberLevelService = BLLContainer.Resolve <IData_MemberLevelService>(); Dictionary <int, string> memberLevel = data_MemberLevelService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && p.State == 1).Select(o => new { MemberLevelID = o.MemberLevelID, MemberLevelName = o.MemberLevelName }).Distinct().ToDictionary(d => d.MemberLevelID, d => d.MemberLevelName); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, memberLevel)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object SaveMemberLevel(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; string errMsg = string.Empty; string memberLevelID = dicParas.ContainsKey("memberLevelID") ? (dicParas["memberLevelID"] + "") : string.Empty; string memberLevelName = dicParas.ContainsKey("memberLevelName") ? (dicParas["memberLevelName"] + "") : string.Empty; string deposit = dicParas.ContainsKey("deposit") ? (dicParas["deposit"] + "") : string.Empty; string exitMoney = dicParas.ContainsKey("exitMoney") ? (dicParas["exitMoney"] + "") : string.Empty; string exitCoin = dicParas.ContainsKey("exitCoin") ? (dicParas["exitCoin"] + "") : string.Empty; string exitPrice = dicParas.ContainsKey("exitPrice") ? (dicParas["exitPrice"] + "") : string.Empty; string validday = dicParas.ContainsKey("validday") ? (dicParas["validday"] + "") : string.Empty; string freeRate = dicParas.ContainsKey("freeRate") ? (dicParas["freeRate"] + "") : string.Empty; string freeCoin = dicParas.ContainsKey("freeCoin") ? (dicParas["freeCoin"] + "") : string.Empty; string birthdayFree = dicParas.ContainsKey("birthdayFree") ? (dicParas["birthdayFree"] + "") : string.Empty; string birthdayFreeCoin = dicParas.ContainsKey("birthdayFreeCoin") ? (dicParas["birthdayFreeCoin"] + "") : string.Empty; string mustInput = dicParas.ContainsKey("mustInput") ? (dicParas["mustInput"] + "") : string.Empty; string allowExitCard = dicParas.ContainsKey("allowExitCard") ? (dicParas["allowExitCard"] + "") : string.Empty; string allowExitMoney = dicParas.ContainsKey("allowExitMoney") ? (dicParas["allowExitMoney"] + "") : string.Empty; string allowExitCoinToCard = dicParas.ContainsKey("allowExitCoinToCard") ? (dicParas["allowExitCoinToCard"] + "") : string.Empty; string lockHead = dicParas.ContainsKey("lockHead") ? (dicParas["lockHead"] + "") : string.Empty; string minExitCoin = dicParas.ContainsKey("minExitCoin") ? (dicParas["minExitCoin"] + "") : string.Empty; string freeType = dicParas.ContainsKey("freeType") ? (dicParas["freeType"] + "") : string.Empty; string freeNeedWin = dicParas.ContainsKey("freeNeedWin") ? (dicParas["freeNeedWin"] + "") : string.Empty; string state = dicParas.ContainsKey("state") ? (dicParas["state"] + "") : string.Empty; string cardUIURL = dicParas.ContainsKey("cardUIURL") ? (dicParas["cardUIURL"] + "") : string.Empty; string needAuthor = dicParas.ContainsKey("needAuthor") ? (dicParas["needAuthor"] + "") : string.Empty; if (string.IsNullOrEmpty(memberLevelName)) { errMsg = "会员级别名称不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } if (string.IsNullOrEmpty(cardUIURL)) { errMsg = "会员卡封面地址不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iMemberLevelID = 0; int.TryParse(memberLevelID, out iMemberLevelID); IData_MemberLevelService data_MemberLevelService = BLLContainer.Resolve <IData_MemberLevelService>(); if (data_MemberLevelService.Any(a => a.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && a.MemberLevelName.Equals(memberLevelName, StringComparison.OrdinalIgnoreCase) && a.MemberLevelID != iMemberLevelID)) { errMsg = "该会员级别名称已存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var data_MemberLevel = new Data_MemberLevel(); data_MemberLevel.MemberLevelID = iMemberLevelID; data_MemberLevel.MemberLevelName = memberLevelName; data_MemberLevel.Deposit = !string.IsNullOrEmpty(deposit) ? Convert.ToDecimal(deposit) : (decimal?)null; data_MemberLevel.ExitMoney = !string.IsNullOrEmpty(exitMoney) ? Convert.ToDecimal(exitMoney) : (decimal?)null; data_MemberLevel.ExitCoin = !string.IsNullOrEmpty(exitCoin) ? Convert.ToInt32(exitCoin) : (int?)null; data_MemberLevel.ExitPrice = !string.IsNullOrEmpty(exitPrice) ? Convert.ToDecimal(exitPrice) : (decimal?)null; data_MemberLevel.Validday = !string.IsNullOrEmpty(validday) ? Convert.ToInt32(validday) : (int?)null; data_MemberLevel.FreeRate = !string.IsNullOrEmpty(freeRate) ? Convert.ToInt32(freeRate) : (int?)null; data_MemberLevel.FreeCoin = !string.IsNullOrEmpty(freeCoin) ? Convert.ToInt32(freeCoin) : (int?)null; data_MemberLevel.BirthdayFree = !string.IsNullOrEmpty(birthdayFree) ? Convert.ToInt32(birthdayFree) : (int?)null; data_MemberLevel.BirthdayFreeCoin = !string.IsNullOrEmpty(birthdayFreeCoin) ? Convert.ToInt32(birthdayFreeCoin) : (int?)null; data_MemberLevel.MustInput = !string.IsNullOrEmpty(mustInput) ? Convert.ToInt32(mustInput) : (int?)null; data_MemberLevel.AllowExitCard = !string.IsNullOrEmpty(allowExitCard) ? Convert.ToInt32(allowExitCard) : (int?)null; data_MemberLevel.AllowExitMoney = !string.IsNullOrEmpty(allowExitMoney) ? Convert.ToInt32(allowExitMoney) : (int?)null; data_MemberLevel.AllowExitCoinToCard = !string.IsNullOrEmpty(allowExitCoinToCard) ? Convert.ToInt32(allowExitCoinToCard) : (int?)null; data_MemberLevel.LockHead = !string.IsNullOrEmpty(lockHead) ? Convert.ToInt32(lockHead) : (int?)null; data_MemberLevel.MinExitCoin = !string.IsNullOrEmpty(minExitCoin) ? Convert.ToInt32(minExitCoin) : (int?)null; data_MemberLevel.FreeType = !string.IsNullOrEmpty(freeType) ? Convert.ToInt32(freeType) : (int?)null; data_MemberLevel.FreeNeedWin = !string.IsNullOrEmpty(freeNeedWin) ? Convert.ToInt32(freeNeedWin) : (int?)null; data_MemberLevel.State = !string.IsNullOrEmpty(state) ? Convert.ToInt32(state) : (int?)null; data_MemberLevel.StoreID = storeId; data_MemberLevel.CardUIURL = cardUIURL; data_MemberLevel.NeedAutor = !string.IsNullOrEmpty(needAuthor) ? Convert.ToInt32(needAuthor) : (int?)null; if (!data_MemberLevelService.Any(a => a.MemberLevelID == iMemberLevelID)) { //新增 if (!data_MemberLevelService.Add(data_MemberLevel)) { errMsg = "添加会员级别失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } else { //修改 if (!data_MemberLevelService.Update(data_MemberLevel)) { errMsg = "修改会员级别失败"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object QueryMemberLevel(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string memberLevelID = dicParas.ContainsKey("memberLevelID") ? dicParas["memberLevelID"].ToString() : string.Empty; string memberLevelName = dicParas.ContainsKey("memberLevelName") ? dicParas["memberLevelName"].ToString() : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID; IData_MemberLevelService data_MemberLevelService = BLLContainer.Resolve <IData_MemberLevelService>(); var query = data_MemberLevelService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(memberLevelID)) { var iMemberLevelID = Convert.ToInt32(memberLevelID); query = query.Where(w => w.MemberLevelID == iMemberLevelID); } if (!string.IsNullOrEmpty(memberLevelName)) { query = query.Where(w => w.MemberLevelName.Contains(memberLevelName)); } IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>(); int MustInputId = dict_SystemService.GetModels(p => p.DictKey.Equals("入会时必须输入")).FirstOrDefault().ID; int BirthdayFreeId = dict_SystemService.GetModels(p => p.DictKey.Equals("生日送币方式")).FirstOrDefault().ID; int FreeRateId = dict_SystemService.GetModels(p => p.DictKey.Equals("送币频率")).FirstOrDefault().ID; var linq = query.ToList().Select(o => new { MemberLevelModel = o, MustInput = dict_SystemService.GetModels(p => p.PID == MustInputId), BirthdayFree = dict_SystemService.GetModels(p => p.PID == BirthdayFreeId), FreeRate = dict_SystemService.GetModels(p => p.PID == FreeRateId) }).Select(oo => new { MemberLevelID = oo.MemberLevelModel.MemberLevelID, MemberLevelName = oo.MemberLevelModel.MemberLevelName, Deposit = oo.MemberLevelModel.Deposit, ExitMoney = oo.MemberLevelModel.ExitMoney, ExitCoin = oo.MemberLevelModel.ExitCoin, ExitPrice = oo.MemberLevelModel.ExitPrice, Validday = oo.MemberLevelModel.Validday, FreeRate = oo.MemberLevelModel.FreeRate, FreeCoin = oo.MemberLevelModel.FreeCoin, BirthdayFree = oo.MemberLevelModel.BirthdayFree, BirthdayFreeCoin = oo.MemberLevelModel.BirthdayFreeCoin, MustInput = oo.MemberLevelModel.MustInput, AllowExitCard = oo.MemberLevelModel.AllowExitCard == 1 ? "允许" : oo.MemberLevelModel.AllowExitCard == 0 ? "禁止" : string.Empty, AllowExitMoney = oo.MemberLevelModel.AllowExitMoney == 1 ? "允许" : oo.MemberLevelModel.AllowExitMoney == 0 ? "禁止" : string.Empty, AllowExitCoinToCard = oo.MemberLevelModel.AllowExitCoinToCard == 1 ? "允许" : oo.MemberLevelModel.AllowExitCoinToCard == 0 ? "禁止" : string.Empty, LockHead = oo.MemberLevelModel.LockHead == 1 ? "允许" : oo.MemberLevelModel.LockHead == 0 ? "禁止" : string.Empty, MinExitCoin = oo.MemberLevelModel.MinExitCoin, FreeType = oo.MemberLevelModel.FreeType, FreeNeedWin = oo.MemberLevelModel.FreeNeedWin, MustInputStr = oo.MustInput.Any(s => s.DictValue.Equals(oo.MemberLevelModel.MustInput + "")) ? oo.MustInput.Single(s => s.DictValue.Equals(oo.MemberLevelModel.MustInput + "")).DictKey : string.Empty, BirthdayFreeStr = oo.BirthdayFree.Any(s => s.DictValue.Equals(oo.MemberLevelModel.BirthdayFree + "")) ? oo.BirthdayFree.Single(s => s.DictValue.Equals(oo.MemberLevelModel.BirthdayFree + "")).DictKey : string.Empty, FreeRateStr = oo.FreeRate.Any(s => s.DictValue.Equals(oo.MemberLevelModel.FreeRate + "")) ? oo.FreeRate.Single(s => s.DictValue.Equals(oo.MemberLevelModel.FreeRate + "")).DictKey : string.Empty, StateStr = (oo.MemberLevelModel.State == 1) ? "启用" : "停用" }); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, linq.ToList())); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetProjectInfo(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; if (string.IsNullOrEmpty(id)) { errMsg = "项目ID不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } int iId = Convert.ToInt32(id); IData_ProjectInfoService data_ProjectInfoService = BLLContainer.Resolve <IData_ProjectInfoService>(resolveNew: true); var ProjectInfo = data_ProjectInfoService.GetModels(p => p.ID == iId).FirstOrDefault(); if (ProjectInfo == null) { errMsg = "该项目不存在"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>(resolveNew: true); int DeviceTypeId = dict_SystemService.GetModels(p => p.DictKey.Equals("设备类型")).FirstOrDefault().ID; IData_Project_DeviceService data_Project_DeviceService = BLLContainer.Resolve <IData_Project_DeviceService>(resolveNew: true); IBase_DeviceInfoService base_DeviceInfoService = BLLContainer.Resolve <IBase_DeviceInfoService>(resolveNew: true); var ProjectDevices = from a in data_Project_DeviceService.GetModels(p => p.ProjectID == iId) join b in base_DeviceInfoService.GetModels() on a.DeviceID equals b.ID join c in dict_SystemService.GetModels(p => p.PID == DeviceTypeId) on(b.type + "") equals c.DictValue into c1 from c in c1.DefaultIfEmpty() select new { DeviceID = a.DeviceID, BindType = a.BindType, DeviceName = b.DeviceName, MCUID = b.MCUID, typeStr = c != null ? c.DictKey : string.Empty }; IData_Project_BandPriceService data_Project_BandPriceService = BLLContainer.Resolve <IData_Project_BandPriceService>(resolveNew: true); IData_MemberLevelService data_MemberLevelService = BLLContainer.Resolve <IData_MemberLevelService>(resolveNew: true); var MemberLevels = data_MemberLevelService.GetModels(); var BandPrices = (from a in data_Project_BandPriceService.GetModels(p => p.ProjectID == iId) group a by new { a.BandType, a.BandCount, a.BandPrice } into g select new { MemberLevelInfos = (from b in MemberLevels where g.Select(o => o.MemberLevelID).Contains(b.MemberLevelID) select new { b.MemberLevelID, b.MemberLevelName }).ToList(), Key = g.Key }).ToList().Select(o => new { MemberLevelIDs = string.Join("|", o.MemberLevelInfos.Select(s => s.MemberLevelID)), MemberLevels = string.Join("|", o.MemberLevelInfos.Select(s => s.MemberLevelName)), BandType = o.Key.BandType, BandTypeStr = o.Key.BandType == 0 ? "小于等于" : o.Key.BandType == 1 ? "大于等于" : string.Empty, BandCount = o.Key.BandCount, BandPrice = o.Key.BandPrice }); var result = new { ID = ProjectInfo.ID, ProjectName = ProjectInfo.ProjectName, ProjectStatus = ProjectInfo.ProjectStatus, FeeType = ProjectInfo.FeeType, FeeCycle = ProjectInfo.FeeCycle, FeeDeposit = ProjectInfo.FeeDeposit, SignOutEN = ProjectInfo.SignOutEN, WhenLock = ProjectInfo.WhenLock, RegretTime = ProjectInfo.RegretTime, Note = ProjectInfo.Note, BandPrices = BandPrices, ProjectDevices = ProjectDevices }; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }