Example #1
0
        //志愿者互助信息退出功能 (互助ID标识ContentID、志愿者唯一VID、擅长技能TypeID为空不传参数)
        public string SetVHAStatusBack(string VID, string ContentID)
        {
            string result = String.Empty;

            result = _IVHA_SignRepository.SetStatusBack(VID, ContentID);
            if (result == "success")
            {
                VHelpArea res = new VHelpArea();

                //更新 互助 表状态 可重新被认领
                res = _IVHelpAreaRepository.SearchInfoByID(ContentID);
                if (res != null)
                {
                    res.Status = "0";
                    _IVHelpAreaRepository.Update(res);
                    int a = _IVHelpAreaRepository.SaveChanges();
                }
                else
                {
                    result = "fail";
                }
            }
            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);
        }