Example #1
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));
            }
        }
Example #2
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));
            }
        }