Exemple #1
0
        public object QueryJackpotInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string   merchId    = userTokenKeyModel.DataModel.MerchID;
                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[1];
                string         sqlWhere   = string.Empty;
                parameters[0] = new SqlParameter("@MerchId", merchId);

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select a.* from Data_JackpotInfo a where a.MerchInfo=@MerchId";
                sql = sql + sqlWhere;

                IData_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>();
                var data_JackpotInfo = data_JackpotInfoService.SqlQuery <Data_JackpotInfo>(sql, parameters).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_JackpotInfo));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #2
0
        public object GetWxUserInfoBatch(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string nextOpenId = dicParas.ContainsKey("nextOpenId") ? dicParas["nextOpenId"].ToString() : string.Empty;

            UserInfoCollection <UserInfoDetailModel> userInfoCollection = null;

            if (!getWxFans <UserInfoDetailModel>("员工组", nextOpenId, out userInfoCollection, out errMsg))
            {
                return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
            }

            if (userInfoCollection != null && userInfoCollection.UserInfoList != null)
            {
                var subscribeusers = userInfoCollection.UserInfoList.Exists(p => p.Subscribe.Equals(1)) ?
                                     userInfoCollection.UserInfoList.Where(w => w.Subscribe.Equals(1)).ToList <UserInfoDetailModel>() : default(List <UserInfoDetailModel>);

                //绑定UserID
                UserInfoCacheModel userInfoCacheModel = null;
                foreach (var su in subscribeusers)
                {
                    if (UserBusiness.IsEffectiveXcUser(su.OpenID, out userInfoCacheModel))
                    {
                        su.UserID = userInfoCacheModel.UserID;
                    }
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, subscribeusers));
            }

            return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
        }
Exemple #3
0
        public object DelGoodsInfo(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);
                IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>();
                if (!base_GoodsInfoService.Any(a => a.ID == iId))
                {
                    errMsg = "该商品信息不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var base_GoodsInfo = base_GoodsInfoService.GetModels(p => p.ID == iId).FirstOrDefault();
                base_GoodsInfo.Status = 0;
                if (!base_GoodsInfoService.Update(base_GoodsInfo))
                {
                    errMsg = "删除游戏机信息失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #4
0
        public object GetUserGroup(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            int    userId, authorId;
            string workId = dicParas.ContainsKey("workId") ? dicParas["workId"].ToString() : string.Empty;

            if (!checkParas(dicParas, out userId, out authorId, out errMsg))
            {
                LogHelper.SaveLog("错误:" + errMsg);
                return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
            }

            string sql = " exec SelectUserGroup @UserID";

            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = new SqlParameter("@UserID", userId);

            System.Data.DataSet   ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
            System.Data.DataTable dt = ds.Tables[0];
            if (dt.Rows.Count > 0)
            {
                var list = Utils.GetModelList <Base_UserGroup>(ds.Tables[0]).ToList();
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list));
            }
            else
            {
                return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, "工作组列表为空"));
            }
        }
Exemple #5
0
        public object DelPushRule(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_Push_RuleService data_Push_RuleService = BLLContainer.Resolve <IData_Push_RuleService>();
                if (!data_Push_RuleService.Any(a => a.ID == iId))
                {
                    errMsg = "该投币规则信息不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var data_Push_Rule = data_Push_RuleService.GetModels(p => p.ID == iId).FirstOrDefault();
                if (!data_Push_RuleService.Delete(data_Push_Rule))
                {
                    errMsg = "删除投币规则信息失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #6
0
        public object GetCouponInfo(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_CouponInfoService data_CouponInfoService = BLLContainer.Resolve <IData_CouponInfoService>();
                var data_CouponInfo = data_CouponInfoService.GetModels(p => p.ID == iId).FirstOrDefault();
                if (data_CouponInfo == null)
                {
                    errMsg = "该优惠券不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_CouponInfo));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #7
0
        public object QueryPushRule(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select b.GameID, b.GameName, a.ID, a.MemberLevelName, a.Week, a.Allow_Out, a.Allow_In, a.Coin, a.Level, a.StartTime as ST, a.EndTime as ET from Data_Push_Rule a " +
                             " inner join Data_GameInfo b on a.GameIndexID=b.ID " +
                             " where b.StoreID='" + storeId + "'";
                sql = sql + sqlWhere;
                IData_Push_RuleService data_Push_RuleService = BLLContainer.Resolve <IData_Push_RuleService>();
                var data_Push_Rule = data_Push_RuleService.SqlQuery <Data_Push_RuleList>(sql, parameters).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Push_Rule));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #8
0
        public object GetGoodsInfo(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);
                IBase_GoodsInfoService base_GoodsInfoService = BLLContainer.Resolve <IBase_GoodsInfoService>();
                if (!base_GoodsInfoService.Any(a => a.ID == iId))
                {
                    errMsg = "该商品信息不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var result = from a in base_GoodsInfoService.GetModels(p => p.ID == iId).FirstOrDefault().AsDictionary()
                             select new
                {
                    name  = a.Key,
                    value = a.Value
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #9
0
        public object QueryWorkstation(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select a.* from Data_Workstation a where a.StoreID='" + storeId + "'";
                sql = sql + sqlWhere;
                IData_WorkstationService data_WorkstationService = BLLContainer.Resolve <IData_WorkstationService>();
                var data_Workstation = data_WorkstationService.SqlQuery(sql, parameters).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, data_Workstation));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object DelChainStore(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);
                IBase_ChainRule_StoreService base_ChainRule_StoreService = BLLContainer.Resolve <IBase_ChainRule_StoreService>();
                if (!base_ChainRule_StoreService.Any(a => a.ID == iId))
                {
                    errMsg = "该门店连锁规则不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var base_ChainRule_StoreModel = base_ChainRule_StoreService.GetModels(p => p.ID == iId).FirstOrDefault();
                if (!base_ChainRule_StoreService.Delete(base_ChainRule_StoreModel))
                {
                    errMsg = "删除接收余额的门店失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object GetStoreWeightList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg  = string.Empty;
                string storeId = dicParas.ContainsKey("storeId") ? (dicParas["storeId"] + "") : string.Empty;

                if (string.IsNullOrEmpty(storeId))
                {
                    errMsg = "门店ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IBase_UserInfoService    base_UserInfoService    = BLLContainer.Resolve <IBase_UserInfoService>(resolveNew: true);
                IBase_StoreWeightService base_StoreWeightService = BLLContainer.Resolve <IBase_StoreWeightService>(resolveNew: true);
                var result = from a in base_UserInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && p.UserType == (int)UserType.StoreBoss)
                             join b in base_StoreWeightService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)) on a.UserID equals b.BossID
                             select new
                {
                    RealName    = a.RealName,
                    LogName     = a.LogName,
                    WeightValue = b.WeightValue,
                    ID          = b.ID
                };

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #12
0
        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 GetStoreWeightGameList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg  = string.Empty;
                string storeId = dicParas.ContainsKey("storeId") ? (dicParas["storeId"] + "") : string.Empty;

                if (string.IsNullOrEmpty(storeId))
                {
                    errMsg = "门店ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IData_GameInfoService         data_GameInfoService         = BLLContainer.Resolve <IData_GameInfoService>(resolveNew: true);
                IBase_StoreWeight_GameService base_StoreWeight_GameService = BLLContainer.Resolve <IBase_StoreWeight_GameService>(resolveNew: true);
                var result = from a in data_GameInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase))
                             join b in base_StoreWeight_GameService.GetModels() on a.ID equals b.GameID into b1
                             from b in b1.DefaultIfEmpty()
                             where b.GameID == (int?)null
                             select new
                {
                    GameName = a.GameName,
                    GameID   = a.ID
                };

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #14
0
        public object DeletePicture(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg   = string.Empty;
                string fileName = dicParas.ContainsKey("fileName") ? dicParas["fileName"].ToString() : string.Empty;

                if (fileName == null)
                {
                    errMsg = "图片名称不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                string picturePath = System.Configuration.ConfigurationManager.AppSettings["UploadImageUrl"].ToString() + "/XCCloud/";
                string path        = System.Web.HttpContext.Current.Server.MapPath(picturePath);

                IData_BillInfoService data_BillInfoService = BLLContainer.Resolve <IData_BillInfoService>();
                SqlParameter[]        parameters           = new SqlParameter[1];
                parameters[0] = new SqlParameter("@PicturePath", picturePath + fileName);
                data_BillInfoService.ExecuteSqlCommand("update Data_BillInfo set PicturePath='' where PicturePath=@PicturePath", parameters);

                if (File.Exists(path + fileName))
                {
                    File.Delete(path + fileName);
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #15
0
        public object addTicket(Dictionary <string, object> dicParas)
        {
            StoreCacheModel storeCacheModel = null;
            string          errMsg          = string.Empty;
            string          tickets         = dicParas.ContainsKey("tickets") ? dicParas["tickets"].ToString() : string.Empty;
            string          storeId         = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

            XCCloudService.Business.XCGameMana.StoreBusiness     storeBusiness = new XCCloudService.Business.XCGameMana.StoreBusiness();
            XCCloudService.BLL.IBLL.XCGameManager.ITicketService ticketService = BLLContainer.Resolve <XCCloudService.BLL.IBLL.XCGameManager.ITicketService>();
            if (storeBusiness.IsEffectiveStore(storeId, ref storeCacheModel, out errMsg))
            {
                string[] ticketArr = tickets.Split(',');
                for (int i = 0; i < ticketArr.Length; i++)
                {
                    string curTicketNo = ticketArr[i];
                    if (ticketService.GetModels(p => p.StoreId.Equals(storeId) && p.TicketNo.Equals(curTicketNo)).Count <t_ticket>() == 0)
                    {
                        t_ticket ticket = new t_ticket();
                        ticket.TicketNo   = ticketArr[i];
                        ticket.StoreId    = storeId;
                        ticket.CreateTime = System.DateTime.Now;
                        ticketService.Add(ticket);
                    }
                }
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, ""));
            }
            else
            {
                return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, ""));
            }
        }
Exemple #16
0
        public object DelMerch(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg  = string.Empty;
                string merchId = dicParas.ContainsKey("merchId") ? dicParas["merchId"].ToString() : string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string createUserId = userTokenKeyModel.LogId;

                #region 验证参数

                if (string.IsNullOrWhiteSpace(merchId))
                {
                    errMsg = "商户编号不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!string.IsNullOrEmpty(merchId) && merchId.Length > 11)
                {
                    errMsg = "商户编号不能超过11个字符";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                #endregion

                IBase_MerchantInfoService base_MerchantInfoService = BLLContainer.Resolve <IBase_MerchantInfoService>();
                if (base_MerchantInfoService.Any(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)))
                {
                    var base_MerchantInfoModel = base_MerchantInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
                    if (base_MerchantInfoModel.CreateType == (int)CreateType.Agent && !base_MerchantInfoModel.CreateUserID.Equals(createUserId, StringComparison.OrdinalIgnoreCase)) //代理商创建
                    {
                        errMsg = "该商户只有所属代理商能删除";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }

                    base_MerchantInfoModel.MerchStatus = (int)MerchState.Stop;
                    if (!base_MerchantInfoService.Update(base_MerchantInfoModel))
                    {
                        errMsg = "删除商户信息失败";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }
                else
                {
                    errMsg = "该商户信息不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                //更新缓存
                MerchBusiness.Init();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #17
0
        public object GetDigitDestroy(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg      = string.Empty;
                string destroyTime = dicParas.ContainsKey("destroyTime") ? (dicParas["destroyTime"] + "") : string.Empty;
                string iCardID     = dicParas.ContainsKey("iCardID") ? (dicParas["iCardID"] + "") : string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                if (!string.IsNullOrEmpty(destroyTime))
                {
                    try
                    {
                        Convert.ToDateTime(destroyTime);
                    }
                    catch
                    {
                        errMsg = "销毁时间参数格式不正确";
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                IData_DigitCoinDestroyService data_DigitCoinDestroyService = BLLContainer.Resolve <IData_DigitCoinDestroyService>();
                var query = data_DigitCoinDestroyService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase));
                if (!string.IsNullOrEmpty(destroyTime))
                {
                    var dt = Convert.ToDateTime(destroyTime);
                    query = query.Where(w => DbFunctions.DiffDays(w.DestroyTime, dt) == 0);
                }

                if (!string.IsNullOrEmpty(iCardID))
                {
                    query = query.Where(w => w.ICCardID.Contains(iCardID));
                }

                IBase_UserInfoService base_UserInfoService = BLLContainer.Resolve <IBase_UserInfoService>();
                var linq = base_UserInfoService.GetModels(p => p.UserType == (int)UserType.Store).Select(o => new { UserID = o.UserID, LogName = o.LogName, RealName = o.RealName });

                var result = query.ToList().Select(o => new
                {
                    ID          = o.ID,
                    StoreID     = o.StoreID,
                    ICardID     = o.ICCardID,
                    DestroyTime = o.DestroyTime,
                    UserID      = o.UserID,
                    Note        = o.Note,
                    LogName     = linq.SingleOrDefault(p => p.UserID == o.UserID).LogName,
                    RealName    = linq.SingleOrDefault(p => p.UserID == o.UserID).RealName
                });

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, result.ToList()));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object DelStoreWeight(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string id     = dicParas.ContainsKey("id") ? (dicParas["id"] + "") : string.Empty;

                #region 验证参数
                if (string.IsNullOrEmpty(id))
                {
                    errMsg = "门店权重ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }
                #endregion

                //开启EF事务
                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        IBase_StoreWeightService base_StoreWeightService = BLLContainer.Resolve <IBase_StoreWeightService>();
                        int iId = Convert.ToInt32(id);
                        var base_StoreWeight = base_StoreWeightService.GetModels(p => p.ID == iId).FirstOrDefault();
                        if (!base_StoreWeightService.Delete(base_StoreWeight))
                        {
                            errMsg = "删除门店权重信息失败";
                            return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                        }

                        var dbContext             = DbContextFactory.CreateByModelNamespace(typeof(Base_StoreWeight_Game).Namespace);
                        var base_StoreWeight_Game = dbContext.Set <Base_StoreWeight_Game>().Where(p => p.WeightID == iId).ToList();
                        foreach (var model in base_StoreWeight_Game)
                        {
                            dbContext.Entry(model).State = EntityState.Deleted;
                        }

                        if (dbContext.SaveChanges() < 0)
                        {
                            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));
            }
        }
Exemple #19
0
        public object GetBindDeviceList(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string errMsg        = string.Empty;
                string type          = dicParas.ContainsKey("type") ? (dicParas["type"] + "") : string.Empty;
                string mcuId         = dicParas.ContainsKey("mcuId") ? (dicParas["mcuId"] + "") : string.Empty;
                var    bindDeviceIDs = dicParas.ContainsKey("bindDeviceIDs") ? ((object[])dicParas["bindDeviceIDs"]).Cast <int>() : null;

                if (!string.IsNullOrEmpty(type) && !Utils.isNumber(type))
                {
                    errMsg = "设备类型格式不正确";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var dbContext           = DbContextFactory.CreateByModelNamespace(typeof(Base_UserInfo).Namespace);
                var data_Project_Device = from a in dbContext.Set <Data_Project_Device>()
                                          join b in dbContext.Set <Data_ProjectInfo>() on a.ProjectID equals b.ID
                                          where b.ProjectStatus == 1
                                          select a.DeviceID;
                var base_DeviceInfo = dbContext.Set <Base_DeviceInfo>().Where(p => p.DeviceStatus == (int)DeviceStatus.Normal && p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && !data_Project_Device.Contains(p.ID));
                if (!string.IsNullOrEmpty(type))
                {
                    int iType = Convert.ToInt32(type);
                    base_DeviceInfo = base_DeviceInfo.Where(w => w.type == iType);
                }
                if (!string.IsNullOrEmpty(mcuId))
                {
                    base_DeviceInfo = base_DeviceInfo.Where(w => w.MCUID.Contains(mcuId));
                }
                if (bindDeviceIDs != null)
                {
                    base_DeviceInfo = base_DeviceInfo.Where(w => !bindDeviceIDs.Contains(w.ID));
                }

                int DeviceTypeId = dbContext.Set <Dict_System>().Where(p => p.DictKey.Equals("设备类型")).FirstOrDefault().ID;
                var linq         = from a in base_DeviceInfo
                                   join b in dbContext.Set <Dict_System>().Where(p => p.PID == DeviceTypeId) on(a.type + "") equals b.DictValue into b1
                                   from b in b1.DefaultIfEmpty()
                                   select new
                {
                    ID         = a.ID,
                    DeviceName = a.DeviceName,
                    typeStr    = b != null ? b.DictKey : string.Empty,
                    MCUID      = a.MCUID
                };

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, linq.ToList()));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #20
0
        public object SetParam(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg  = string.Empty;
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string system  = dicParas.ContainsKey("system") ? dicParas["system"].ToString() : string.Empty;
                string isAllow = dicParas.ContainsKey("isAllow") ? dicParas["isAllow"].ToString() : string.Empty;
                string pValue  = dicParas.ContainsKey("pValue") ? dicParas["pValue"].ToString() : string.Empty;
                string note    = dicParas.ContainsKey("note") ? dicParas["note"].ToString() : string.Empty;

                //验证参数信息
                if (!checkParams(dicParas, out errMsg))
                {
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (string.IsNullOrEmpty(system))
                {
                    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) && p.System.Equals(system, StringComparison.OrdinalIgnoreCase)).ToList();

                int count = data_Parameter.Count;
                if (count == 0)
                {
                    errMsg = "参数" + system + "数据库不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (count > 1)
                {
                    errMsg = "参数" + system + "数据库存在多个";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var data_ParameterModel = data_Parameter.FirstOrDefault();
                data_ParameterModel.IsAllow        = !string.IsNullOrEmpty(isAllow) ? Convert.ToInt32(isAllow) : (int?)null;
                data_ParameterModel.ParameterValue = pValue;
                data_ParameterModel.Note           = note;

                if (!data_ParameterService.Update(data_ParameterModel))
                {
                    errMsg = "设置参数失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object DeleteRoot(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                int    id     = (dicParas.ContainsKey("id") && Utils.isNumber(dicParas["id"])) ? Convert.ToInt32(dicParas["id"]) : 0;

                if (id == 0)
                {
                    errMsg = "选中节点id不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                //开启EF事务
                using (TransactionScope ts = new TransactionScope())
                {
                    try
                    {
                        var dbContext = DbContextFactory.CreateByModelNamespace(typeof(Dict_System).Namespace);
                        if (!dbContext.Set <Dict_System>().Any(p => p.ID == id))
                        {
                            errMsg = "选中节点数据库不存在";
                            return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                        }

                        var dict_System = dbContext.Set <Dict_System>().Where(p => p.PID == id).ToList();
                        foreach (var item in dict_System)
                        {
                            dbContext.Entry(item).State = EntityState.Deleted;
                        }

                        var dict_SystemModel = dbContext.Set <Dict_System>().Where(p => p.ID == id).FirstOrDefault();
                        dbContext.Entry(dict_SystemModel).State = EntityState.Deleted;

                        if (dbContext.SaveChanges() < 0)
                        {
                            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));
            }
        }
Exemple #22
0
        public object GetUserGroup(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];

                string errMsg  = string.Empty;
                string groupId = dicParas.ContainsKey("groupId") ? dicParas["groupId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(groupId))
                {
                    errMsg = "groupId参数不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                string         sql        = string.Empty;
                SqlParameter[] parameters = new SqlParameter[0];
                if (userTokenKeyModel.LogType == (int)RoleType.MerchUser)
                {
                    string merchId = userTokenKeyModel.DataModel.MerchID;
                    sql = " exec  SelectUserGroupGrant @GroupID,@MerchID";
                    Array.Resize(ref parameters, parameters.Length + 1);
                    parameters[parameters.Length - 1] = new SqlParameter("@GroupID", groupId);
                    Array.Resize(ref parameters, parameters.Length + 1);
                    parameters[parameters.Length - 1] = new SqlParameter("@MerchID", merchId);
                }
                else if (userTokenKeyModel.LogType == (int)RoleType.XcAdmin)
                {
                    sql = " exec  SelectFunctionForXA @GroupID";
                    Array.Resize(ref parameters, parameters.Length + 1);
                    parameters[parameters.Length - 1] = new SqlParameter("@GroupID", groupId);
                }

                //返回商户信息和功能菜单信息
                System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
                if (ds.Tables.Count != 2)
                {
                    errMsg = "获取数据异常";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                //实例化一个根节点
                var userGroupModel           = Utils.GetModelList <UserGroupModel>(ds.Tables[0]).FirstOrDefault() ?? new UserGroupModel();
                UserGroupGrantModel rootRoot = new UserGroupGrantModel();
                rootRoot.ParentID = 0;
                TreeHelper.LoopToAppendChildren(Utils.GetModelList <UserGroupGrantModel>(ds.Tables[1]), rootRoot);
                userGroupModel.UserGroupGrants = rootRoot.Children;

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, userGroupModel));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
        public object GetUnChainStoreList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg   = string.Empty;
                string storeId  = dicParas.ContainsKey("storeId") ? (dicParas["storeId"] + "") : string.Empty;
                string ruleType = dicParas.ContainsKey("ruleType") ? (dicParas["ruleType"] + "") : string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string merchId = userTokenKeyModel.DataModel.MerchID;

                if (string.IsNullOrEmpty(storeId))
                {
                    errMsg = "门店ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (string.IsNullOrEmpty(ruleType))
                {
                    errMsg = "规则类别不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!Utils.isNumber(ruleType))
                {
                    errMsg = "规则类别格式不正确";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int iRuleType = Convert.ToInt32(ruleType);
                IBase_StoreInfoService       base_StoreInfoService       = BLLContainer.Resolve <IBase_StoreInfoService>(resolveNew: true);
                IBase_ChainRuleService       base_ChainRuleService       = BLLContainer.Resolve <IBase_ChainRuleService>(resolveNew: true);
                IBase_ChainRule_StoreService base_ChainRule_StoreService = BLLContainer.Resolve <IBase_ChainRule_StoreService>(resolveNew: true);
                var result = from a in base_StoreInfoService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase))
                             join b in
                             (
                    from a in base_ChainRuleService.GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase) && p.RuleType == iRuleType)
                    join b in base_ChainRule_StoreService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)) on a.RuleGroupID equals b.RuleGroupID
                    join c in base_ChainRule_StoreService.GetModels() on b.RuleGroupID equals c.RuleGroupID
                    select c
                             ) on a.StoreID equals b.StoreID into b1
                             from b in b1.DefaultIfEmpty()
                             where string.IsNullOrEmpty(b.StoreID)
                             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));
            }
        }
Exemple #24
0
        public object QueryFreeRule(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;

                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select c.ID, b.GameID, b.GameName, d.MemberLevelName as MemberLevelName, (case c.RuleType when 0 then '模拟机' when 1 then '博彩机' else '' end) as RuleTypeStr, " +
                             " c.NeedCoin, c.FreeCoin, c.ExitCoin, c.StartTime as ST, c.EndTime as ET, c.State from Data_GameFreeRule_List a " +
                             " inner join Data_GameInfo b on a.GameIndexID=b.ID " +
                             " inner join Data_GameFreeRule c on a.RuleID=c.ID " +
                             " left join Data_MemberLevel d on c.MemberLevelID=d.MemberLevelID" +
                             " where b.StoreID='" + storeId + "'";
                sql = sql + sqlWhere;
                IData_GameFreeRuleService data_GameFreeRuleService = BLLContainer.Resolve <IData_GameFreeRuleService>();
                var data_GameFreeRule = data_GameFreeRuleService.SqlQuery <Data_GameFreeRuleList>(sql, parameters).ToList();
                var linq = from a in data_GameFreeRule
                           group a by new { ID = a.ID } into g
                    select new {
                    g.Key.ID,
                    GameID          = string.Join("|", g.Select(p => p.GameID)),
                    GameName        = string.Join("|", g.Select(p => p.GameName)),
                    MemberLevelName = g.Max(p => p.MemberLevelName),
                    RuleTypeStr     = g.Max(p => p.RuleTypeStr),
                    NeedCoin        = g.Max(p => p.NeedCoin),
                    FreeCoin        = g.Max(p => p.FreeCoin),
                    ExitCoin        = g.Max(p => p.ExitCoin),
                    StartTime       = g.Max(p => p.StartTime),
                    EndTime         = g.Max(p => p.EndTime),
                    State           = g.Max(p => p.State)
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, linq));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #25
0
        public object GetJackpotInfo(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_JackpotInfoService data_JackpotInfoService = BLLContainer.Resolve <IData_JackpotInfoService>();
                var data_JackpotInfo = data_JackpotInfoService.GetModels(p => p.ID == iId).FirstOrDefault();
                if (data_JackpotInfo == null)
                {
                    errMsg = "该抽奖规则不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IData_Jackpot_LevelService data_Jackpot_LevelService = BLLContainer.Resolve <IData_Jackpot_LevelService>(resolveNew: true);
                IBase_GoodsInfoService     base_GoodsInfoService     = BLLContainer.Resolve <IBase_GoodsInfoService>(resolveNew: true);
                var JackpotLevels = from a in data_Jackpot_LevelService.GetModels(p => p.ActiveID == iId)
                                    join b in base_GoodsInfoService.GetModels() on a.GoodID equals b.ID
                                    select new
                {
                    LevelName   = a.LevelName,
                    GoodCount   = a.GoodCount,
                    Probability = a.Probability,
                    GoodID      = a.GoodID,
                    GoodName    = b.GoodName
                };

                var result = new
                {
                    ID            = data_JackpotInfo.ID,
                    ActiveName    = data_JackpotInfo.ActiveName,
                    Threshold     = data_JackpotInfo.Threshold,
                    Concerned     = data_JackpotInfo.Concerned,
                    StartTime     = data_JackpotInfo.StartTime,
                    EndTime       = data_JackpotInfo.EndTime,
                    JackpotLevels = JackpotLevels
                };

                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, result));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #26
0
        public object GetMerchList(Dictionary <string, object> dicParas)
        {
            try
            {
                string   errMsg     = string.Empty;
                object[] conditions = dicParas.ContainsKey("conditions") ? (object[])dicParas["conditions"] : null;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];

                //代理商仅能查所属商户,普通商户或大客户只能查自己,莘宸管理员可以查所有商户
                SqlParameter[] parameters = new SqlParameter[0];
                string         sqlWhere   = string.Empty;
                if (userTokenKeyModel.LogType == (int)RoleType.MerchUser)
                {
                    var merchIdDataModel = userTokenKeyModel.DataModel as MerchDataModel;
                    Array.Resize(ref parameters, parameters.Length + 1);
                    if (merchIdDataModel.MerchType == (int)MerchType.Agent)
                    {
                        parameters[parameters.Length - 1] = new SqlParameter("@logId", userTokenKeyModel.LogId);
                        sqlWhere = sqlWhere + " and a.CreateUserID=@logId";
                    }
                    else
                    {
                        parameters[parameters.Length - 1] = new SqlParameter("@merchId", merchIdDataModel.MerchID);
                        sqlWhere = sqlWhere + " and a.MerchID=@merchId";
                    }
                }

                if (conditions != null && conditions.Length > 0)
                {
                    if (!QueryBLL.GenDynamicSql(conditions, "a.", ref sqlWhere, ref parameters, out errMsg))
                    {
                        return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                    }
                }

                string sql = @"select a.MerchID, a.MerchName, a.Mobil, b.DictKey as MerchTypeStr, a.MerchAccount, d.DictKey as AllowCreateSubStr, a.AllowCreateCount, c.DictKey as MerchStatusStr from Base_MerchantInfo a " +
                             " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='商户类别' and a.PID=0) b on convert(varchar, a.MerchType)=b.DictValue " +
                             " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='商户状态' and a.PID=0) c on convert(varchar, a.MerchStatus)=c.DictValue " +
                             " left join (select b.* from Dict_System a inner join Dict_System b on a.ID=b.PID where a.DictKey='创建子账号' and a.PID=0) d on convert(varchar, a.AllowCreateSub)=d.DictValue " +
                             " where 1=1 ";
                sql = sql + sqlWhere;
                var dbContext         = DbContextFactory.CreateByModelNamespace(typeof(Base_MerchantInfo).Namespace);
                var base_MerchantInfo = dbContext.Database.SqlQuery <Base_MerchantInfoListModel>(sql, parameters).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, base_MerchantInfo));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #27
0
        public object AddCoinStorage(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg       = string.Empty;
                string storageCount = dicParas.ContainsKey("storageCount") ? (dicParas["storageCount"] + "") : string.Empty;
                string note         = dicParas.ContainsKey("note") ? (dicParas["note"] + "") : string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                int    userId  = Convert.ToInt32(userTokenKeyModel.LogId);
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                if (string.IsNullOrEmpty(storageCount))
                {
                    errMsg = "入库数量不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!Utils.isNumber(storageCount))
                {
                    errMsg = "入库数量参数格式不正确";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int iStorageCount = Convert.ToInt32(storageCount);
                if (iStorageCount < 0)
                {
                    errMsg = "入库数量必不能为负数";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                IData_CoinStorageService data_CoinStorageService = BLLContainer.Resolve <IData_CoinStorageService>();
                Data_CoinStorage         data_CoinStorage        = new Data_CoinStorage();
                data_CoinStorage.DestroyTime  = DateTime.Now;
                data_CoinStorage.Note         = note;
                data_CoinStorage.StorageCount = iStorageCount;
                data_CoinStorage.UserID       = userId;
                data_CoinStorage.StoreID      = storeId;
                if (!data_CoinStorageService.Add(data_CoinStorage))
                {
                    errMsg = "更新数据库失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #28
0
        public object UploadCardCover(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;

                #region 验证参数

                var file = HttpContext.Current.Request.Files[0];
                if (file == null)
                {
                    errMsg = "未找到图片";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (file.ContentLength > int.Parse(System.Configuration.ConfigurationManager.AppSettings["MaxImageSize"].ToString()))
                {
                    errMsg = "超过图片的最大限制为1M";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                #endregion

                string picturePath = System.Configuration.ConfigurationManager.AppSettings["UploadImageUrl"].ToString() + "/XCCloud/Store/Member/";
                string path        = System.Web.HttpContext.Current.Server.MapPath(picturePath);
                //如果不存在就创建file文件夹
                if (Directory.Exists(path) == false)
                {
                    Directory.CreateDirectory(path);
                }

                string fileName = Path.GetFileNameWithoutExtension(file.FileName) + Utils.ConvertDateTimeToLong(DateTime.Now) + Path.GetExtension(file.FileName);

                if (File.Exists(path + fileName))
                {
                    errMsg = "图片名称已存在,请重命名后上传";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                file.SaveAs(path + fileName);

                Dictionary <string, string> dicStoreInfo = new Dictionary <string, string>(StringComparer.OrdinalIgnoreCase);
                dicStoreInfo.Add("CardUIURL", picturePath + fileName);
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, dicStoreInfo));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemple #29
0
        public object CheckDevice(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg    = string.Empty;
                string id        = dicParas.ContainsKey("id") ? Convert.ToString(dicParas["id"]) : string.Empty;
                string realCount = dicParas.ContainsKey("realCount") ? Convert.ToString(dicParas["realCount"]) : string.Empty;

                #region 参数验证

                if (string.IsNullOrEmpty(id))
                {
                    errMsg = "安装索引id不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (string.IsNullOrEmpty(realCount))
                {
                    errMsg = "实点数realCount不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!Utils.isNumber(realCount))
                {
                    errMsg = "实点数realCount格式不正确";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                int iRealCount = Convert.ToInt32(realCount);
                if (iRealCount < 0)
                {
                    errMsg = "实点数realCount不能为负数";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                #endregion


                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));
            }
        }
Exemple #30
0
        public object DeleteBill(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string id     = dicParas.ContainsKey("id") ? dicParas["id"].ToString() : string.Empty;

                #region 验证参数
                if (string.IsNullOrEmpty(id))
                {
                    errMsg = "ID不能为空";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (!Utils.isNumber(id))
                {
                    errMsg = "ID须为整形";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }
                #endregion

                IData_BillInfoService data_BillInfoService = BLLContainer.Resolve <IData_BillInfoService>();
                int iId = Convert.ToInt32(id);
                if (!data_BillInfoService.Any(p => p.ID.Equals(iId)))
                {
                    errMsg = "该海报Id不存在";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                var data_BillInfoModel = data_BillInfoService.GetModels(p => p.ID.Equals(iId)).FirstOrDefault <Data_BillInfo>();
                if (!data_BillInfoService.Delete(data_BillInfoModel))
                {
                    errMsg = "删除海报失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

                if (File.Exists(data_BillInfoModel.PicturePath))
                {
                    File.Delete(data_BillInfoModel.PicturePath);
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }