Example #1
0
        /// <summary>
        /// 验证经销商城快递代码对象是否有效
        /// </summary>
        /// <param name="model">经销商城快递代码</param>
        /// <param name="message">错误提示信息</param>
        /// <returns>有效:true,无效:false</returns>
        private bool IsValidModel(Model.DsMallExpressCode model, ref string message)
        {
            DsMallType mallType = BLL.Distribution.DsMallTypeBo.Instance.GetDsMallType(model.MallTypeSysNo);

            if (mallType == null || mallType.Status == (int)Model.WorkflowStatus.DistributionStatus.商城类型状态.禁用)
            {
                message = "商城类型不存在或已禁用";
                return(false);
            }

            CBLgDeliveryType deliveryType = BLL.Logistics.DeliveryTypeBo.Instance.GetDeliveryType(model.DeliveryType);

            if (deliveryType == null || deliveryType.Status == (int)Model.WorkflowStatus.LogisticsStatus.配送方式状态.禁用)
            {
                message = "配送方式不存在或已禁用";
                return(false);
            }

            if (string.IsNullOrWhiteSpace(model.ExpressCode))
            {
                message = "请填写第三方快递代码";
                return(false);
            }
            return(true);
        }
Example #2
0
        /// <summary>
        /// 添加经销商城快递代码
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// <remarks>2015-1-20 缪竞华 创建</remarks>
        public Result Add(Model.DsMallExpressCode model)
        {
            var res = new Result()
            {
                Status = false
            };
            string message = "";

            if (!IsValidModel(model, ref message))
            {
                res.Message = message;
                return(res);
            }

            model.ExpressCode = model.ExpressCode.Trim();
            DsMallExpressCode temp = IDsMallExpressCodeDao.Instance.Get(model.MallTypeSysNo, model.DeliveryType, model.ExpressCode);

            if (temp != null)
            {
                res.Message = "已存在相同经销商城快递代码";
                return(res);
            }
            model.CreatedDate = DateTime.Now;
            int sysNo = IDsMallExpressCodeDao.Instance.Insert(model);

            res.Status  = sysNo > 0;
            res.Message = sysNo > 0 ? "添加成功" : "添加失败";
            return(res);
        }
Example #3
0
        /// <summary>
        /// 修改经销商城快递代码
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        /// <remarks>2015-1-21 缪竞华 创建</remarks>
        public Result Update(Model.DsMallExpressCode model)
        {
            var res = new Result()
            {
                Status = false
            };
            string message = "";

            if (!IsValidModel(model, ref message))
            {
                res.Message = message;
                return(res);
            }

            model.ExpressCode = model.ExpressCode.Trim();
            DsMallExpressCode temp = IDsMallExpressCodeDao.Instance.Get(model.MallTypeSysNo, model.DeliveryType, model.ExpressCode);

            if (temp != null && temp.SysNo != model.SysNo)
            {
                res.Message = "已存在相同经销商城快递代码";
                return(res);
            }

            int rows = IDsMallExpressCodeDao.Instance.Update(model);

            res.Status  = rows > 0;
            res.Message = rows > 0 ? "修改成功" : "修改失败";
            return(res);
        }