protected void Page_Load(object sender, EventArgs e) { if (UrlParameters.Action != "export") { InitPage(); } else { var contacts = GetContactsByFilter(); if (UrlParameters.View != "editor") { Response.Clear(); Response.ContentType = "text/csv; charset=utf-8"; Response.ContentEncoding = Encoding.UTF8; Response.Charset = Encoding.UTF8.WebName; const string fileName = "contacts.csv"; Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName)); Response.Write(ExportToCSV.ExportContactsToCSV(contacts, false)); MessageService.Send(HttpContext.Current.Request, MessageAction.ContactsExportedToCsv, MessageTarget.Create(contacts.Select(x => x.ID)), contacts.Select(x => x.GetTitle())); Response.End(); } else { var fileUrl = ExportToCSV.ExportContactsToCSV(contacts, true); Response.Redirect(fileUrl); } } }
protected void Page_Load(object sender, EventArgs e) { if (UrlParameters.Action != "export") { InitPage(); Page.RegisterClientScript(typeof(Masters.ClientScripts.ListContactViewData)); if (showEmptyScreen.Get("crmScreen" + TenantProvider.CurrentTenantID) == null) { var hasactivity = Global.DaoFactory.GetContactDao().HasActivity(); if (hasactivity) { showEmptyScreen.Insert("crmScreen" + TenantProvider.CurrentTenantID, new object(), TimeSpan.FromMinutes(30)); } else { RenderDashboardEmptyScreen(); } } RegisterScript(); } else { var contacts = GetContactsByFilter(); if (UrlParameters.View != "editor") { Response.Clear(); Response.ContentType = "text/csv; charset=utf-8"; Response.ContentEncoding = Encoding.UTF8; Response.Charset = Encoding.UTF8.WebName; var fileName = "contacts.csv"; Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName)); Response.Write(ExportToCSV.ExportContactsToCSV(contacts, false)); Response.End(); } else { var fileUrl = ExportToCSV.ExportContactsToCSV(contacts, true); Response.Redirect(fileUrl); } } }
protected void Page_Load(object sender, EventArgs e) { MobileVer = ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context); if (UrlParameters.Action != "export") { InitPage(); RegisterClientScript(); if (!IsSimpleView) { GetDataFromCookie(); } } else { if (!CRMSecurity.IsAdmin) { Response.Redirect(PathProvider.StartURL()); } var contacts = GetContactsByFilter(); if (UrlParameters.View != "editor") { Response.Clear(); Response.ContentType = "text/csv; charset=utf-8"; Response.ContentEncoding = Encoding.UTF8; Response.Charset = Encoding.UTF8.WebName; var fileName = "contacts.csv"; Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName)); Response.Write(ExportToCSV.ExportContactsToCSV(contacts, false)); Response.End(); } else { var fileUrl = ExportToCSV.ExportContactsToCSV(contacts, true); Response.Redirect(fileUrl); } } }