Example #1
0
        public ReturnMsg AddOrUpdateAppMstrInfo(WctAppMstrDto dto, ReturnMsg rm)
        {
            var entity = new WctAppMstr();
            var isAdd  = string.IsNullOrEmpty(dto.Id) ? true : false;

            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id      = Guid.NewGuid().ToString("N");
                dto.APP_KEY = "primary";
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Insert(entity);
                    unitOfWork.Complete();
                }
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                {
                    entity = dto.ToEntity();
                    _wctAppMstrRepository.Update(entity);
                    unitOfWork.Complete();
                }
            }
            if (dto.WCT_MODULE_TYPE == "1")
            {
                var appItem = new WctAppItem();
                if (!isAdd)
                {
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        _wctAppItemRepository.DelAppItemInfo(dto.Id);
                        unitOfWork.Complete();
                    }
                }
                var i = 1;
                foreach (var item in dto.appItemList)
                {
                    item.Id        = Guid.NewGuid().ToString("N");
                    item.ITEM_SORT = i;
                    _initHelper.InitAdd(item, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    using (var unitOfWork = _unitOfWorkManager.Begin(TransactionScopeOption.RequiresNew))
                    {
                        appItem = item.ToEntity();
                        _wctAppItemRepository.Insert(appItem);
                        unitOfWork.Complete();
                    }
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
Example #2
0
        /// <summary>
        /// 保存二手车金融政策
        /// </summary>
        /// <returns></returns>
        private bool SaveUCPolicy(CarFinancePolicyDto info, out string msg)
        {
            bool flag = false;

            if (string.IsNullOrEmpty(info.UDF1))
            {
                msg = "车架号不能为空!";
                return(flag);
            }

            try
            {
                if (string.IsNullOrEmpty(info.Id))
                {
                    var uclist = _carFinancePolicyRepository.GetAllList(m => m.UDF1 == info.UDF1);

                    if (uclist == null || uclist.Count == 0)
                    {
                        _initHelper.InitAdd(info, Convert.ToDecimal(AbpSession.USR_ID), AbpSession.ORG_NO, AbpSession.BG_NO);
                        info.Id = Guid.NewGuid().ToString("N");
                        flag    = _carFinancePolicyRepository.Insert(info.ToEntity()) != null ? true : false;
                    }
                    else
                    {
                        CarFinancePolicy ucinfo = uclist.FirstOrDefault();
                        ucinfo.TAG_IDS     = info.TAG_IDS;
                        ucinfo.TAG_JSON    = info.TAG_JSON;
                        ucinfo.UPDATE_PSN  = AbpSession.USR_ID;
                        ucinfo.UPDATE_DATE = DateTime.Now;

                        flag = _carFinancePolicyRepository.Update(info.ToEntity()) != null ? true : false;
                    }
                }
                else
                {
                    _initHelper.InitUpdate(info, AbpSession.USR_ID);
                    flag = _carFinancePolicyRepository.Update(info.ToEntity()) != null ? true : false;
                }
                msg = flag ? "保存成功" : "保存失败";
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = ex.Message;
            }

            return(flag);
        }
Example #3
0
        /// <summary>
        /// 保存机构信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMdmBuInfo(MdmBuMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new MdmBuMstr();
            var isOk   = CheckMdmBuInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.BU_NO))
            {
                dto.BG_NO = dto.BU_TYPE == 1 ? dto.Id : dto.BG_NO;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _mdmBuMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _mdmBuMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 新增保险续保/门店宣传
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public StoreAdvertiseMstr InsertAdvertise(StoreAdvertiseMstrDto dto)
        {
            StoreAdvertiseMstr mstr = null;

            try
            {
                if (!EnableStoreAdvertiseList(Convert.ToInt32(dto.ADVERTISE_CATEGORY)))
                {
                    return(null);
                }

                if (string.IsNullOrEmpty(dto.Id))
                {
                    //新增
                    dto.Id = Guid.NewGuid().ToString("N");
                    _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    mstr = _storeAdvertiseMstrRepository.Insert(dto.ToEntity());
                }
                else
                {
                    //修改
                    _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                    mstr = _storeAdvertiseMstrRepository.Update(dto.ToEntity());
                }
                return(mstr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 创建套卷
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public CrmQpaperMstr CreateQpaper(CrmQpaperMstrDto dto)
        {
            try
            {
                if (CheckPaperName(dto.Id, dto.PAPER_NAME, dto.PAPER_TYPE, AbpSession.ORG_NO))
                {
                    var strList = dto.INCLUDE_QUESTION_IDS.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                    var list    = _crmQpaperQuRepository.GetAllList(c => c.DEL_FLAG == 1).Where(c => strList.Contains(c.Id)).ToList();
                    //将选择的题目设置为启用
                    foreach (var item in list)
                    {
                        item.QU_ENABLED = 1;
                        _crmQpaperQuRepository.Update(item);
                    }

                    if (string.IsNullOrEmpty(dto.Id))
                    {
                        dto.Id = Guid.NewGuid().ToString("N");
                        _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                        return(_crmQpaperMstrRepository.Insert(dto.ToEntity()));
                    }
                    else
                    {
                        _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                        return(_crmQpaperMstrRepository.Update(dto.ToEntity()));
                    }
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        /// 编辑/新增题目
        /// </summary>
        /// <param name="crmQpaperQuDto"></param>
        /// <returns></returns>
        public CrmQpaperQu SaveQpaperQuInfo(CrmQpaperQuDto crmQpaperQuDto, ref string msg)
        {
            try
            {
                CrmQpaperQu qu = null;
                if (CheckQuestion(crmQpaperQuDto.Id, crmQpaperQuDto.QU_NAME, crmQpaperQuDto.QU_SN, AbpSession.BG_NO, ref msg))
                {
                    if (string.IsNullOrEmpty(crmQpaperQuDto.Id))
                    {
                        //新增
                        crmQpaperQuDto.Id = Guid.NewGuid().ToString("N");
                        _initHelper.InitAdd(crmQpaperQuDto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                        qu = _crmQpaperQuRepository.Insert(crmQpaperQuDto.ToEntity());
                    }
                    else
                    {
                        //修改
                        _initHelper.InitUpdate(crmQpaperQuDto, AbpSession.USR_ID);
                        qu = _crmQpaperQuRepository.Update(crmQpaperQuDto.ToEntity());
                    }
                }

                return(qu);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #7
0
        /// <summary>
        /// 保存基础配置信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveWctBasConfigInfo(WctBasConfigDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new WctBasConfig();
            var redis  = _redisHelper.GetRedisClient(Convert.ToInt(dto.REDIS_NUM));

            if (string.IsNullOrEmpty(dto.Id))
            {
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _wctBasConfigRepository.Insert(entity);
                redis.Add(AbpSession.BG_NO + "-CONFIG_ID", dto);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _wctBasConfigRepository.Update(entity);
                //redis集团缓存配置修改
                if (redis.Exists(AbpSession.BG_NO + "-CONFIG_ID") != 1)
                {
                    redis.Add(AbpSession.BG_NO + "-CONFIG_ID", dto);
                }
                else
                {
                    redis.Set(AbpSession.BG_NO + "-CONFIG_ID", dto);
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
Example #8
0
        /// <summary>
        /// 保存系统模块信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveSysMoudleInfo(WctSysmoduleMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new WctSysmoduleMstr();
            var isOk   = CheckSysMoudleInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id = Guid.NewGuid().ToString("N");
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _wctSysmoduleMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _wctSysmoduleMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 保存预约试驾车型数据
        /// </summary>
        /// <param name="dtos"></param>
        public void SaveDriveInfo(List<AptDriveConfigDto> dtos)
        {
            if (dtos?.Count > 0)
            {
                //删除已保存的车型数据
                var driveList = _aptDriveConfigRepository.GetAllList(m => m.BU_NO == AbpSession.ORG_NO);
                foreach (var item in driveList)
                {
                    _aptDriveConfigRepository.Delete(item);
                }

                //新增车型细分数据
                foreach (var item in dtos)
                {
                    _initHelper.InitAdd(item, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    item.Id = Guid.NewGuid().ToString("N");

                    _aptDriveConfigRepository.Insert(item.ToEntity());
                }
            }
            else
            {
                throw new Exception("未选择任何车型数据");
            }
        }
Example #10
0
        /// <summary>
        /// 保存职务信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMdmDutyInfo(MdmDutyMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new MdmDutyMstr();
            var isOk   = CheckMdmDutyInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (dto.Id == 0)
            {
                dto.ORG_NO = AbpSession.ORG_NO;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _mdmDutyMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _mdmDutyMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 保存提醒事项
        /// </summary>
        /// <returns></returns>
        private bool SaveConfig(MdmMsgConfigDto info)
        {
            try
            {
                MdmMsgConfigDto model = new MdmMsgConfigDto();
                _initHelper.InitAdd(model, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                model.Id                = Guid.NewGuid().ToString("N");
                model.APT_TYPE          = info.APT_TYPE;
                model.MSG_REMIND_TYPE   = 1;
                model.REMIND_EVENT_TYPE = info.REMIND_EVENT_TYPE;
                model.REMIND_MODE       = info.REMIND_MODE;
                switch (info.REMIND_MODE)
                {
                case 1:
                    break;

                case 2:
                    model.APT_REMIND_DATE = info.APT_REMIND_DATE;
                    break;

                case 3:
                    model.APT_REMIND_TIME = info.APT_REMIND_TIME;
                    break;

                default:
                    break;
                }
                return(_mdmMsgConfigRepository.Insert(model.ToEntity()) != null ? true : false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Example #12
0
        /// <summary>
        /// 保存标签信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveTagInfo(TagMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new TagMstr();
            var isOk   = CheckTagInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.Id))
            {
                var requestTag = CreateWxTag(dto.TAG_NAME, rm);
                if (!requestTag.IsSuccess)
                {
                    return(rm);
                }
                dto.TAG_REF_DB_ID    = "SCRM";
                dto.TAG_REF_TABLE_ID = "WCT";
                dto.TAG_STATUS       = 1;
                dto.TAG_REF_FIELD_ID = requestTag.result;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _tagMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _tagMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 保存素材信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveMaterialInfo(CmsMaterialMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new CmsMaterialMstr();
            var isOk   = CheckMaterialInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.Id))
            {
                //新增
                dto.Id = Guid.NewGuid().ToString("N");
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                dto.MATERIAL_STATUS = "待发布";
                entity = dto.ToEntity();
                _cmsMaterialMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _cmsMaterialMstrRepository.Update(entity);
            }
            rm.IsSuccess = true;
            return(rm);
        }
Example #14
0
        /// <summary>
        /// 保存员工信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveSysUsrInfo(SysUsrMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new SysUsrMstr();
            var isOk   = CheckSysUsrInfo(dto, rm);

            if (!isOk.IsSuccess)
            {
                return(rm);
            }
            if (dto.Id == 0)
            {
                dto.USR_REG_DATE = DateTime.Now;
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _sysUsrMstrRepository.Insert(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _sysUsrMstrRepository.Update(entity);
            }
            var userAuth = _sysUsrAuthRepository.GetAllList(c => c.USR_ID == dto.Id);

            if (userAuth.Count > 0)
            {
                _sysUsrAuthRepository.DelSysUsrAuthInfo(dto.Id.ToString());
            }
            if (!string.IsNullOrEmpty(dto.RoleIds))
            {
                var list = dto.RoleIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                foreach (var item in list)
                {
                    var auth = new SysUsrAuth();
                    auth.Id      = Guid.NewGuid().ToString("N");
                    auth.USR_ID  = (long)dto.Id;
                    auth.ROLE_ID = Convert.ToInt32(item);
                    _initHelper.InitAdd(auth, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    _sysUsrAuthRepository.Insert(auth);
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 保存金融标签
        /// </summary>
        /// <param name="dto"></param>
        public void SaveTag(FinanceTagConfigDto dto)
        {
            if (CheckTag(dto.TAG_NAME, dto.SORT_NO))
            {
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                dto.Id = Guid.NewGuid().ToString("N");
                _financeTagConfigRepository.Insert(dto.ToEntity());
            }
        }
Example #16
0
        /// <summary>
        /// 保存角色信息
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public ReturnMsg SaveSysRoleInfo(SysRoleMstrDto dto)
        {
            var rm     = new ReturnMsg();
            var entity = new SysRoleMstr();

            if (string.IsNullOrEmpty(dto.ROLE_NAME))
            {
                rm.IsSuccess = false;
                rm.msg       = "请输入角色名称";
                return(rm);
            }
            if (string.IsNullOrEmpty(dto.ROLE_SCOPE))
            {
                rm.IsSuccess = false;
                rm.msg       = "请选择角色范围";
                return(rm);
            }
            if (dto.Id == 0)
            {
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                entity = dto.ToEntity();
                _sysRoleMstrRepository.InsertAndGetId(entity);
            }
            else
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                entity = dto.ToEntity();
                _sysRoleMstrRepository.Update(entity);
            }
            if (!string.IsNullOrEmpty(dto.menuIds))
            {
                if (dto.Id != 0)
                {
                    _sysRoleMenuPermissionRepository.DelSysRoleMenuInfo(dto.Id.ToString());
                }
                var list     = dto.menuIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
                var menuList = _sysNavTreeRepository.GetAllList(c => c.DEL_FLAG == 1).Where(c => list.Contains(c.NAV_PARENT_NO) || list.Contains(c.Id)).ToList();

                foreach (var item in menuList)
                {
                    var model = new SysRoleMenuPermission
                    {
                        ROLE_ID    = (int)entity.Id,
                        PERMISSION = item.Id,
                        DEL_FLAG   = 1
                    };
                    _sysRoleMenuPermissionRepository.Insert(model);
                }
            }
            rm.IsSuccess = true;

            return(rm);
        }
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public MdmGoodsClassDto SaveGoodsClass(MdmGoodsClassDto dto)
        {
            if (dto.Id == 0 || string.IsNullOrEmpty(dto.Id + ""))
            {
                var classList = _mdmGoodsClassRepository.GetAllList(m => m.CLASS_NO == dto.CLASS_NO || m.CLASS_NAME == dto.CLASS_NAME && m.BG_NO == AbpSession.BG_NO);
                if (classList == null || classList.Count == 0)
                {
                    _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                    return(_mdmGoodsClassRepository.Insert(dto.ToEntity()).ToDto());
                }
                else
                {
                    throw new Exception("分类编码或名称已存在");
                }
            }
            else
            {
                var classInfo = _mdmGoodsClassRepository.Get(dto.Id);
                classInfo.CLASS_STATUS = dto.CLASS_STATUS;

                IList <string> goodsClassIdList = new List <string>();
                if (dto.CLASS_STATUS == 0)
                {
                    goodsClassIdList.Add(dto.Id + "");
                    if (!CheckBind(ref goodsClassIdList))
                    {
                        throw new Exception("无法删除已绑定商品的商品分类");
                    }
                }
                dto.UPDATE_PSN  = Convert.ToDecimal(AbpSession.USR_ID);
                dto.UPDATE_DATE = DateTime.Now;

                var classDto = _mdmGoodsClassRepository.Update(dto.ToEntity()).ToDto();

                if (classDto.CLASS_STATUS == 0 && classDto != null)
                {
                    //删除所有子类
                    string sqlStr = "";
                    foreach (string classIds in goodsClassIdList)
                    {
                        sqlStr = string.IsNullOrEmpty(sqlStr) ? classIds : sqlStr + "," + classIds;
                    }
                    sqlStr = " CLASS_ID in (" + sqlStr + ")";
                    bool flag = _mdmGoodsClassRepository.DelGoodsClass(sqlStr);
                    if (!flag)
                    {
                        throw new Exception("保存失败");
                    }
                }
            }
            return(dto);
        }
        /// <summary>
        /// 新增/编辑预约配置
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public CrmAptConfigMstr SaveCrmAptConfig(CrmAptConfigMstrDto dto, out string msg)
        {
            bool flag = false;

            #region 参数验证
            if (dto.APT_TYPE == 2 && dto.DIS_TYPE == null)
            {
                throw new Exception("请选择优惠方式");
            }

            if (string.IsNullOrEmpty(dto.APT_CONFIG_JSON))
            {
                throw new Exception("时间段参数不允许为空");
            }

            if (!CheckPeriod(dto.APT_CONFIG_JSON, out msg))
            {
                throw new Exception(msg);
            }
            #endregion

            if (!CheckDate(dto.APT_CONFIG_SDATE, dto.APT_CONFIG_EDATE, dto.Id, dto.APT_TYPE))
            {
                msg = "该时段已经存在配置,请修改后重试!";
                throw new Exception(msg);
            }

            //新增
            if (string.IsNullOrEmpty(dto.Id))
            {
                _initHelper.InitAdd(dto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);
                dto.Id = Guid.NewGuid().ToString("N");
                dto.APT_CONFIG_SDATE = Convert.ToDateTime(Convert.ToDateTime(dto.APT_CONFIG_SDATE).ToString("yyyy-MM-dd") + " 00:00:00");
                dto.APT_CONFIG_EDATE = Convert.ToDateTime(Convert.ToDateTime(dto.APT_CONFIG_EDATE).ToString("yyyy-MM-dd") + " 23:59:59");

                return(_crmAptConfigMstrRepository.Insert(dto.ToEntity()));
            }
            else//修改
            {
                _initHelper.InitUpdate(dto, AbpSession.USR_ID);
                dto.APT_CONFIG_SDATE = Convert.ToDateTime(Convert.ToDateTime(dto.APT_CONFIG_SDATE).ToString("yyyy-MM-dd") + " 00:00:00");
                dto.APT_CONFIG_EDATE = Convert.ToDateTime(Convert.ToDateTime(dto.APT_CONFIG_EDATE).ToString("yyyy-MM-dd") + " 23:59:59");

                return(_crmAptConfigMstrRepository.Update(dto.ToEntity()));
            }
        }
        /// <summary>
        /// 编辑/新增救援信息
        /// </summary>
        /// <param name="helpDto"></param>
        /// <returns></returns>
        public WctHelpTelMstr SaveHelpTelInfo(WctHelpTelMstrDto helpDto)
        {
            try
            {
                WctHelpTelMstr mstr = null;
                if (string.IsNullOrEmpty(helpDto.Id))
                {
                    #region 参数验证
                    if (string.IsNullOrEmpty(helpDto.TEL_NAME))
                    {
                        throw new Exception("号码归属不能为空");
                    }
                    if (string.IsNullOrEmpty(helpDto.TEL_NO))
                    {
                        throw new Exception("电话号码不能为空");
                    }
                    if (string.IsNullOrEmpty(helpDto.TEL_TYPE))
                    {
                        throw new Exception("电话类型不能为空");
                    }
                    #endregion

                    //新增
                    helpDto.Id        = Guid.NewGuid().ToString("N");
                    helpDto.TEL_ID_NO = AbpSession.ORG_NO;
                    _initHelper.InitAdd <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                    mstr = _wctHelpTelMstrRepository.Insert(helpDto.ToEntity());
                }
                else
                {
                    //修改
                    _initHelper.InitUpdate <WctHelpTelMstrDto>(helpDto, AbpSession.USR_ID);
                    mstr = _wctHelpTelMstrRepository.Update(helpDto.ToEntity());
                }
                return(mstr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #20
0
        /// <summary>
        /// 保存属性
        /// </summary>
        /// <param name="dto"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        private bool SaveProperty(MdmGoodsPropertyMstrDto dto, ref string id)
        {
            _initHelper.InitAdd <MdmGoodsPropertyMstrDto>(dto, Convert.ToDecimal(AbpSession.USR_ID), AbpSession.ORG_NO, AbpSession.BG_NO);
            dto.PROPERTY_STATUS = 1;
            dto.PROPERTY_DOMAIN = 1;

            if (string.IsNullOrEmpty(dto.Id))
            {
                dto.Id = Guid.NewGuid().ToString("N");
                id     = dto.Id;

                return(_mdmGoodsPropertyMstrRepository.Insert(dto.ToEntity()) != null ? true : false);
            }
            else
            {
                dto.DEL_FLAG    = 1;
                dto.UPDATE_DATE = DateTime.Now;
                dto.UPDATE_PSN  = Convert.ToDecimal(AbpSession.USR_ID);

                return(_mdmGoodsPropertyMstrRepository.Insert(dto.ToEntity()) != null ? true : false);
            }
        }
Example #21
0
        /// <summary>
        /// 保存车型关联图
        /// </summary>
        /// <param name="fileId">文件id</param>
        /// <param name="bizNo">车型id</param>
        /// <param name="fileName">图片名</param>
        public void SaveCarResFile(string fileId, string bizNo, string fileName)
        {
            if (string.IsNullOrEmpty(fileId))
            {
                //删除已保存的文件
                var list = _resFileMstrRepository.GetAllList(m => m.BIZ_NO == bizNo);
                foreach (var item in list)
                {
                    var entity = _resFileMstrRepository.Get(item.Id);
                    _resFileMstrRepository.Delete(entity);
                }

                ResFileMstrDto dto = new ResFileMstrDto();
                _initHelper.InitAdd(dto, Convert.ToDecimal(AbpSession.USR_ID), AbpSession.ORG_NO, AbpSession.BG_NO);
                dto.Id        = Guid.NewGuid().ToString("N");
                dto.BIZ_NO    = bizNo;
                dto.FILE_NAME = fileName;

                _resFileMstrRepository.Insert(dto.ToEntity());
            }
            else
            {
                var list = _resFileMstrRepository.GetAllList(m => m.BIZ_NO == bizNo && m.Id != fileId);
                foreach (var item in list)
                {
                    var e = _resFileMstrRepository.Get(item.Id);
                    _resFileMstrRepository.Delete(e);
                }

                var entity = _resFileMstrRepository.Get(fileId);
                var dto    = entity.ToDto();
                _initHelper.InitUpdate(dto, Convert.ToDecimal(AbpSession.USR_ID));
                dto.FILE_NAME = fileName;
                dto.BIZ_NO    = bizNo;

                _resFileMstrRepository.Update(dto.ToEntity());
            }
        }
Example #22
0
        /// <summary>
        /// 更新用户标签记录
        /// </summary>
        /// <param name="wct"></param>
        /// <param name="rm"></param>
        /// <returns></returns>
        public ReturnMsg UpdateTagHistInfo(SysUsrWctDto wct, ReturnMsg rm)
        {
            var histList = _tagHistRepository.GetAllList(c => c.TAG_REF_ROW_NO == wct.Id && c.DEL_FLAG == 1);
            var newList  = wct.tagIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var oldList  = histList.Select(c => c.TAG_REF_FIELD_ID).ToList();
            var result   = newList.Except <string>(oldList).ToList();

            if (result.Count == 0)
            {
                rm.IsSuccess = true;
                return(rm);
            }
            var paInfo = _wxHelper.GetPaInfo(1, c => c.PA_ID_NO == AbpSession.ORG_NO, AbpSession.BG_NO);

            if (paInfo == null)
            {
                rm.IsSuccess = false;
                rm.msg       = "公众号信息不存在";
                return(rm);
            }
            var requestToken = _wxHelper.GetAccessToken(paInfo, wct.BG_NO);

            if (!requestToken.IsSuccess)
            {
                return(rm);
            }
            var tagList = _tagMstrRepository.GetAllList(c => c.CREATE_ORG_NO == wct.BU_NO && c.DEL_FLAG == 1);

            foreach (var item in result)
            {
                var tagHist = new TagHist();
                var tag     = new TagMstr();
                tag = tagList.Where(c => c.TAG_REF_FIELD_ID == item).FirstOrDefault();
                var hist = histList.Where(c => c.TAG_REF_ROW_NO == item).FirstOrDefault();
                if (hist == null)
                {
                    rm = AddTag(wct.OPEN_ID, item, requestToken.result, rm);
                    if (!rm.IsSuccess)
                    {
                        return(rm);
                    }

                    tagHist.Id               = Guid.NewGuid().ToString();
                    tagHist.TAG_CODE         = tag.Id;
                    tagHist.TAG_VALUE        = tag.TAG_NAME;
                    tagHist.TAG_REF_ROW_NO   = wct.Id;
                    tagHist.TAG_REF_TABLE_ID = "SYS_USR_WCT";
                    tagHist.CREATE_TIME      = DateTime.Now;
                    tagHist.TAG_SDATE        = DateTime.Now;
                    tagHist.TAG_FROM         = "手工";
                    tagHist.TAG_MSTR_ID      = "0";
                    tagHist.TAG_VERSION      = "0";
                    tagHist.TAG_VALUE_DESC   = "0";
                    tagHist.TAG_REF_DB_ID    = "0";
                    tagHist.TAG_REF_FIELD_ID = item;
                    tagHist.TAG_RULE_ID      = "0";
                    tagHist.TAG_EDATE        = DateTime.MaxValue;
                    _initHelper.InitAdd(tagHist, AbpSession.USR_ID, wct.BU_NO, wct.BG_NO);
                }
                else
                {
                    rm = DelTag(wct.OPEN_ID, item, requestToken.result, rm);
                    if (!rm.IsSuccess)
                    {
                        return(rm);
                    }
                    _tagHistRepository.DelTagHistInfo(wct.Id, item);
                }
            }

            return(rm);
        }
Example #23
0
        /// <summary>
        /// 保存商品
        /// </summary>
        /// <param name="model"></param>
        public MdmGoodsList SaveErpGoodsInfo(GoodsInfoListModel model)
        {
            var info = _mdmGoodsListRepository.FirstOrDefault(m => m.BU_NO == AbpSession.ORG_NO && m.GL_NO == model.GOODS_NO);

            if (info == null)
            {
                MdmGoodsListDto goods = new MdmGoodsListDto()
                {
                    Id      = Guid.NewGuid().ToString(),
                    GL_NO   = model.GOODS_NO,
                    GL_NAME = model.GOODS_NAME,
                    //GL_LARGECLASS = Convert.ToDecimal(model.GOODS_LARGECLASS_CODE),
                    GL_UNIT          = model.UNIT,
                    GL_MATERIAL      = model.Gl_Material,
                    MADE_IN          = model.Made_In,
                    GL_RMK           = model.Gl_Rmk,
                    UDF2             = model.Image_Url,
                    GL_BRAND         = model.GOODS_BRAND,
                    PROMOTION_INFO   = model.Promotion_Info,
                    GL_DESC          = model.Gl_Desc,
                    GL_WARRANTY_DESC = model.Gl_Warranty_Desc,
                    DEL_FLAG         = 1,
                    GL_TYPE          = 0,
                    MEMBER_PRICE     = (double)model.Member_Price,
                    MENBER_POINTS    = (long)model.Member_Points,
                    ENABLE_MP        = (byte)model.Enable_MP,
                    GOODS_SALES      = model.Goods_Sales,
                    IS_ERPGOODS      = 1,
                    UDF3             = model.GOODS_LARGECLASS_CODE,
                    UDF4             = model.GOODS_LARGECLASS_NAME,
                    UDF5             = model.GOODS_INCLASS_CODE,
                    UDF6             = model.GOODS_INCLASS_NAME,
                    UDF7             = model.GOODS_SMALLCLASS_CODE,
                    UDF8             = model.GOODS_SMALLCLASS_NAME,
                    UDF9             = model.RETAILPRICE + "",
                    UDF10            = model.MEMBERSHIP_PRICE + ""
                };
                _initHelper.InitAdd(goods, AbpSession.USR_ID, AbpSession.ORG_NO, AbpSession.BG_NO);

                return(_mdmGoodsListRepository.Insert(goods.ToEntity()));
            }
            else
            {
                info.UDF2             = model.Image_Url;
                info.GL_DESC          = model.Gl_Desc;
                info.GL_WARRANTY_DESC = model.Gl_Warranty_Desc;
                info.UPDATE_PSN       = AbpSession.USR_ID;
                info.UPDATE_DATE      = DateTime.Now;
                info.GL_MATERIAL      = model.Gl_Material;
                info.MADE_IN          = model.Made_In;
                info.GL_RMK           = model.Gl_Rmk;
                info.GL_BRAND         = model.GOODS_BRAND;
                info.PROMOTION_INFO   = model.Promotion_Info;
                info.BU_NO            = AbpSession.ORG_NO;
                info.BG_NO            = AbpSession.BG_NO;
                info.MEMBER_PRICE     = (double)model.Member_Price;
                info.MENBER_POINTS    = (long)model.Member_Points;
                info.ENABLE_MP        = (byte)model.Enable_MP;
                info.GOODS_SALES      = model.Goods_Sales;
                info.IS_ERPGOODS      = 1;
                info.UDF3             = model.GOODS_LARGECLASS_CODE;
                info.UDF4             = model.GOODS_LARGECLASS_NAME;
                info.UDF5             = model.GOODS_INCLASS_CODE;
                info.UDF6             = model.GOODS_INCLASS_NAME;
                info.UDF7             = model.GOODS_SMALLCLASS_CODE;
                info.UDF8             = model.GOODS_SMALLCLASS_NAME;
                info.UDF9             = model.RETAILPRICE + "";

                return(_mdmGoodsListRepository.Update(info));
            }
        }