//fungsi: Handle ketika terjadi Perintah pada GridView protected void GvLaporan_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { //seleksi kemungkinan perintah pada datarow if (e.CommandName == "Insert") { //memanggil procedure insert DsReport.Insert(); } else if (e.CommandName == "Cancel_Insert") { GvLaporan.ShowFooter = false; } }
private static void LoadEventData(int id) { try { using (SqlConnection connection = new SqlConnection(connectionString)) { //ouverture connection.Open(); //commande sql SqlCommand command = new SqlCommand("GetEventData", connection); //délai d'attente requête 1 minute max command.CommandTimeout = 60; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@id", id)); using (SqlDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { DataSet ds = new DsReport(); ds.Tables["EventData"].Load(reader); GenerateReport(ds); } } connection.Close(); } } catch (Exception e) { Log.Error("LoadEventData :", e); } }
private void ExportToExcelSubmitCommand() { try { PCCS feature = new PCCS() { FEATURE = MandatoryFields.FEATURE }; PCCS feature1 = new PCCS() { FEATURE = MandatoryFields.FEATURE1 }; PCCS feature2 = new PCCS() { FEATURE = MandatoryFields.FEATURE2 }; PCCS specification = new PCCS() { SPEC_MIN = MandatoryFields.SPEC_MIN, SPEC_MAX = MandatoryFields.SPEC_MAX }; PRD_MAST productMaster = new PRD_MAST() { PART_DESC = MandatoryFields.PART_DESC }; DataSet dsReport = DsReport; if (!DsReport.IsNotNullOrEmpty() || !DsReport.Tables.IsNotNullOrEmpty() || DsReport.Tables.Count == 0) { dsReport = bll.GetAllFeatures(feature, feature1, feature2, specification, productMaster); } //MandatoryFields.GRID_TITLE = REPORT_TITLE; if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) { ShowInformationMessage(PDMsg.NoRecordsPrint); return; } //dsReport.DataSetName = REPORT_NAME; //MandatoryFields.GridData = dsReport.Tables[0].DefaultView; //MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; //DataRow row = dsReport.Tables[1].Rows.Add(); //row["ReportTitle"] = REPORT_TITLE; //row.AcceptChanges(); //dsReport.Tables[1].AcceptChanges(); //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); //frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME, CrystalDecisions.Shared.ExportFormatType.ExcelWorkbook); //if (!reportViewer.ReadyToShowReport) return; string reportName = GetReportPath() + "FeatureWiseExport.rpt"; if (BindReport(dsReport, reportName, CrystalDecisions.Shared.ExportFormatType.ExcelWorkbook) == true) // If condition added by Jeyan { ShowInformationMessage("Exported to Excel File Successfully."); } //reportViewer.ShowDialog(); } catch (Exception ex) { ShowWarningMessage(ex.Message, MessageBoxButton.OK); } }
private void PrintSubmitCommand() { Progress.ProcessingText = PDMsg.Load; Progress.Start(); PCCS feature = new PCCS() { FEATURE = MandatoryFields.FEATURE }; PCCS feature1 = new PCCS() { FEATURE = MandatoryFields.FEATURE1 }; PCCS feature2 = new PCCS() { FEATURE = MandatoryFields.FEATURE2 }; PCCS specification = new PCCS() { SPEC_MIN = MandatoryFields.SPEC_MIN, SPEC_MAX = MandatoryFields.SPEC_MAX }; PRD_MAST productMaster = new PRD_MAST() { PART_DESC = MandatoryFields.PART_DESC }; DataSet dsReport = DsReport; if (!DsReport.IsNotNullOrEmpty() || !DsReport.Tables.IsNotNullOrEmpty() || DsReport.Tables.Count == 0) { RefreshSubmitCommand(); } //if (!dsReport.IsNotNullOrEmpty() || !dsReport.Tables.IsNotNullOrEmpty() || dsReport.Tables.Count < 0) //{ // ShowInformationMessage(PDMsg.NoRecordsPrint); // return; //} if (MandatoryFields.GridData.IsNotNullOrEmpty()) { if (MandatoryFields.GridData.Count <= 0) { ShowInformationMessage(PDMsg.NoRecordsPrint); return; } } //dsReport.DataSetName = REPORT_NAME; //MandatoryFields.GridData = dsReport.Tables[0].DefaultView; //MandatoryFields.GRID_TITLE = REPORT_TITLE + " - " + MandatoryFields.GridData.Table.Rows.Count + " Entries"; //DataRow row = dsReport.Tables[1].Rows.Add(); //row["ReportTitle"] = REPORT_TITLE; //row.AcceptChanges(); //dsReport.Tables[1].AcceptChanges(); //dsReport.WriteXmlSchema("D:\\" + dsReport.DataSetName + ".xml"); frmMISInputBox inp = new frmMISInputBox("Report Title", "Enter the Title of the Report"); inp.ShowDialog(); //inp.Txt_InputBox.Text; frmReportViewer reportViewer = new frmReportViewer(dsReport, REPORT_NAME, inp.Txt_InputBox.Text); Progress.End(); if (!reportViewer.ReadyToShowReport) { return; } reportViewer.ShowDialog(); }