Пример #1
0
        public object GetNodeInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string id     = dicParas.ContainsKey("id") ? dicParas["id"].ToString() : string.Empty;

                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));
                }

                IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>();
                int iId = Convert.ToInt32(id);
                if (!dict_SystemService.Any(p => p.ID.Equals(iId)))
                {
                    errMsg = "节点id数据库不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var dict_SystemModel = dict_SystemService.GetModels(p => p.ID.Equals(iId)).FirstOrDefault <Dict_System>();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, dict_SystemModel));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Пример #2
0
        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));
            }
        }
Пример #3
0
        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));
            }
        }
Пример #4
0
        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));
            }
        }
Пример #5
0
        public object AddRoot(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg    = 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 (!checkParams(dicParas, out errMsg))
                {
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IDict_SystemService dict_SystemService = BLLContainer.Resolve <IDict_SystemService>();

                if (!string.IsNullOrWhiteSpace(merchId))
                {
                    if (dict_SystemService.Any(p => (!p.PID.HasValue || p.PID.Value == 0) && p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase) && p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)))
                    {
                        errMsg = "存在重名的主节点";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }

                    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));
                    }
                }
                else
                {
                    if (dict_SystemService.Any(p => (!p.PID.HasValue || p.PID.Value == 0) && p.DictKey.Equals(dictKey, StringComparison.OrdinalIgnoreCase) && (p.MerchID == null || p.MerchID.Trim() == string.Empty)))
                    {
                        errMsg = "存在重名的主节点";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                Dict_System dict_System = new Dict_System();
                dict_System.PID       = 0;
                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.Add(dict_System))
                {
                    errMsg = "添加主节点失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Пример #6
0
        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));
            }
        }
Пример #7
0
        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));
            }
        }