private void btnPreview_Click(object sender, EventArgs e) { btnPreview.Enabled = false; if (Convert.ToInt32(cboReports.EditValue) < 1) { NotificationDialog.Information("Bright Sales", "Please select a report to preview."); return; } WaitDialog.Show("Sending web service request ..."); List<int> _SubCampaignIds = new List<int>(); _SubCampaignIds.Add(m_BrightSalesProperty.CommonProperty.SubCampaignId); using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { _efDbContext.FIClearUserReuests(UserSession.CurrentUser.UserId); Guid _RequestId = Guid.NewGuid(); serverside_report_requests _eftRequest = new serverside_report_requests() { id = _RequestId, calling_environment = (short)ReportsUtility.eCallingEnvironment.BrightSales_SendEmail, display_mode = (short)ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData, campaign_info = string.Format("{0}>{1}>{2}", m_BrightSalesProperty.CommonProperty.CustomerName, m_BrightSalesProperty.CommonProperty.CampaignName, m_BrightSalesProperty.CommonProperty.SubCampaignName ), sub_campaign_ids = string.Join(",", _SubCampaignIds), view_config_id = Convert.ToInt32(cboReports.EditValue), account_id = m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId, requested_by = UserSession.CurrentUser.UserId, requested_on = DateTime.Now }; _efDbContext.serverside_report_requests.AddObject(_eftRequest); _efDbContext.SaveChanges(); _efDbContext.Detach(_eftRequest); ReportsUtility.SendReportRequest(_RequestId.ToString()); } WaitDialog.Close(); System.Threading.Thread.Sleep(2000); btnPreview.Enabled = true; //if (Convert.ToInt32(cboReports.EditValue) < 1) { // NotificationDialog.Information("Bright Sales", "Please select a report to preview."); // return; //} //m_SendEmailButtonPressed = false; //this.Cursor = Cursors.WaitCursor; //WaitDialog.Show("Loading report preview ..."); //m_Reports = new ReportsUtility() { // CampaignInfo = string.Format("{0}>{1}>{2}", // m_BrightSalesProperty.CommonProperty.CustomerName, // m_BrightSalesProperty.CommonProperty.CampaignName, // m_BrightSalesProperty.CommonProperty.SubCampaignName // ), // LSubCampaignData = new List<ReportsUtility.SubcampaignData>(), // CallingEnvironment = ReportsUtility.eCallingEnvironment.BrightSales_SendEmail, // DisplayMode = ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData, // AccountId = m_BrightSalesProperty.CommonProperty.CurrentWorkedAccountId //}; //List<int> _SubCampaignIds = new List<int>(); //_SubCampaignIds.Add(m_BrightSalesProperty.CommonProperty.SubCampaignId); //m_Reports.OnReportPageCompleted += m_Reports_OnReportPageCompleted; //DevExpress.XtraTab.XtraTabControl _DummyTab = new DevExpress.XtraTab.XtraTabControl(); //m_Reports.GenerateReportPages(ref _DummyTab, _SubCampaignIds.ToArray(), Convert.ToInt32(cboReports.EditValue)); }
private void btnShowReport_Click(object sender, EventArgs e) { WaitDialog.Show("Sending web service request ..."); List<int> _SubCampaignIds = new List<int>(); _SubCampaignIds.Add(m_SubCampaignId); using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { _efDbContext.FIClearUserReuests(UserSession.CurrentUser.UserId); m_eftConfigData = _efDbContext.view_configuration.FirstOrDefault(i => i.id == m_ViewConfigId); m_eftSubCampaign = _efDbContext.subcampaigns.FirstOrDefault(i => i.id == m_eftConfigData.subcampaign_id); m_eftCampaign = _efDbContext.campaigns.FirstOrDefault(i => i.id == m_eftSubCampaign.campaign_id); m_eftCustomer = _efDbContext.customers.FirstOrDefault(i => i.id == m_eftCampaign.customer_id); _efDbContext.Detach(m_eftConfigData); _efDbContext.Detach(m_eftSubCampaign); _efDbContext.Detach(m_eftCampaign); _efDbContext.Detach(m_eftCustomer); Guid _RequestId = Guid.NewGuid(); string _GridSortInfo = this.GetSerializedSortInfo(gridView1.SortInfo); string _ColumnsInfo = this.GetSerializedColumnsInfo(); serverside_report_requests _eftRequest = new serverside_report_requests() { id = _RequestId, calling_environment = (short)m_CallingEnvironment, display_mode = (short)m_ViewType, //calling_environment = (short)ReportsUtility.eCallingEnvironment.BrightSales_ViewDisplay, //display_mode = (short)ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData, campaign_info = string.Format("{0}>{1}>{2}", m_eftCustomer.customer_name, m_eftCampaign.campaign_name, m_eftSubCampaign.title ), sub_campaign_ids = string.Join(",", _SubCampaignIds), view_config_id = m_ViewConfigId, account_id = 0, active_filter_string = gridView1.ActiveFilterString, sort_info = _GridSortInfo, columns_info = _ColumnsInfo, requested_by = UserSession.CurrentUser.UserId, requested_on = DateTime.Now }; _efDbContext.serverside_report_requests.AddObject(_eftRequest); _efDbContext.SaveChanges(); _efDbContext.Detach(_eftRequest); ReportsUtility.SendReportRequest(_RequestId.ToString()); } WaitDialog.Close(); //WaitDialog.Show("Sending web service request ..."); //using (BrightPlatformEntities _efDbContext = new BrightPlatformEntities(UserSession.EntityConnection)) { // serverside_report_requests _eftRequest = new serverside_report_requests() { // calling_environment = (short)ReportsUtility.eCallingEnvironment.BrightSales_ViewDisplay, // display_mode = (short)ReportsUtility.eDisplayMode.AccountsContacts_WithDialogData, // campaign_info = m_CampaignInfo, // //sub_campaign_ids = string.Join(",", pSubCampaignIds), // view_config_id = m_ViewConfigId, // account_id = 0, // requested_by = UserSession.CurrentUser.UserId, // requested_on = DateTime.Now // }; // _efDbContext.serverside_report_requests.AddObject(_eftRequest); // string _RequestId = _eftRequest.id.ToString(); // _efDbContext.Detach(_eftRequest); // this.SendReportRequest(_RequestId); //} //WaitDialog.Close(); //WaitDialog.Show("Loading report preview ..."); //this.ReportPagePreview(); //WaitDialog.Close(); }