private void JobTypeGraphReport() { string auditorSuccessMessage = "Graph Generated successfully"; string auditorFailureMessage = "Failed to Generate Graph"; string suggestionMessage = ""; string userRole = Session["UserRole"].ToString(); string userid = loggedInUserID; try { string monthFrom = DropDownListFromMonth.SelectedValue; string dayFrom = DropDownListFromDate.SelectedValue; string yearFrom = DropDownListFromYear.SelectedValue; string monthTo = DropDownListToMonth.SelectedValue; string dayTo = DropDownListToDate.SelectedValue; string yearTo = DropDownListToYear.SelectedValue; string fromDate = "" + monthFrom + "/" + dayFrom + "/" + yearFrom + ""; string toDate = "" + monthTo + "/" + dayTo + "/" + yearTo + ""; DataSet dsJobStatus = DataManager.Provider.Reports.provideJobCompleted(); DataTable dt = dsJobStatus.Tables[0]; string jobStatus = string.Empty; for (int i = 0; i < dt.Rows.Count; i++) { jobStatus = jobStatus + dt.Rows[i]["JOB_COMPLETED_TPYE"].ToString().ToUpper(); jobStatus += (i < dt.Rows.Count) ? "," : string.Empty; } DataSet dsReport = new DataSet(); if (!string.IsNullOrEmpty(fromDate) && !string.IsNullOrEmpty(toDate)) { if (userRole == "admin") { dsReport = DataManager.Provider.Reports.ProvideQuickJobSummaryReportData(fromDate, toDate, jobStatus); } else { dsReport = DataManager.Provider.Reports.ProvideUserQuickJobSummaryReportData(userid, fromDate, toDate, jobStatus); } } TableQuickReport.Visible = true; TableHeaderRow tableHeaderRowReport = new TableHeaderRow(); tableHeaderRowReport.CssClass = "Table_HeaderBG"; tableHeaderRowReport.TableSection = TableRowSection.TableHeader; if (dsReport.Tables[0].Rows.Count != 0) { for (int column = 0; column < dsReport.Tables[0].Columns.Count; column++) { string labelResourceIDs = "JOBTYPE,COLOR,BW,TOTAL"; string clientMessagesResourceIDs = ""; string serverMessageResourceIDs = ""; Hashtable localizedResources = AppLibrary.Localization.Resources("", Session["selectedCulture"] as string, labelResourceIDs, clientMessagesResourceIDs, serverMessageResourceIDs); TableHeaderCell th = new TableHeaderCell(); th.CssClass = "H_title"; th.Text = localizedResources["L_" + dsReport.Tables[0].Columns[column].ColumnName.ToUpper()].ToString(); th.Wrap = false; th.HorizontalAlign = HorizontalAlign.Center; tableHeaderRowReport.Cells.Add(th); } TableQuickReport.Rows.Add(tableHeaderRowReport); for (int i = 0; i < dsReport.Tables[0].Rows.Count; i++) { TableRow trLog = new TableRow(); AppController.StyleTheme.SetGridRowStyle(trLog); TableCell tdJobMode = new TableCell(); tdJobMode.Text = dsReport.Tables[0].Rows[i]["JobType"].ToString(); tdJobMode.HorizontalAlign = HorizontalAlign.Center; TableCell tdColor = new TableCell(); tdColor.Text = dsReport.Tables[0].Rows[i]["Color"].ToString(); tdColor.HorizontalAlign = HorizontalAlign.Center; TableCell tdBW = new TableCell(); tdBW.Text = dsReport.Tables[0].Rows[i]["BW"].ToString(); tdBW.HorizontalAlign = HorizontalAlign.Center; TableCell tdTotal = new TableCell(); tdTotal.Text = dsReport.Tables[0].Rows[i]["Total"].ToString(); tdTotal.HorizontalAlign = HorizontalAlign.Center; trLog.Cells.Add(tdJobMode); trLog.Cells.Add(tdColor); trLog.Cells.Add(tdBW); trLog.Cells.Add(tdTotal); TableQuickReport.Rows.Add(trLog); } ChartPrint.DataSource = dsReport; #region Print //Print chart //if (int.Parse(dsReport.Tables[0].Compute("SUM(Total)", string.Empty).ToString()) == 0) if (dsReport.Tables[0].Rows[0]["Total"].ToString() == "0") { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "PRINT"); //"PRINT_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartPrint.Titles.Add(titleNoData); string message = Localization.GetLabelText("", Session["selectedCulture"] as string, "NO_DATA_FOR_DATE"); //No Data found for the selected Date range Title noDataTitle = new Title(message, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartPrint.Titles.Add(noDataTitle); } else { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "PRINT"); //"PRINT_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartPrint.Titles.Add(titleNoData); ChartPrint.Legends.Add("Legand1").Title = "JobType Vs Print"; ChartPrint.ChartAreas["ChartArea1"].AxisX.Title = "JobType"; ChartPrint.ChartAreas["ChartArea1"].AxisY.Title = "Print"; { ChartPrint.Series["PrintUser"].Points.AddXY("Color", dsReport.Tables[0].Rows[0]["Color"].ToString()); ChartPrint.Series["PrintUser"].Points.AddXY("Bw", dsReport.Tables[0].Rows[0]["BW"].ToString()); //ChartPrint.Series["PrintUser"].Points.AddXY("Total " + dsReport.Tables[0].Rows[0]["JobType"].ToString(), dsReport.Tables[0].Rows[0]["Total"].ToString()); ChartPrint.Series["PrintUser"].Points[0].Color = Color.Yellow; ChartPrint.Series["PrintUser"].Points[1].Color = Color.Gray; ChartPrint.Series["PrintUser"].IsValueShownAsLabel = true; ChartPrint.Series["PrintUser"].ChartType = SeriesChartType.Pie; ChartPrint.Series["PrintUser"].Points[1]["Exploded"] = "true"; ChartPrint.DataBind(); } } #endregion #region Copy //Copy Chart //if (int.Parse(dsReport.Tables[0].Compute("SUM(Total)", string.Empty).ToString()) == 0) if (dsReport.Tables[0].Rows[1]["Total"].ToString() == "0") { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "COPY"); //"COPY_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartCopy.Titles.Add(titleNoData); string message = Localization.GetLabelText("", Session["selectedCulture"] as string, "NO_DATA_FOR_DATE"); //No Data found for the selected Date range Title noDataTitle = new Title(message, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartCopy.Titles.Add(noDataTitle); } else { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "COPY"); //"COPY_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartCopy.Titles.Add(titleNoData); ChartCopy.Legends.Add("Legand1").Title = "JobType Vs Copy"; ChartCopy.ChartAreas["ChartArea1"].AxisX.Title = "JobType"; ChartCopy.ChartAreas["ChartArea1"].AxisY.Title = "Copy"; { ChartCopy.Series["CopyUser"].Points.AddXY("Color ", dsReport.Tables[0].Rows[1]["Color"].ToString()); ChartCopy.Series["CopyUser"].Points.AddXY("Bw ", dsReport.Tables[0].Rows[1]["BW"].ToString()); //ChartCopy.Series["CopyUser"].Points.AddXY("Total " + dsReport.Tables[0].Rows[1]["JobType"].ToString(), dsReport.Tables[0].Rows[1]["Total"].ToString()); //ChartCopy.Series["CopyUser"].LabelForeColor = System.Drawing.Color.Snow; ChartCopy.Series["CopyUser"].Points[0].Color = Color.OrangeRed; ChartCopy.Series["CopyUser"].Points[1].Color = Color.Gray; ChartCopy.Series["CopyUser"].IsValueShownAsLabel = true; ChartCopy.Series["CopyUser"].ChartType = SeriesChartType.Pie; ChartCopy.Series["CopyUser"].Points[1]["Exploded"] = "true"; ChartCopy.DataBind(); } } #endregion #region Scan //Scan Chart // if (int.Parse(dsReport.Tables[0].Compute("SUM(Total)", string.Empty).ToString()) == 0) if (dsReport.Tables[0].Rows[2]["Total"].ToString() == "0") { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "SCAN"); //"SCAN_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartScan.Titles.Add(titleNoData); string message = Localization.GetLabelText("", Session["selectedCulture"] as string, "NO_DATA_FOR_DATE"); //No Data found for the selected Date range Title noDataTitle = new Title(message, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartScan.Titles.Add(noDataTitle); } else { string titleTextNoData = Localization.GetLabelText("", Session["selectedCulture"] as string, "SCAN"); //"SCAN_CHART_DATA"; Title titleNoData = new Title(titleTextNoData, Docking.Top, new System.Drawing.Font("Calibri", 14, System.Drawing.FontStyle.Bold), System.Drawing.Color.FromArgb(26, 59, 105)); ChartScan.Titles.Add(titleNoData); ChartScan.Legends.Add("Legand1").Title = "JobType Vs Scan"; ChartScan.ChartAreas["ChartArea1"].AxisX.Title = "JobType"; ChartScan.ChartAreas["ChartArea1"].AxisY.Title = "Scan"; { ChartScan.Series["ScanUser"].Points.AddXY("Color", dsReport.Tables[0].Rows[2]["Color"].ToString()); ChartScan.Series["ScanUser"].Points.AddXY("Bw", dsReport.Tables[0].Rows[2]["BW"].ToString()); //ChartScan.Series["ScanUser"].Points.AddXY("Total " + dsReport.Tables[0].Rows[2]["JobType"].ToString(), dsReport.Tables[0].Rows[2]["Total"].ToString()); ChartScan.Series["ScanUser"].Points[0].Color = Color.SpringGreen; ChartScan.Series["ScanUser"].Points[1].Color = Color.Gray; ChartScan.Series["ScanUser"].IsValueShownAsLabel = true; ChartScan.Series["ScanUser"].ChartType = SeriesChartType.Pie; ChartScan.Series["ScanUser"].Points[1]["Exploded"] = "true"; ChartScan.DataBind(); } } #endregion //gridViewReport.DataSource = dsReport.Tables[0]; //gridViewReport.DataBind(); } } catch (Exception ex) { LogManager.RecordMessage("QuickJobSummary.aspx.cs.JobTypeGraphReport", Session["UserID"] as string, LogManager.MessageType.Exception, auditorFailureMessage, suggestionMessage, ex.Message, ex.StackTrace); string serverMessage = Localization.GetServerMessage("", Session["selectedCulture"] as string, "Failed to Generate Graph");//FAILED_TO_LOAD_GRAPH GetMasterPage().DisplayActionMessage(AppLibrary.MessageType.Error.ToString(), serverMessage, null); } }