// 值班认领 上传现场服务照片 public int SubmitImg(MyDutySignImgAddModel AddViewModel) { int c = 0; MydutyClaim_Sign model = new MydutyClaim_Sign(); model.id = Guid.NewGuid().ToString(); model.Userid = AddViewModel.uid; model.UserName = AddViewModel.name; model.type = "img"; model.CheckTime = DateTime.Now; model.CreateUser = AddViewModel.uid; model.CreateDate = DateTime.Now; model.MydutyClaim_InfoID = AddViewModel.MydutyClaim_InfoID; model.OndutyClaims_InfoId = AddViewModel.OndutyClaims_InfoId; _mydutyClaim_Sign.Add(model); int count = _mydutyClaim_Sign.SaveChanges(); var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(AddViewModel.VAttachmentAddList); foreach (var item in AttachmentInfo) { item.ID = Guid.NewGuid().ToString(); item.formid = model.id; item.type = "ZBTP";//值班信息图片 item.Status = "0"; item.CreateUser = AddViewModel.uid; item.CreateDate = DateTime.Now; _vAttachmentRepository.Add(item); c = _vAttachmentRepository.SaveChanges() + c; } return(c); }
//添加用户 public int VAttachment_Add(VAttachmentAddViewModel AddViewModel) { var Info = _IMapper.Map <VAttachmentAddViewModel, VAttachment>(AddViewModel); _IVAttachmentRepository.Add(Info); return(_IVAttachmentRepository.SaveChanges()); }
//志愿者上传互助信息处理结果 public int HandleAdd(VHA_HandleAddModel AddViewModel) { int a = 0; var VolunteerInfo = _IVolunteerInfoRepository.SearchInfoByID(AddViewModel.VID); if (VolunteerInfo == null) { a = 9; return(a); } var model = _IMapper.Map <VHA_HandleAddModel, VHA_Handle>(AddViewModel); model.ID = Guid.NewGuid().ToString(); model.VNO = VolunteerInfo.VNO; model.Participant = VolunteerInfo.Name; model.Status = "0"; model.CreateUser = VolunteerInfo.ID; model.CreateDate = DateTime.Now; _IVHA_HandleRepository.Add(model); a = _IVHA_HandleRepository.SaveChanges(); int c = 0; var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(AddViewModel.VAttachmentAddList); foreach (var item in AttachmentInfo) { item.ID = Guid.NewGuid().ToString(); item.formid = model.ID; item.type = "HZJG"; item.Status = "0"; item.CreateUser = AddViewModel.VID; item.CreateDate = DateTime.Now; _IVAttachmentRepository.Add(item); c = _IVAttachmentRepository.SaveChanges() + c; } VHA_Sign vha_Sign = new VHA_Sign(); vha_Sign.ID = Guid.NewGuid().ToString(); vha_Sign.ContentID = AddViewModel.ContentID; vha_Sign.VID = AddViewModel.VID; vha_Sign.VNO = VolunteerInfo.VNO; vha_Sign.Participant = VolunteerInfo.Name; vha_Sign.Status = "0"; vha_Sign.flag = "2"; vha_Sign.CreateUser = VolunteerInfo.ID; vha_Sign.CreateDate = DateTime.Now; vha_Sign.bak1 = model.ID; _IVHA_SignRepository.Add(vha_Sign); int d = _IVHA_SignRepository.SaveChanges(); ///获取本次互助任务信息 VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(AddViewModel.ContentID); //提示信息:您已上传标题为XXX互助信息的处理结果,等待审核 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您已上传标题为 " + area.Title + " 互助信息的处理结果,等待审核"; middle.Name = VolunteerInfo.Name; middle.VID = VolunteerInfo.ID; middle.VNO = VolunteerInfo.VNO; Volunteer_Message message = _IMapper.Map <Volunteer_MessageMiddle, Volunteer_Message>(middle); message.ID = Guid.NewGuid().ToString(); message.CreateDate = DateTime.Now; message.CreateUser = model.VID; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int f = _IVolunteer_MessageRepository.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); }
//(小程序端接口) 志愿者上传 公益秀(志愿活动ID,活动标题,活动地址,参与感受,图片列表 等等) public VActivity_PublicShowAddResModel AddPublicShow(VActivity_PublicShowAddModel showAddModel) { VActivity_PublicShowAddResModel result = new VActivity_PublicShowAddResModel(); VActivity_PublicShow show = _IMapper.Map <VActivity_PublicShowAddModel, VActivity_PublicShow>(showAddModel); if (string.IsNullOrEmpty(showAddModel.ContentID) || string.IsNullOrEmpty(showAddModel.VID) || string.IsNullOrEmpty(showAddModel.Address)) { result.AddCount = 0; result.IsSuccess = false; result.baseViewModel.Message = "上传公益秀信息失败,参数为空"; result.baseViewModel.ResponseCode = 500; } else { var VolunteerInfo = _IVolunteerInfoRepository.SearchInfoByID(showAddModel.VID); if (VolunteerInfo == null) { result.AddCount = 0; result.IsSuccess = false; result.baseViewModel.Message = "上传公益秀基本信息失败"; result.baseViewModel.ResponseCode = 500; return(result); } show.ID = Guid.NewGuid().ToString(); show.NickName = VolunteerInfo.Nickname; show.Headimgurl = VolunteerInfo.Headimgurl; show.CreateUser = showAddModel.VID; show.CreateDate = DateTime.Now; show.UpdateUser = showAddModel.VID; show.UpdateDate = DateTime.Now; show.Status = "0"; _IVActivity_PublicShowRepository.Add(show); int a = _IVActivity_PublicShowRepository.SaveChanges(); if (a > 0) { int c = 0; //保存 公益秀图片 var AttachmentInfo = _IMapper.Map <List <VAttachmentAddViewModel>, List <VAttachment> >(showAddModel.VAttachmentAddList); foreach (var item in AttachmentInfo) { item.ID = Guid.NewGuid().ToString(); item.formid = show.ID; item.type = "PSTP"; item.Status = "0"; item.CreateUser = showAddModel.VID; item.CreateDate = DateTime.Now; _IVAttachmentRepository.Add(item); c = _IVAttachmentRepository.SaveChanges() + c; } if (c == showAddModel.VAttachmentAddList.Count) { //提示信息:您成功上传公益秀,等待审核。 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您上传标题为 " + showAddModel.Title + " 公益秀,等待审核。"; Volunteer_Info volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(showAddModel.VID); middle.Name = volunteer_Info.Name; middle.VID = volunteer_Info.ID; middle.VNO = volunteer_Info.VNO; Volunteer_Message message = _IMapper.Map <Volunteer_MessageMiddle, Volunteer_Message>(middle); message.ID = Guid.NewGuid().ToString(); message.CreateDate = DateTime.Now; message.CreateUser = showAddModel.VID; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int f = _IVolunteer_MessageRepository.SaveChanges(); result.AddCount = a; result.IsSuccess = true; result.baseViewModel.Message = "成功上传公益秀,等待审核。"; result.baseViewModel.ResponseCode = 200; } else { result.AddCount = 0; result.IsSuccess = false; result.baseViewModel.Message = "上传公益秀图片失败"; result.baseViewModel.ResponseCode = 300; } } else { result.AddCount = 0; result.IsSuccess = false; result.baseViewModel.Message = "上传公益秀基本信息失败"; result.baseViewModel.ResponseCode = 400; } } return(result); }