public ActionResult <VolunteerAddResModel> Volunteer_add(VolunteerAddViewModel userAddViewModel)
        {
            int User_Add_Count;
            VolunteerAddResModel userAddResModel = new VolunteerAddResModel();

            User_Add_Count = _Volunteerervice.User_Add(userAddViewModel);
            if (User_Add_Count > 0)
            {
                //提示信息:已完善个人信息,等待审核
                Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle();
                middle.Contents = "您已完善个人信息,等待审核。";
                middle.Name     = userAddViewModel.Name;
                middle.VID      = userAddViewModel.ID;
                middle.VNO      = userAddViewModel.VNO;
                BaseViewModel res = new BaseViewModel();
                res = _MessageService.AddMessages(middle);

                userAddResModel.IsSuccess                  = true;
                userAddResModel.AddCount                   = User_Add_Count;
                userAddResModel.baseViewModel.Message      = "添加成功";
                userAddResModel.baseViewModel.ResponseCode = 200;
                return(Ok(userAddResModel));
            }
            else
            {
                userAddResModel.IsSuccess                  = false;
                userAddResModel.AddCount                   = 0;
                userAddResModel.baseViewModel.Message      = "添加失败";
                userAddResModel.baseViewModel.ResponseCode = 200;
                return(Ok(userAddResModel));
            }
        }
        public VolunteerAddViewModel GetMyInfos(SearchByVIDModel vidModel)
        {
            DEncrypt encrypt            = new DEncrypt();
            VolunteerAddViewModel model = new VolunteerAddViewModel();

            Volunteer_Info info = _IVolunteerInfoRepository.SearchInfoByID(vidModel.VID);



            if (info != null && info.ID != null)
            {
                model = _IMapper.Map <Volunteer_Info, VolunteerAddViewModel>(info);

                List <Volunteer_Relate_Type> Relate_Types = _IVolunteer_Relate_TypeRepository.GetMyTypeList(vidModel.VID);
                model.RelateUserIDandTypeIDList = _IMapper.Map <List <Volunteer_Relate_Type>, List <Volunteer_Relate_TypeMiddle> >(Relate_Types);

                List <VAttachment> VAttachmentList = _IVAttachmentRepository.GetMyList(vidModel.VID);
                model.VAttachmentAddList = _IMapper.Map <List <VAttachment>, List <VAttachmentAddViewModel> >(VAttachmentList);

                model.Name          = encrypt.Decrypt(model.Name);
                model.CertificateID = encrypt.Decrypt(model.CertificateID);
                model.Mobile        = encrypt.Decrypt(model.Mobile);
            }

            return(model);
        }
        public VolunteerAddViewModel GetMyInfo(SearchByVIDModel vidModel)
        {
            VolunteerAddViewModel model = new VolunteerAddViewModel();

            model = _Volunteerervice.GetMyInfos(vidModel);
            return(model);
        }
        public int User_Edit(VolunteerAddViewModel VuserAddViewModel)
        {
            DEncrypt encrypt   = new DEncrypt();
            var      user_Info = _IMapper.Map <VolunteerAddViewModel, Volunteer_Info>(VuserAddViewModel);

            // 字段加密 20200521
            user_Info.Name          = encrypt.Encrypt(user_Info.Name);
            user_Info.CertificateID = encrypt.Encrypt(user_Info.CertificateID);
            user_Info.Mobile        = encrypt.Encrypt(user_Info.Mobile);

            _IVolunteerInfoRepository.EditInfo(user_Info);
            int a = _IVolunteerInfoRepository.SaveChanges();

            //保存完善信息(擅长技能、服务领域)   先删除原有信息在添加
            _IVolunteer_Relate_TypeRepository.RemoveAll(user_Info.ID);

            List <Volunteer_Relate_TypeMiddle> Relate_Types = VuserAddViewModel.RelateUserIDandTypeIDList;
            var TypeInfo = _IMapper.Map <List <Volunteer_Relate_TypeMiddle>, List <Volunteer_Relate_Type> >(Relate_Types);

            foreach (var itme in TypeInfo)
            {
                _IVolunteer_Relate_TypeRepository.Add(itme);
                int b = _IVolunteer_Relate_TypeRepository.SaveChanges();
            }


            //保存 资质文件信息 先删除原有信息在添加

            _IVAttachmentRepository.RemoveAll(user_Info.ID, "ZZFJ");
            List <VAttachmentAddViewModel> VAttachmentAdds = VuserAddViewModel.VAttachmentAddList;
            var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(VAttachmentAdds);

            foreach (var item in AttachmentInfo)
            {
                item.ID         = Guid.NewGuid().ToString();
                item.formid     = VuserAddViewModel.ID;
                item.type       = "ZZFJ";
                item.Status     = "0";
                item.CreateUser = VuserAddViewModel.ID;
                item.CreateDate = DateTime.Now;
                _IVAttachmentRepository.Add(item);
                int c = _IVAttachmentRepository.SaveChanges();
            }

            return(a);
        }
        //添加用户
        public int User_Add(VolunteerAddViewModel VuserAddViewModel)
        {
            //判断  (擅长技能、服务领域) 是否为空 20200602
            if (VuserAddViewModel.RelateUserIDandTypeIDList.Count == 0)
            {
                return(0);
            }

            DEncrypt encrypt = new DEncrypt();

            var user_Info = _IMapper.Map <VolunteerAddViewModel, Volunteer_Info>(VuserAddViewModel);

            user_Info.Status = "0";
            // 字段加密 20200521
            user_Info.Name          = encrypt.Encrypt(user_Info.Name);
            user_Info.CertificateID = encrypt.Encrypt(user_Info.CertificateID);
            user_Info.Mobile        = encrypt.Encrypt(user_Info.Mobile);
            //再次获取  志愿者编号以免提交时出现重复编号
            var vno = GetNewVNO();

            user_Info.VNO = vno;
            //保存基本信息
            _IVolunteerInfoRepository.Add(user_Info);
            int a = _IVolunteerInfoRepository.SaveChanges();

            //判断志愿者编号是否冲突  20200824
            if (_IVolunteerInfoRepository.CheckVNO(user_Info.VNO) > 1)
            {
                var newinfo = _IVolunteerInfoRepository.SearchInfoByID(VuserAddViewModel.ID);
                newinfo.VNO = GetNewVNO();
                _IVolunteerInfoRepository.Update(newinfo);
                _IVolunteerInfoRepository.SaveChanges();
            }


            //保存完善信息(擅长技能、服务领域)
            List <Volunteer_Relate_TypeMiddle> Relate_Types = VuserAddViewModel.RelateUserIDandTypeIDList;
            var TypeInfo = _IMapper.Map <List <Volunteer_Relate_TypeMiddle>, List <Volunteer_Relate_Type> >(Relate_Types);

            foreach (var itme in TypeInfo)
            {
                _IVolunteer_Relate_TypeRepository.Add(itme);
                int b = _IVolunteer_Relate_TypeRepository.SaveChanges();
            }

            //保存 资质文件信息
            List <VAttachmentAddViewModel> VAttachmentAdds = VuserAddViewModel.VAttachmentAddList;
            var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(VAttachmentAdds);

            foreach (var item in AttachmentInfo)
            {
                item.ID         = Guid.NewGuid().ToString();
                item.formid     = VuserAddViewModel.ID;
                item.type       = "ZZFJ";
                item.Status     = "0";
                item.CreateUser = VuserAddViewModel.ID;
                item.CreateDate = DateTime.Now;
                _IVAttachmentRepository.Add(item);
                int c = _IVAttachmentRepository.SaveChanges();
            }

            //用户注册后 默认登录成功  20200511
            //保存登录时间 20200511
            SaveLoginInfo(VuserAddViewModel.ID);
            //保存登录方式 20200511
            SaveLoginTypeInfo(VuserAddViewModel.ID);


            return(a);
        }