/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { gridContacts.AddNavigateUrl = UrlsData.AP_ContactAdd(); gridContacts.SiteID = SiteId; if (CompanyId.HasValue) { gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("tbl_Company.ID = '{0}'", CompanyId) }); if (CompanyId != Guid.Empty) { gridContacts.AddNavigateUrl = UrlsData.AP_ContactAdd() + "?cid=" + CompanyId; } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { access = Access.Check(); SiteId = ((LeadForceBasePage)Page).SiteId; _dataManager = ((LeadForceBasePage)Page).DataManager; RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(gridContacts, ucLeftColumn); gridContacts.SiteID = SiteId; var category = Request.QueryString["c"]; var filter = Request.QueryString["f"]; if (!string.IsNullOrEmpty(category)) { gridContacts.AddNavigateUrl = UrlsData.AP_ContactAdd() + "?c=" + category; switch (category) { case "known": gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category=0 OR tbl_Contact.Category=1 OR tbl_Contact.Category=2)" }); break; case "active": gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category=1)" }); break; case "anonymous": gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category=4)" }); break; case "all": gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category<>3)" }); break; case "deleted": gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category=3)" }); IsDeletedCategory = true; break; } } else if (!string.IsNullOrEmpty(filter)) { gridContacts.AddNavigateUrl = UrlsData.AP_ContactAdd(); var startDate = DateTime.Now.AddDays(1).AddMonths(-1).Date; var endDate = DateTime.Now.Date.AddDays(1); var period = string.Format(" tbl_Contact.CreatedAt >= '{0}' AND tbl_Contact.CreatedAt <= '{1}' ", startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")); switch (filter) { case "all": gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("(tbl_Contact.ID IN (SELECT DISTINCT ContactID FROM tbl_ContactSessions WHERE SiteID = '{0}' AND SessionDate >= '{1}' AND SessionDate <= '{2}'))", SiteId, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")) }); break; case "new": gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("({0})", period) }); break; case "reffer": gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("(tbl_Contact.RefferID IS NOT NULL AND {0})", period) }); break; case "direct": gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("((tbl_Contact.RefferURL IS NULL OR tbl_Contact.RefferURL = '') AND {0})", period) }); IsDeletedCategory = true; break; case "repeat": gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("(tbl_Contact.ID IN (SELECT DISTINCT ContactID FROM tbl_ContactSessions WHERE SiteID = '{0}' AND SessionDate >= '{1}' AND SessionDate <= '{2}' AND UserSessionNumber > 1))", SiteId, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd")) }); IsDeletedCategory = true; break; default: Guid advertisingPlatformId; if (Guid.TryParse(filter, out advertisingPlatformId)) { gridContacts.Where.Add(new GridWhere { CustomQuery = string.Format("(tbl_Contact.AdvertisingPlatformID = '{0}' AND {1})", advertisingPlatformId, period) }); } break; } } else { gridContacts.AddNavigateUrl = UrlsData.AP_ContactAdd(); gridContacts.Where.Add(new GridWhere { CustomQuery = "(tbl_Contact.Category=0 OR tbl_Contact.Category=1 OR tbl_Contact.Category=2)" }); } gridContacts.ShowDeleteButton = !IsDeletedCategory && access.Delete; gridContacts.ShowRestoreButton = IsDeletedCategory; }