示例#1
0
        public object AddGivebackRule(Dictionary <string, object> dicParas)
        {
            try
            {
                string errMsg             = string.Empty;
                string storeId            = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
                string memberLvlId        = dicParas.ContainsKey("memberLvlId") ? dicParas["memberLvlId"].ToString() : string.Empty;
                string allowBackPrincipal = dicParas.ContainsKey("allowBackPrincipal") ? dicParas["allowBackPrincipal"].ToString() : string.Empty;
                string backType           = dicParas.ContainsKey("backType") ? dicParas["backType"].ToString() : string.Empty;
                string allowContainToday  = dicParas.ContainsKey("allowContainToday") ? dicParas["allowContainToday"].ToString() : string.Empty;
                string backMin            = dicParas.ContainsKey("backMin") ? dicParas["backMin"].ToString() : string.Empty;
                string backMax            = dicParas.ContainsKey("backMax") ? dicParas["backMax"].ToString() : string.Empty;
                string backScale          = dicParas.ContainsKey("backScale") ? dicParas["backScale"].ToString() : string.Empty;
                string exitCardMin        = dicParas.ContainsKey("exitCardMin") ? dicParas["exitCardMin"].ToString() : string.Empty;
                string totalDays          = dicParas.ContainsKey("totalDays") ? dicParas["totalDays"].ToString() : string.Empty;

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

                IData_GivebackRuleService data_GivebackRuleService = BLLContainer.Resolve <IData_GivebackRuleService>();
                Data_GivebackRule         data_GivebackRule        = new Data_GivebackRule();
                data_GivebackRule.StoreID            = storeId;
                data_GivebackRule.MemberLevelID      = Convert.ToInt32(memberLvlId);
                data_GivebackRule.AllowBackPrincipal = Convert.ToInt32(allowBackPrincipal);
                data_GivebackRule.Backtype           = Convert.ToInt32(backType);
                data_GivebackRule.AllowContainToday  = Convert.ToInt32(allowContainToday);
                data_GivebackRule.BackMin            = !string.IsNullOrEmpty(backMin) ? Convert.ToInt32(dicParas["backMin"]) : (int?)null;
                data_GivebackRule.BackMax            = !string.IsNullOrEmpty(backMax) ? Convert.ToInt32(dicParas["backMax"]) : (int?)null;
                data_GivebackRule.BackScale          = !string.IsNullOrEmpty(backScale) ? Convert.ToInt32(dicParas["backScale"]) : (int?)null;
                data_GivebackRule.ExitCardMin        = !string.IsNullOrEmpty(exitCardMin) ? Convert.ToInt32(dicParas["exitCardMin"]) : (int?)null;
                data_GivebackRule.TotalDays          = !string.IsNullOrEmpty(totalDays) ? Convert.ToInt32(dicParas["totalDays"]) : (int?)null;

                if (!data_GivebackRuleService.Add(data_GivebackRule))
                {
                    errMsg = "添加返还规则失败";
                    return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg));
                }

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

                IData_GivebackRuleService data_GivebackRuleService = BLLContainer.Resolve <IData_GivebackRuleService>();
                var data_GivebackRule = data_GivebackRuleService.GetModels(p => p.StoreID.Equals(storeId, StringComparison.OrdinalIgnoreCase)).ToList();

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