Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (UrlParameters.Action != "export")
            {
                _phListBase.Controls.Add(LoadControl(ListBaseView.Location));
            }
            else
            {
                var deals = GetDealsByFilter();

                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 = "opportunity.csv";

                    Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName));
                    Response.Write(ExportToCSV.ExportDealsToCSV(deals, false));

                    MessageService.Send(HttpContext.Current.Request, MessageAction.OpportunitiesExportedToCsv, MessageTarget.Create(deals.Select(x => x.ID)), deals.Select(x => x.Title));

                    Response.End();
                }
                else
                {
                    var fileUrl = ExportToCSV.ExportDealsToCSV(deals, true);
                    Response.Redirect(fileUrl);
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileVer = ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context);

            if (UrlParameters.Action != "export")
            {
                InitPanels();

                Page.RegisterClientScript(typeof(Masters.ClientScripts.ListDealViewData));
                RegisterScript();
                InitExchangeRateView();
            }
            else
            {
                var deals = GetDealsByFilter();

                if (UrlParameters.View != "editor")
                {
                    Response.Clear();
                    Response.ContentType     = "text/csv; charset=utf-8";
                    Response.ContentEncoding = Encoding.UTF8;
                    Response.Charset         = Encoding.UTF8.WebName;
                    var fileName = "opportunity.csv";

                    Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName)); Response.Write(ExportToCSV.ExportDealsToCSV(deals, false));
                    Response.End();
                }
                else
                {
                    var fileUrl = ExportToCSV.ExportDealsToCSV(deals, true);
                    Response.Redirect(fileUrl);
                }
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MobileVer = ASC.Web.Core.Mobile.MobileDetector.IsRequestMatchesMobile(this.Context);

            if (UrlParameters.Action != "export")
            {
                if (contactID == 0)
                {
                    GetDataFromCookie();
                    if (NoDeals)
                    {
                        InitEmptyScreenForNoDeals();
                    }
                    else
                    {
                        InitEmptyScreenForFilter();

                        InitContactSelectorForFilter();

                        RegisterClientScriptForFilter();
                    }
                }
                else //if (contactID != 0)
                {
                    NoDeals = false;

                    InitEmptyScreenForNoDealsInContact();
                }
            }
            else if (contactID == 0)
            {
                if (!CRMSecurity.IsAdmin)
                {
                    Response.Redirect(PathProvider.StartURL());
                }

                var deals = GetDealsByFilter();

                if (UrlParameters.View != "editor")
                {
                    Response.Clear();
                    Response.ContentType     = "text/csv; charset=utf-8";
                    Response.ContentEncoding = Encoding.UTF8;
                    Response.Charset         = Encoding.UTF8.WebName;
                    var fileName = "opportunity.csv";

                    Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}", fileName)); Response.Write(ExportToCSV.ExportDealsToCSV(deals, false));
                    Response.End();
                }
                else
                {
                    var fileUrl = ExportToCSV.ExportDealsToCSV(deals, true);
                    Response.Redirect(fileUrl);
                }
            }
        }