public ActionResult NotParticipatedFeedback(NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO)
 {
     if (GetNotAteendedFeedback(notAttendedVolunteerFeedbackDTO.EventId, notAttendedVolunteerFeedbackDTO.EmployeeID) == null)
     {
         if (ModelState.IsValid)
         {
             string requestURI = ConfigurationManager.AppSettings["ApiUrl"] + "/api/PaticipantFeedback/PostNotParticipated";
             using (var client = new HttpClient())
             {
                 var responseTask = client.PostAsJsonAsync(requestURI, notAttendedVolunteerFeedbackDTO);
                 var result       = responseTask.Result;
                 if (result.IsSuccessStatusCode)
                 {
                 }
             }
             return(View("ThankYou"));
         }
         else
         {
             return(View(notAttendedVolunteerFeedbackDTO));
         }
     }
     else
     {
         return(View("AlreadySubmitted"));
     }
 }
Пример #2
0
 public void SaveNotAttendedVolunteerFeedback(NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO)
 {
     try
     {
         var config = new MapperConfiguration(cfg =>
         {
             cfg.CreateMap <NotAttendedVolunteerFeedbackDTO, NotAttendedVolunteerFeedback>().ForMember(dest => dest.Event, opt => opt.AllowNull());
         });
         IMapper iMapper = config.CreateMapper();
         notAttendedVolunteerFeedbackRepository.SaveNotAttendedVolunteerFeedback(iMapper.Map <NotAttendedVolunteerFeedbackDTO, NotAttendedVolunteerFeedback>(notAttendedVolunteerFeedbackDTO));
     }
     catch (Exception ex)
     {
         ExceptionLogger logger = new ExceptionLogger()
         {
             ControllerName      = "NotParticipated",
             ActionrName         = "SaveNotAttendedVolunteerFeedback()",
             ExceptionMessage    = ex.Message,
             ExceptionStackTrace = ex.StackTrace,
             LogDateTime         = DateTime.Now
         };
         ExceptionRepository exceptionRepository = new ExceptionRepository();
         exceptionRepository.AddException(logger);
         throw ex;
     }
 }
Пример #3
0
        public void TestNotParticipatedSave()
        {
            NotParticipated notParticipated = new NotParticipated();
            NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO = new NotAttendedVolunteerFeedbackDTO();

            notAttendedVolunteerFeedbackDTO.EventId      = "EVNT00047261";
            notAttendedVolunteerFeedbackDTO.EmployeeID   = "711876";
            notAttendedVolunteerFeedbackDTO.FeedbackText = "Test FeedBack";
            notParticipated.SaveNotAttendedVolunteerFeedback(notAttendedVolunteerFeedbackDTO);
        }
 public HttpResponseMessage Get(string EventId, string employeeId)
 {
     try
     {
         NotParticipated notParticipated = new NotParticipated();
         NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO = notParticipated.GetNotAttendedFeedback(EventId, employeeId);
         return(Request.CreateResponse(HttpStatusCode.OK, notAttendedVolunteerFeedbackDTO));
     }
     catch (Exception)
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
 public HttpResponseMessage Post(NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO)
 {
     try
     {
         NotParticipated notParticipated = new NotParticipated();
         notParticipated.SaveNotAttendedVolunteerFeedback(notAttendedVolunteerFeedbackDTO);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     catch (Exception)
     {
         throw new HttpResponseException(HttpStatusCode.InternalServerError);
     }
 }
        private NotAttendedVolunteerFeedbackDTO GetNotAteendedFeedback(string eventId, string employeeId)
        {
            NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO = new NotAttendedVolunteerFeedbackDTO();
            string requestURI = ConfigurationManager.AppSettings["ApiUrl"] + "/api/PaticipantFeedback/NotParticipated/" + eventId + "/" + employeeId + "";

            using (var client = new HttpClient())
            {
                var responseTask = client.GetAsync(requestURI);
                var result       = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <NotAttendedVolunteerFeedbackDTO>();
                    readTask.Wait();

                    notAttendedVolunteerFeedbackDTO = readTask.Result;
                }
            }
            return(notAttendedVolunteerFeedbackDTO);
        }
        // GET: FeedBack
        public ActionResult Index(string FeedbackValue)
        {
            try
            {
                string   decryptedValue = AESCrypt.DecryptString(FeedbackValue);
                string[] cred           = decryptedValue.Split(new[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                EventDTO eventDTO       = GetEventDetails(cred[0]);
                string   viewName       = "";
                object   obj            = null;
                switch (cred[2])
                {
                case Constant.Participated:
                    if (GetRegisteredFeedbackList(cred[0], cred[1]).Count == 0)
                    {
                        List <FeedbackQuestionDTO>     feedbackQuestionDTOs           = GetFeedbackQuestions();
                        RegisteredVolunteerFeedbackDTO registeredVolunteerFeedbackDTO = new RegisteredVolunteerFeedbackDTO();
                        registeredVolunteerFeedbackDTO.EventDate  = Convert.ToDateTime(eventDTO.EventDate).ToShortDateString();
                        registeredVolunteerFeedbackDTO.EmployeeID = cred[1];
                        registeredVolunteerFeedbackDTO.EventId    = cred[0];
                        registeredVolunteerFeedbackDTO.EventName  = eventDTO.EventName;
                        ViewBag.QuestionCount = feedbackQuestionDTOs.Count;
                        obj      = registeredVolunteerFeedbackDTO;
                        viewName = "RegisteredFeedback";
                    }
                    else
                    {
                        viewName = "AlreadySubmitted";
                    }
                    break;

                case Constant.NotParticipated:
                    if (GetNotAteendedFeedback(cred[0], cred[1]) == null)
                    {
                        NotAttendedVolunteerFeedbackDTO notAttendedVolunteerFeedbackDTO = new NotAttendedVolunteerFeedbackDTO();
                        notAttendedVolunteerFeedbackDTO.EmployeeID = cred[1];
                        notAttendedVolunteerFeedbackDTO.EventDate  = Convert.ToDateTime(eventDTO.EventDate).ToShortDateString();
                        notAttendedVolunteerFeedbackDTO.EventId    = cred[0];
                        notAttendedVolunteerFeedbackDTO.EventName  = eventDTO.EventName;
                        obj      = notAttendedVolunteerFeedbackDTO;
                        viewName = "NotParticipatedFeedback";
                    }
                    else
                    {
                        viewName = "AlreadySubmitted";
                    }
                    break;

                case Constant.UnRegistered:
                    if (GetUnRegisteredFeedback(cred[0], cred[1]) == null)
                    {
                        UnRegisteredVolunteerFeedbackDTO unRegisteredVolunteerFeedbackDTO = new UnRegisteredVolunteerFeedbackDTO();
                        unRegisteredVolunteerFeedbackDTO.EmployeeID = cred[1];
                        unRegisteredVolunteerFeedbackDTO.EventDate  = Convert.ToDateTime(eventDTO.EventDate).ToShortDateString();
                        unRegisteredVolunteerFeedbackDTO.EventId    = cred[0];
                        unRegisteredVolunteerFeedbackDTO.EventName  = eventDTO.EventName;
                        obj      = unRegisteredVolunteerFeedbackDTO;
                        viewName = "UnregisteredFeedback";
                    }
                    else
                    {
                        viewName = "AlreadySubmitted";
                    }
                    break;
                }
                if (obj != null)
                {
                    return(View(viewName, obj));
                }
                else
                {
                    return(View(viewName));
                }
            }
            catch (Exception)
            {
                return(View("NotAuthorised"));
            }
        }