Beispiel #1
0
    public static DateTime GetDateReminder(Guid ID, string type)
    {
        DateTime DateString = DateTime.MinValue;
        List <RegistrationEmailSent> registrationEmailSentList = RegistrationEmailSentList.GetRegistrationEmailSentList()
                                                                 .Where(x => x.EntryId == ID && x.EntryType == type)
                                                                 .OrderByDescending(y => y.DateCreated).ToList();

        if (registrationEmailSentList.Count() > 0)
        {
            RegistrationEmailSent registrationEmailSent = registrationEmailSentList.FirstOrDefault();

            if (!(registrationEmailSent.DateCreated == DateTime.MaxValue) && !(registrationEmailSent.DateCreated == DateTime.MinValue))
            {
                DateString = registrationEmailSent.DateCreated;
            }
        }

        return(DateString);
    }
Beispiel #2
0
    private void BindGrid(bool needRebind)
    {
        List <RegistrationEmailSent> emailSentList = new List <RegistrationEmailSent>();
        List <RegistrationEmailSent> filteredList  = new List <RegistrationEmailSent>();

        if (RegistrationId == Guid.Empty)
        {
            emailSentList = RegistrationEmailSentList.GetRegistrationEmailSentList().ToList();
        }
        else
        {
            filteredList = RegistrationEmailSentList.GetRegistrationEmailSentList(Guid.Empty, RegistrationId).ToList();

            Guid CurrentID = Guid.Empty;
            if (!string.IsNullOrEmpty(EntryId) && Guid.TryParse(EntryId, out CurrentID))
            {
                filteredList = filteredList.Where(x => x.EntryId == CurrentID).ToList();
            }
            if (!string.IsNullOrEmpty(AdhocId) && Guid.TryParse(AdhocId, out CurrentID))
            {
                filteredList = filteredList.Where(x => x.EntryId == CurrentID).ToList();
            }

            foreach (RegistrationEmailSent emailsent in filteredList)
            {
                EmailTemplate emailtemp = null;

                try
                {
                    emailtemp = EmailTemplate.GetEmailTemplate(emailsent.TemplateId);
                }
                catch { emailtemp = null; }


                if (emailtemp != null)
                {
                    if (templateMode == null)
                    {
                        emailSentList.Add(emailsent);
                    }
                    else
                    {
                        if (templateMode.Equals("INV"))
                        {
                            if (emailtemp.UserData2.Equals(EmailCategory.Invitation))
                            {
                                if (!String.IsNullOrEmpty(eventYear))
                                {
                                    if (emailsent.EventYear.Equals(eventYear))
                                    {
                                        emailSentList.Add(emailsent);
                                    }
                                }
                                else
                                {
                                    emailSentList.Add(emailsent);
                                }
                            }
                        }
                    }
                }
            }
        }

        radGridTemplateHistory.DataSource = emailSentList.OrderByDescending(m => m.DateCreated).ToList();
        if (needRebind)
        {
            radGridTemplateHistory.Rebind();
        }
    }