Exemplo n.º 1
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, "工作组列表为空"));
            }
        }
Exemplo n.º 2
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));
            }
        }
Exemplo n.º 3
0
        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));
            }
        }
Exemplo n.º 4
0
        public object GetOrdersChart(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string merchId = userTokenKeyModel.DataModel.MerchID;

                DateTime now   = DateTime.Now;
                DateTime start = new DateTime(now.Year, now.Month, 1);
                DateTime end   = start.AddMonths(1).AddDays(-1);
                TimeSpan ts    = end.Subtract(start);
                int      num   = ts.Days;

                List <Store_CheckDateChartModel> store_CheckDateChart = new List <Store_CheckDateChartModel>();
                var base_StoreInfo  = BLLContainer.Resolve <IBase_StoreInfoService>().GetModels(p => p.MerchID.Equals(merchId, StringComparison.OrdinalIgnoreCase)).Select(o => o.StoreID);
                var store_CheckDate = BLLContainer.Resolve <IStore_CheckDateService>().GetModels(p => base_StoreInfo.Contains(p.StoreID) && System.Data.Entity.DbFunctions.DiffMonths(p.CheckDate, DateTime.Now) == 0);
                for (int i = 0; i <= num; i++)
                {
                    DateTime da    = start.AddDays(i).Date;
                    var      query = store_CheckDate.Where(p => System.Data.Entity.DbFunctions.DiffDays(p.CheckDate, da) == 0);
                    Store_CheckDateChartModel store_CheckDateModel = new Store_CheckDateChartModel();
                    store_CheckDateModel.CheckDate = da;
                    store_CheckDateModel.AliPay    = (decimal)query.Sum(s => s.AliPay).GetValueOrDefault();
                    store_CheckDateModel.Wechat    = (decimal)query.Sum(s => s.Wechat).GetValueOrDefault();
                    store_CheckDateChart.Add(store_CheckDateModel);
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, store_CheckDateChart));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 5
0
        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));
            }
        }
Exemplo n.º 6
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));
            }
        }
Exemplo n.º 7
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, ""));
            }
        }
Exemplo n.º 8
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));
            }
        }
Exemplo n.º 9
0
        public object GetProjectInfoList(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                var data_ProjectInfoService = BLLContainer.Resolve <IData_ProjectInfoService>(resolveNew: true);
                var dict_SystemService      = BLLContainer.Resolve <IDict_SystemService>(resolveNew: true);
                int FeeTypeId = dict_SystemService.GetModels(p => p.DictKey.Equals("计费方式")).FirstOrDefault().ID;

                var linq = from a in data_ProjectInfoService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && p.ProjectStatus == 1)
                           join b in dict_SystemService.GetModels(p => p.PID == FeeTypeId) on(a.FeeType + "") equals b.DictValue into b1
                           from b in b1.DefaultIfEmpty()
                           select new
                {
                    ID               = a.ID,
                    ProjectName      = a.ProjectName,
                    ProjectStatusStr = a.ProjectStatus == 1 ? "有效" : "无效",
                    FeeCycle         = a.FeeCycle,
                    FeeDeposit       = a.FeeDeposit,
                    SignOutEnStr     = a.SignOutEN == 1 ? "需要签出" : "单次扣费",
                    WhenLockStr      = a.WhenLock == 1 ? "是" : "否",
                    RegretTime       = a.RegretTime,
                    Note             = a.Note,
                    FeeTypeStr       = b != null ? b.DictKey : string.Empty
                };

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, linq.ToList()));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 10
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));
            }
        }
Exemplo n.º 11
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));
            }
        }
Exemplo n.º 12
0
        public object GetGameHeadInfo(Dictionary <string, object> dicParas)
        {
            try
            {
                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                string storeId = (userTokenKeyModel.DataModel as UserDataModel).StoreID;

                string errMsg       = string.Empty;
                string gameIndexId  = dicParas.ContainsKey("gameIndexId") ? Convert.ToString(dicParas["gameIndexId"]) : string.Empty;
                int    iGameIndexId = 0;
                int.TryParse(gameIndexId, out iGameIndexId);

                IData_HeadService        data_HeadService = BLLContainer.Resolve <IData_HeadService>();
                Dictionary <int, string> gameHeadInfo     = data_HeadService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase) && p.GameIndexID == iGameIndexId).Select(o => new
                {
                    ID       = o.ID,
                    HeadName = o.HeadName
                }).Distinct().ToDictionary(d => d.ID, d => d.HeadName);

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, gameHeadInfo));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 13
0
        public object getFoodDetail(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

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

            if (string.IsNullOrEmpty(foodId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "套餐名不能为空"));
            }

            string sql = "exec GetFoodDetail @StoreId,@FoodId ";

            SqlParameter[] parameters = new SqlParameter[2];
            parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId);
            parameters[1] = new SqlParameter("@FoodId", foodId);
            System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
            DataTable           dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <FoodDetailModel> list1 = Utils.GetModelList <FoodDetailModel>(ds.Tables[0]).ToList();
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
            }
        }
Exemplo n.º 14
0
        public object unBindStore(Dictionary <string, object> dicParas)
        {
            try
            {
                string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

                if (string.IsNullOrEmpty(storeId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "storeId参数不能为空"));
                }

                int           iStoreId     = Convert.ToInt32(storeId);
                IStoreService storeService = BLLContainer.Resolve <IStoreService>();
                if (!storeService.Any(a => a.id == iStoreId))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "该门店不存在"));
                }

                var storeInfo = storeService.GetModels(p => p.id == iStoreId).FirstOrDefault();
                storeInfo.openId = string.Empty;
                if (!storeService.Update(storeInfo))
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "解绑门店失败"));
                }

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 15
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));
            }
        }
Exemplo n.º 16
0
        public object getOrderContain(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string orderFlwId = dicParas.ContainsKey("orderFlwId") ? dicParas["orderFlwId"].ToString() : string.Empty;
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            if (string.IsNullOrEmpty(orderFlwId))
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "订单Id参数无效"));
            }

            string storedProcedure = "GetOrderContainById";

            SqlParameter[] sqlParameter = new SqlParameter[2];
            sqlParameter[0]       = new SqlParameter("@StoreId", SqlDbType.VarChar);
            sqlParameter[0].Value = userTokenDataModel.StoreId;
            sqlParameter[1]       = new SqlParameter("@OrderFlwId", SqlDbType.Int);
            sqlParameter[1].Value = orderFlwId;

            System.Data.DataSet ds = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, sqlParameter);
            if (ds != null && ds.Tables.Count == 2 && ds.Tables[0].Rows.Count > 0)
            {
                OrderMainModel          main   = Utils.GetModelList <OrderMainModel>(ds.Tables[0]).ToList()[0];
                List <OrderDetailModel> detail = Utils.GetModelList <OrderDetailModel>(ds.Tables[1]).ToList();
                OrderInfoModel          model  = new OrderInfoModel(main, detail);
                return(ResponseModelFactory.CreateSuccessModel <OrderInfoModel>(isSignKeyReturn, model));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "订单信息不存在"));
            }
        }
Exemplo n.º 17
0
        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));
            }
        }
Exemplo n.º 18
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));
            }
        }
Exemplo n.º 19
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));
            }
        }
Exemplo n.º 20
0
        public object GetUserGroupList(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg = string.Empty;
                string logId  = string.Empty;
                int    userId = (dicParas.ContainsKey("userId") && Utils.isNumber(dicParas["userId"])) ? Convert.ToInt32(dicParas["userId"]) : 0;

                XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel];
                if (userTokenKeyModel.LogType == (int)RoleType.MerchUser)
                {
                    logId = userTokenKeyModel.DataModel.MerchID;
                }

                //EF左关联
                var dbContext      = DbContextFactory.CreateByModelNamespace(typeof(Base_UserGroup).Namespace);
                var base_UserGroup = (from a in dbContext.Set <Base_UserGroup>()
                                      join b in dbContext.Set <Base_UserInfo>().Where(p => p.UserID == userId) on a.ID equals b.UserGroupID into t
                                      from b in t.DefaultIfEmpty()
                                      where a.MerchID.Equals(logId, StringComparison.OrdinalIgnoreCase)
                                      select new UserGroupModel
                {
                    ID = a.ID,
                    GroupName = a.GroupName,
                    Note = a.Note,
                    UserState = (b.UserID > 0 ? 1 : 0)
                }).ToList();

                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, base_UserGroup));
            }
            catch (Exception e)
            {
                return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message));
            }
        }
Exemplo n.º 21
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));
        }
Exemplo n.º 22
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));
            }
        }
Exemplo n.º 23
0
        public object getFoodList(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string customerType  = dicParas.ContainsKey("customerType") ? dicParas["customerType"].ToString() : string.Empty;
            string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty;
            string foodTypeStr   = dicParas.ContainsKey("foodTypeStr") ? dicParas["foodTypeStr"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(memberLevelId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员等级无效"));
            }

            string sql = "exec GetFoodListInfo @StoreId,@CustomerType,@MemberLevelId,@FoodTypeStr ";

            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId);
            parameters[1] = new SqlParameter("@CustomerType", customerType);
            parameters[2] = new SqlParameter("@MemberLevelId", memberLevelId);
            parameters[3] = new SqlParameter("@FoodTypeStr", foodTypeStr);
            System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters);
            DataTable           dt = ds.Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <FoodInfoModel> list1 = Utils.GetModelList <FoodInfoModel>(ds.Tables[0]).ToList();
                for (int i = 0; i < list1.Count; i++)
                {
                    List <FoodInfoPriceModel> listFoodInfoPriceModel = new List <FoodInfoPriceModel>();
                    FoodInfoPriceModel        foodInfoModel          = new FoodInfoPriceModel(0, list1[i].FoodPrice);
                    listFoodInfoPriceModel.Add(foodInfoModel);

                    if (list1[i].AllowCoin == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(1, list1[i].Coins);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    if (list1[i].AllowPoint == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(2, list1[i].Points);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    if (list1[i].AllowLottery == 1)
                    {
                        foodInfoModel = new FoodInfoPriceModel(3, list1[i].Lottery);
                        listFoodInfoPriceModel.Add(foodInfoModel);
                    }

                    list1[i].priceListModel = listFoodInfoPriceModel;
                }
                return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1));
            }

            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据"));
        }
Exemplo n.º 24
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));
            }
        }
Exemplo n.º 25
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));
            }
        }
Exemplo n.º 26
0
        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));
            }
        }
Exemplo n.º 27
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));
            }
        }
Exemplo n.º 28
0
        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));
            }
        }
Exemplo n.º 29
0
        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));
            }
        }
Exemplo n.º 30
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));
            }
        }