Exemplo n.º 1
0
        public ActionResult <VHA_HandleAddResModel> VHA_HandleAdd(VHA_HandleAddModel AddViewModel)
        {
            int Add_Count = 0;
            VHA_HandleAddResModel AddResModel = new VHA_HandleAddResModel();

            Add_Count = _VHelpAreaService.HandleAdd(AddViewModel);
            if (Add_Count == 9)
            {
                AddResModel.IsSuccess                  = false;
                AddResModel.AddCount                   = 0;
                AddResModel.baseViewModel.Message      = "您还未进行注册请先注册";
                AddResModel.baseViewModel.ResponseCode = 700;
            }
            else
            {
                AddResModel.IsSuccess                  = true;
                AddResModel.AddCount                   = Add_Count;
                AddResModel.baseViewModel.Message      = "上传成功";
                AddResModel.baseViewModel.ResponseCode = 200;
            }

            return(Ok(AddResModel));
        }
Exemplo n.º 2
0
        //志愿者上传互助信息处理结果
        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);
        }