コード例 #1
0
ファイル: ContactFormDAO.cs プロジェクト: zdavid99/wstest
 public static IList <ContactForm> GetLast100Contacts()
 {
     // Just for convinience lets show last 100 contacts
     using (ContactInformationDataContext repository = ContactDataSource.ContactDataContext())
     {
         //
         IList <ContactForm> contacts = (from contact in repository.oc_contactlists
                                         orderby contact.date_created descending
                                         select BuildContactForm(contact, repository.GetDmaXmlFromFormData(contact.xml_form_data))).Take(100).ToList();
         return(contacts);
     }
 }
コード例 #2
0
ファイル: ContactFormDAO.cs プロジェクト: zdavid99/wstest
 public static IList <ContactForm> GetContactsByCriteria(string formName, DateTime startDate, DateTime endDate)
 {
     // Just for convinience lets show last 100 contacts
     using (ContactInformationDataContext repository = ContactDataSource.ContactDataContext())
     {
         var contactForms = (from contact in repository.oc_contactlists
                             where (String.IsNullOrEmpty(formName) || contact.source_form_name == formName)
                             &&
                             (DateTime.MinValue == startDate || contact.date_created >= startDate) &&
                             (DateTime.MaxValue == endDate || contact.date_created <= endDate)
                             orderby contact.date_created descending
                             select BuildContactForm(contact, repository.GetDmaXmlFromFormData(contact.xml_form_data)));
         return(contactForms.ToList());
     }
 }
コード例 #3
0
ファイル: ContactFormDAO.cs プロジェクト: zdavid99/wstest
 public static IList <ContactForm> GetContactsByCriteria(string businessArea, IEnumerable <string> formNames, DateTime startDate, DateTime endDate)
 {
     // Just for convinience lets show last 100 contacts
     using (ContactInformationDataContext repository = ContactDataSource.ContactDataContext())
     {
         var contactForms = (from contact in repository.oc_contactlists
                             join map in repository.ContactListNameMaps
                             on contact.source_form_name equals map.SourceFormName
                             where (formNames.Where(x => x != string.Empty).Count() == 0 || formNames.Contains(map.Name)) &&
                             (businessArea == null || businessArea == string.Empty || businessArea == map.BusinessName)
                             &&
                             (DateTime.MinValue == startDate || contact.date_created >= startDate) &&
                             (DateTime.MaxValue == endDate || contact.date_created <= endDate)
                             orderby contact.date_created descending
                             select BuildContactForm(contact, repository.GetDmaXmlFromFormData(contact.xml_form_data)));
         return(contactForms.ToList());
     }
 }