Exemple #1
0
        public VolunteerDTO GetVolunteer(int volunteerId)
        {
            try
            {
                //Requires.NotNegative("volunteerId", volunteerId);

                log.Debug("volunteerId: " + volunteerId + " ");

                // get
                R_Volunteer t = Repository.GetVolunteer(volunteerId);

                VolunteerDTO dto = new VolunteerDTO(t);

                log.Debug(VolunteerDTO.FormatVolunteerDTO(dto));

                return(dto);
            }
            catch (System.Exception e)
            {
                // error
                log.Error(e.ToString());

                throw;
            }
        }
Exemple #2
0
        public ActionResult Edit(int id)
        {
            Volunteer toBeChanged = _volunteerRepository.GetVolunteer(id);

            ViewData.Model = toBeChanged;

            return(View());
        }
        public bool SendEmail(EmailModel emailModel)
        {
            try
            {
                // we need to set LastUpdatedBy_ID for Currently Logged on Volunteer OR Admin
                var volunteer     = _volunteerRepository.GetVolunteer(emailModel.CurrentUserEmail, emailModel.OrganisationId);
                var lastUpdatedBy = volunteer == null ? 0 : volunteer.Volunteer_ID;

                var mandrillKey      = ConfigurationManager.AppSettings["Mandrill-Key"];
                var mandrillUserName = ConfigurationManager.AppSettings["Mandrill-UserName"];
                _mandrillEmailSender.SetMandrillEmailSender(mandrillUserName, mandrillKey);

                var messageStatus = _mandrillEmailSender.Send(emailModel.MandrillEmailMessage);
                Utilities.EmailMessageStatus emailStatus;

                //create email sent record
                foreach (var emailTo in messageStatus.messageResult)
                {
                    emailStatus = GetEmailStatus(emailTo.status);

                    var emailSent = new EmailSent
                    {
                        Email_VC         = emailTo.email,
                        Status_ID        = (int)emailStatus,
                        Date_DT          = DateTime.Now,
                        Entity_ID        = emailModel.EntityId,
                        EntityType_VC    = emailModel.EntityType,
                        Message_VC       = emailModel.MandrillEmailMessage.html,
                        Organisation_ID  = emailModel.OrganisationId,
                        Subject_VC       = emailModel.MandrillEmailMessage.subject,
                        Template_ID      = emailModel.TemplateId,
                        LastUpdatedBy_ID = lastUpdatedBy,
                        CreateActivity   = true,
                        Token_VC         = messageStatus.MessageSent ? emailTo._id : null
                    };

                    _emailSentRepository.AddEmailSent(emailSent);
                }

                return(messageStatus.MessageSent);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Exemple #4
0
        public bool VolunteerExist(int evolunteerId)
        {
            var volunteer = _volunteerRepository.GetVolunteer(evolunteerId);

            return(volunteer != null);
        }
        public async Task <ActionResult> VolunteerEdit(int id)
        {
            var volunteer = await volRepo.GetVolunteer(id);

            return(View(volunteer));
        }
 public Volunteer GetVolunteer(int volunteerId)
 {
     return(_volunteerRepository.GetVolunteer(volunteerId));
 }
 private async Task <Data.Model.Volunteer> GetVolunteerByIdInternal(string id)
 {
     return(await _volunteerRepository.GetVolunteer(id) ?? new Data.Model.Volunteer());
 }