public BaseViewModel AddMessages(Volunteer_MessageMiddle model) { BaseViewModel res = new BaseViewModel(); res = _MessageService.AddMessages(model); return(res); }
public BaseViewModel AddMessages(Volunteer_MessageMiddle model) { BaseViewModel res = new BaseViewModel(); Volunteer_Message message = _IMapper.Map <Volunteer_MessageMiddle, Volunteer_Message>(model); message.ID = Guid.NewGuid().ToString(); message.CreateDate = DateTime.Now; message.CreateUser = model.VID; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int a = _IVolunteer_MessageRepository.SaveChanges(); if (a > 0) { res.ResponseCode = 200; res.Message = "消息推送成功"; } else { res.ResponseCode = 400; res.Message = "消息推送失败"; } return(res); }
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 BaseViewModel SetSignReturn(ContentIDandVIDModel model) { BaseViewModel result = new BaseViewModel(); //该互助信息 VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(model.ContentID); //获取 志愿者 上传的 处理结果的信息进行审核 List <VHA_Sign> list = _IVHA_SignRepository.GetByContentID(model.ContentID, "2"); VHA_Sign item = list.First(); item.opinion = "审核不通过,志愿者重新上传处理结果"; item.Status = "2"; item.UpdateUser = area.CreateUser; item.UpdateDate = DateTime.Now; _IVHA_SignRepository.Update(item); int a = _IVHA_SignRepository.SaveChanges(); //本次处理结果 审核信息通过 VHA_Handle modelHandle = _IVHA_HandleRepository.GetVolunteerHandle(item.bak1); modelHandle.Status = "2"; modelHandle.UpdateUser = area.CreateUser; modelHandle.UpdateDate = DateTime.Now; _IVHA_HandleRepository.Update(modelHandle); int b = _IVHA_HandleRepository.SaveChanges(); if (b > 0) { //提示信息:您认领标题为XXX互助信息,互助信息,处理审核不通过,请重新上传处理结果 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您认领标题为 " + area.Title + " 互助信息,处理审核不通过,请重新上传处理结果"; Volunteer_Info volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(model.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 = model.VID; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int f = _IVolunteer_MessageRepository.SaveChanges(); result.ResponseCode = 200; result.Message = "操作成功"; } else { result.ResponseCode = 400; result.Message = "操作失败"; } return(result); }
//社区居民上传互助信息(名称、内容、所需擅长技能、姓名、联系方式、详细地址、可得积分) public BaseViewModel AddHelpArea(VHelpAreaSearchMiddle area) { BaseViewModel result = new BaseViewModel(); VHelpArea helpArea = _IMapper.Map <VHelpAreaSearchMiddle, VHelpArea>(area); helpArea.ID = Guid.NewGuid().ToString(); helpArea.CreateDate = DateTime.Now; helpArea.UpdateDate = DateTime.Now; helpArea.Status = "9"; _IVHelpAreaRepository.Add(helpArea); int a = _IVHelpAreaRepository.SaveChanges(); if (a > 0) { //提示信息:您已发布标题为XXX互助信息,等待审核 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您已上传标题为 " + area.Title + " 互助信息,等待审核"; Volunteer_Info volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(area.CreateUser); 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 = area.CreateUser; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int c = _IVolunteer_MessageRepository.SaveChanges(); result.ResponseCode = 200; result.Message = "上传成功,等待审核"; } else { result.ResponseCode = 400; result.Message = "上传失败,请重新操作"; } return(result); }
//志愿者上传互助信息处理结果 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 SignAdd(VHA_SignAddViewModel AddViewModel) { //普通志愿者 无擅长技能 string SkillID = "AB1EC380-4D47-45AB-9C2B-F2EE19B7AE9C"; //区外小区 string CommunityID = "D6E82522-7D21-44EF-BC81-31CAC7DA19CE"; int count = 0; if (String.IsNullOrEmpty(AddViewModel.ContentID) || String.IsNullOrEmpty(AddViewModel.VID) || String.IsNullOrEmpty(AddViewModel.TypeID)) { count = 7; return(count); } ///发布者不能认领自己发布的互助任务 VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(AddViewModel.ContentID); if (area.CreateUser == AddViewModel.VID) { count = 5; return(count); } var model = _IMapper.Map <VHA_SignAddViewModel, VHA_Sign>(AddViewModel); var VolunteerInfo = _IVolunteerInfoRepository.SearchInfoByID(model.VID); if (VolunteerInfo == null) { count = 6; return(count); } //判断是否是 泰达街社区居民或机关单位工作人员 认领 if (VolunteerInfo.CommunityID == CommunityID && VolunteerInfo.UnitID == "") { count = 8; return(count); } //判断 志愿类型 判断是否是 普通志愿者 if (AddViewModel.TypeID != SkillID) { //判断 是否是专业志愿服务 则需验证 报名者是否符合 if (_IBaseTypeRepository.CheckStatus(AddViewModel.TypeID)) { //判断是否有该类型资质认证 if (!_IVolunteer_Relate_TypeRepository.CheckInfo(AddViewModel.TypeID, AddViewModel.VID)) { count = 9; return(count); } } } model.ID = Guid.NewGuid().ToString(); model.VNO = VolunteerInfo.VNO; model.Participant = VolunteerInfo.Name; model.Status = "0"; model.flag = "1"; model.CreateUser = VolunteerInfo.ID; model.CreateDate = DateTime.Now; _IVHA_SignRepository.Add(model); count = _IVHA_SignRepository.SaveChanges(); //提示信息:您已认领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 a = _IVolunteer_MessageRepository.SaveChanges(); return(count); }
//发布者审核 认领人上传的 处理结果信息 审核通过任务完结 public BaseViewModel SetSignPass(ContentIDandVIDModel model) { BaseViewModel result = new BaseViewModel(); var VolunteerInfo = _IVolunteerInfoRepository.SearchInfoByID(model.VID); if (VolunteerInfo == null) { result.ResponseCode = 400; result.Message = "操作失败"; return(result); } //该互助信息 更新状态为 已完结 2 VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(model.ContentID); //获取 志愿者 上传的 处理结果的信息进行审核 List <VHA_Sign> list = _IVHA_SignRepository.GetByContentID(model.ContentID, "2"); VHA_Sign item = list.First(); item.opinion = "审核通过,任务完结"; item.Status = "1"; item.UpdateUser = area.CreateUser; item.UpdateDate = DateTime.Now; _IVHA_SignRepository.Update(item); int a = _IVHA_SignRepository.SaveChanges(); //本次处理结果 审核信息通过 VHA_Handle modelHandle = _IVHA_HandleRepository.GetVolunteerHandle(item.bak1); modelHandle.Status = "1"; modelHandle.UpdateUser = area.CreateUser; modelHandle.UpdateDate = DateTime.Now; _IVHA_HandleRepository.Update(modelHandle); int b = _IVHA_HandleRepository.SaveChanges(); area.Status = "2"; area.UpdateUser = area.CreateUser; area.UpdateDate = DateTime.Now; _IVHelpAreaRepository.Update(area); int c = _IVHelpAreaRepository.SaveChanges(); if (c > 0) { string id = Guid.NewGuid().ToString(); //插入积分表 Volunteer_Score score = new Volunteer_Score(); score.ID = id; score.ContentID = model.ContentID; score.tableName = "VHelpArea"; score.VID = model.VID; score.type = "done"; score.Score = double.Parse(area.Score); score.CreateUser = model.VID; score.CreateDate = DateTime.Now; _IVolunteer_ScoreRepository.Add(score); int n = _IVolunteer_ScoreRepository.SaveChanges(); if (n > 0) { //插入到 泰便利积分表 20200622 ET_points ipointMiddle = new ET_points(); ipointMiddle.ID = id; ipointMiddle.uid = VolunteerInfo.ID; ipointMiddle.points = double.Parse(area.Score); ipointMiddle.type = "VolunteerHelp"; ipointMiddle.tableName = "TedaVolunteerDB.dbo.Volunteer_Score"; ipointMiddle.CreateUser = VolunteerInfo.ID; ipointMiddle.CreateDate = DateTime.Now; eT_PointsRepository.Add(ipointMiddle); int j = eT_PointsRepository.SaveChanges(); } //提示信息:您认领标题为XXX互助信息,互助信息,处理审核通过,任务完结 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); middle.Contents = "您认领标题为 " + area.Title + " 互助信息,处理审核通过,任务完结"; Volunteer_Info volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(model.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 = model.VID; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int f = _IVolunteer_MessageRepository.SaveChanges(); result.ResponseCode = 200; result.Message = "操作成功"; } else { result.ResponseCode = 400; result.Message = "操作失败"; } return(result); }
// 发布者 确认该志愿者为 认领人(其他人 状态为审核不通过) public BaseViewModel SetVHAStatus(string VID, string ContentID) { VHelpArea area = _IVHelpAreaRepository.SearchInfoByID(ContentID); BaseViewModel result = new BaseViewModel(); //确认 认领人员状态更新为 1(审核通过)、其他人员状态更新为 2(审核不通过);该互助信息 状态改为 1(已认领) List <VHA_Sign> list = _IVHA_SignRepository.GetByContentID(ContentID, "1"); foreach (var item in list) { //提示信息:您成功认领标题为XXX互助信息,请尽快处理 Volunteer_MessageMiddle middle = new Volunteer_MessageMiddle(); Volunteer_Info volunteer_Info = new Volunteer_Info(); if (item.CreateUser == VID) { volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(VID); //确认 认领人员状态更新为 1(审核通过) item.Status = "1"; middle.Contents = "您成功认领标题为 " + area.Title + " 互助信息,请尽快处理"; } else { volunteer_Info = _IVolunteerInfoRepository.SearchInfoByID(item.CreateUser); //其他人员状态更新为 2(审核不通过) item.Status = "2"; middle.Contents = "您认领标题为 " + area.Title + " 互助信息,认领不成功,已由其他志愿者处理"; } item.UpdateUser = item.CreateUser; item.UpdateDate = DateTime.Now; _IVHA_SignRepository.Update(item); int a = _IVHA_SignRepository.SaveChanges(); 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 = item.CreateUser; message.Status = "0"; _IVolunteer_MessageRepository.Add(message); int c = _IVolunteer_MessageRepository.SaveChanges(); } //该互助信息 状态改为 1(已认领) var modelVHA = _IVHelpAreaRepository.SearchInfoByID(ContentID); modelVHA.Status = "1"; modelVHA.UpdateUser = modelVHA.CreateUser; modelVHA.UpdateDate = DateTime.Now; _IVHelpAreaRepository.Update(modelVHA); int b = _IVHelpAreaRepository.SaveChanges(); if (b > 0) { result.ResponseCode = 200; result.Message = "操作成功"; } else { result.ResponseCode = 400; result.Message = "操作失败"; } return(result); }
//(小程序端接口) 志愿者上传 公益秀(志愿活动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); }