private void loadReport() { string nameRe = "MAU_79_80_4210.mrt"; if (checkBox_namere.Checked) { nameRe = ClassPrint.nameReport(nameRe); } StiReport report = new StiReport(); report.Load("Reports\\" + nameRe); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); //report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); //MessageBox.Show(datauser(dateEditTuNgay.Text, dateEditDenNgay.Text)); ((StiSqlSource)report.Dictionary.DataSources["DataSource1"]).CommandTimeout = 100; report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; if (cb_solieu.Text == "Nội trú") { report["solieu"] = "=1"; } else { report["solieu"] = "!=1"; } report.Render(false); stiViewerControl.Report = report; }
private void loadReport() { string nameRe = "mau_21.mrt"; if (checkBox_namere.Checked) { nameRe = ClassPrint.nameReport(nameRe); } StiReport report = new StiReport(); report.Load("Reports\\" + nameRe); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); //report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); //MessageBox.Show(datauser(dateEditTuNgay.Text, dateEditDenNgay.Text)); report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; report.Render(false); stiViewerControl.Report = report; }
private void loadReport() { string nameRe = "mau_19.mrt"; if (checkBox_namere.Checked) { nameRe = ClassPrint.nameReport(nameRe); } StiReport report = new StiReport(); report.Load("Reports\\" + nameRe); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); //MessageBox.Show(DateTime.ParseExact(dateEditTuNgay.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")); //MessageBox.Show(datauser(dateEditTuNgay.Text, dateEditDenNgay.Text)); //report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); try { report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); //report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; report.Render(false); } catch (Exception e) { e.ToString(); } stiViewerControl.Report = report; }
private void loadReport() { StiReport report = new StiReport(); report.Load("Reports\\Soxetnghiem.mrt"); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); //report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); //MessageBox.Show(datauser(dateEditTuNgay.Text, dateEditDenNgay.Text)); //((StiSqlSource)report.Dictionary.DataSources["DataSource1"]).CommandTimeout = 100; report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; if (cb_solieu.Text == "Nội trú") { report["solieu"] = "=1"; } else { report["solieu"] = "!=1"; } report.Render(false); stiViewerControl.Report = report; }
private void loadReport() { StiReport report = new StiReport(); report.Load("Reports\\mau_tk37_NEW.mrt"); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; //MessageBox.Show(datauser(dateEditTuNgay.Text, dateEditDenNgay.Text)); if (cb_solieu.Text == "Nội trú") { report["solieu"] = "and a.loaiba=1"; } else if (cb_solieu.Text == "Tất cả") { report["solieu"] = ""; } else { report["solieu"] = "and a.loaiba!=1"; } report.Render(false); stiViewerControl.Report = report; }
private void loadReport() { StiReport report = new StiReport(); report.Load("Reports\\mau_tk37_3_nhom.mrt"); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); report["schemamonth"] = dateToSchemaMonth(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; if (cb_solieu.Text == "Nội trú") { report["solieu"] = "=1"; } else { report["solieu"] = "!=1"; } report.Render(false); stiViewerControl.Report = report; }
public override void CreateConnectionInDataStore(StiDictionary dictionary, StiSqlDatabase database) { try { #region Remove all old data from datastore int index = 0; foreach (StiData data in dictionary.DataStore) { if (data.Name == database.Name) { dictionary.DataStore.RemoveAt(index); break; } index++; } #endregion var sqlConnection = new NpgsqlConnection(database.ConnectionString); var data2 = new StiData(database.Name, sqlConnection); data2.IsReportData = true; dictionary.DataStore.Add(data2); } catch (Exception e) { StiLogService.Write(this.GetType(), e); if (!StiOptions.Engine.HideExceptions) { throw; } } }
private void loadReport() { StiReport report = new StiReport(); report.Load("Reports\\SoMri.mrt"); StiSqlDatabase sqlDB = new StiSqlDatabase(); sqlDB = (StiSqlDatabase)report.Dictionary.Databases["Oracle"]; sqlDB.ConnectionString = FormHISSMS.conn_string; report.Compile(); report["schemamonth"] = datauser(dateEditTuNgay.Text, dateEditDenNgay.Text); report["tungay"] = dateEditTuNgay.Text; report["denngay"] = dateEditDenNgay.Text; report.Render(false); stiViewerControl.Report = report; }
private void button3_Click(object sender, EventArgs e) { bool IsNameUnique = true; string connectionString1 = textBox1.Text.Trim(); string connectionString2 = textBox2.Text.Trim(); if ((connectionString1.Length > 0) || (connectionString2.Length > 0)) { if (this.Report == null) { this.Report = new StiReport(); } this.Report.Dictionary.Clear(); this.report.DataStore.Clear(); } if (connectionString1.Length > 0) { StiDatabase mySqlDatabase = null; foreach (StiDatabase database in this.report.Dictionary.Databases) { if (database.Name == "MyStiSqlDatabase") { mySqlDatabase = database; } } if (mySqlDatabase == null) { mySqlDatabase = new StiSqlDatabase("MyStiSqlDatabase", connectionString1); this.Report.Dictionary.Databases.Add(mySqlDatabase); } if (mySqlDatabase.GetType() == typeof(StiSqlDatabase)) { foreach (string myItem in checkedListBox1.CheckedItems) { IsNameUnique = true; foreach (StiDataSource source in this.Report.DataSources) { if (source.Name == myItem) { IsNameUnique = false; } } if (IsNameUnique) { StiSqlSource sqlSource = new StiSqlSource("MyStiSqlDatabase", myItem, myItem, "SELECT * FROM dbo.\"" + myItem + "\""); this.Report.Dictionary.DataSources.Add(sqlSource); this.Report.Dictionary.Synchronize(); sqlSource.SynchronizeColumns(); } } } } if (connectionString2.Length > 0) { StiDatabase myOleDbDatabase = null; foreach (StiDatabase database in this.report.Dictionary.Databases) { if (database.Name == "MyStiOleDbDatabase") { myOleDbDatabase = database; } } if (myOleDbDatabase == null) { myOleDbDatabase = new StiOleDbDatabase("MyStiOleDbDatabase", connectionString2); this.Report.Dictionary.Databases.Add(myOleDbDatabase); } if (myOleDbDatabase.GetType() == typeof(StiOleDbDatabase)) { foreach (string myItem in checkedListBox2.CheckedItems) { IsNameUnique = true; foreach (StiDataSource source in this.Report.DataSources) { if (source.Name == myItem) { IsNameUnique = false; } } if (IsNameUnique) { StiOleDbSource oleDbSource = new StiOleDbSource("MyStiOleDbDatabase", myItem, myItem, "SELECT * FROM [" + myItem + "]"); this.Report.Dictionary.DataSources.Add(oleDbSource); this.Report.Dictionary.Synchronize(); oleDbSource.SynchronizeColumns(); } } } } if (this.Report == null) { this.Report = new StiReport(); } if (this.Report.Designer == null) { StiDesigner.CreatedReport += new EventHandler(StiDesigner_CreatedReport); StiDesigner.ClosingDesigner += ClosingDesigner; MessageBox.Show("Click 'File' then 'New Report' and this dialog appears again."); this.Report.Design(); this.Report = null; } else { this.Close(); } }
public override void CreateConnectionInDataStore(StiDictionary dictionary, StiSqlDatabase database) { try { #region remove all old data from datastore int index = 0; foreach (StiData oldData in dictionary.DataStore) { if (oldData.Name == database.Name) { dictionary.DataStore.RemoveAt(index); break; } index++; } #endregion SqlCeConnection sqlConnection = new SqlCeConnection(database.ConnectionString); StiData data = new StiData(database.Name, sqlConnection); data.IsReportData = true; dictionary.DataStore.Add(data); } catch (Exception e) { if (!StiOptions.Engine.HideMessages) Stimulsoft.Base.StiExceptionProvider.Show(e); } }
private void butReport_Click(object sender, EventArgs e) { if (this.lisEmployeesColumns.Count == 0) { MessageBox.Show("هیج ستونی انتخاب نشده است."); return; } EmployeesReport erEmployeesReport = new EmployeesReport(); erEmployeesReport.cnConnection = this.cnConnection; erEmployeesReport.usUser = this.usUser; erEmployeesReport.setSettings = this.setSettings; //Report StiReport srEmployees = new StiReport(); srEmployees.Pages[0].PaperSize = System.Drawing.Printing.PaperKind.A4; //MessageBox.Show(srEmployees.Pages[0].PaperSize.ToString()); //srEmployees. string strSColumnsName = ""; for (int i = 0; i < this.lisEmployeesColumns.Count; i++) { if (i != 0) { strSColumnsName += ", "; } strSColumnsName += this.lisEmployeesColumns[i].strName; } //DataBase StiSqlDatabase dbDataBase1 = new StiSqlDatabase(); dbDataBase1.Alias = "dbDataBase1"; dbDataBase1.Name = "dbDataBase1"; dbDataBase1.ConnectionString = this.cnConnection.strConnectionStringPty; srEmployees.Dictionary.Databases.Add(dbDataBase1); //DataSource StiSqlSource dsDataSource = new StiSqlSource(); dsDataSource.NameInSource = "dbDataBase1"; dsDataSource.Alias = "dsDataSource"; dsDataSource.Name = "dsDataSource"; dsDataSource.SqlCommand = Employee.GetSqlCommand(this.emSearch, strSColumnsName); for (int i = 0; i < this.lisEmployeesColumns.Count; i++) { dsDataSource.Columns.Add(this.lisEmployeesColumns[i].strName, this.lisEmployeesColumns[i].typType); } srEmployees.DataSources.Add(dsDataSource); //HeaderBand StiHeaderBand headerBand1 = new StiHeaderBand(); headerBand1.Height = 0.5; headerBand1.Name = "HeaderBand1"; srEmployees.Pages[0].Components.Add(headerBand1); StiText headerText = new StiText(new RectangleD(5, 0.2, 9.6, 1)); headerText.Text = "کارکنان شرکت " + FamSetting.GetCoInformation(this.cnConnection).strName; headerText.HorAlignment = StiTextHorAlignment.Center; headerText.Name = "headerText1"; headerText.Font = new Font("B Titr", 17); headerText.Brush = new StiSolidBrush(Color.Transparent); headerBand1.Components.Add(headerText); //ColumnHeaderBand StiColumnHeaderBand columnHeaderBand1 = new StiColumnHeaderBand(); columnHeaderBand1.Height = 0.5; columnHeaderBand1.Name = "columnHeaderBand1"; srEmployees.Pages[0].Components.Add(columnHeaderBand1); StiText[] stColumnHeaders = new StiText[this.lisEmployeesColumns.Count]; double douX = 19; for (int i = 0; i < this.lisEmployeesColumns.Count; i++) { stColumnHeaders[i] = new StiText(new RectangleD(douX - this.lisEmployeesColumns[i].douWidth, 1, this.lisEmployeesColumns[i].douWidth, 0.8)); stColumnHeaders[i].Text = this.lisEmployeesColumns[i].strCaption; stColumnHeaders[i].Name = "ch" + this.lisEmployeesColumns[i].strName; stColumnHeaders[i].Border = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid); stColumnHeaders[i].Font = new Font("B Titr", 12); stColumnHeaders[i].Brush = new StiSolidBrush(Color.Gray); stColumnHeaders[i].HorAlignment = StiTextHorAlignment.Center; stColumnHeaders[i].VertAlignment = StiVertAlignment.Center; columnHeaderBand1.Components.Add(stColumnHeaders[i]); douX -= this.lisEmployeesColumns[i].douWidth; } //DataBand StiDataBand dataBand1 = new StiDataBand(); dataBand1.DataSourceName = "dsDataSource"; dataBand1.Height = 0.5; dataBand1.Name = "dataBand1"; srEmployees.Pages[0].Components.Add(dataBand1); StiText[] stDataText = new StiText[this.lisEmployeesColumns.Count]; douX = 19; for (int i = 0; i < this.lisEmployeesColumns.Count; i++) { stDataText[i] = new StiText(new RectangleD(douX - this.lisEmployeesColumns[i].douWidth, 0, this.lisEmployeesColumns[i].douWidth, 0.6)); stDataText[i].Text = "{dsDataSource." + this.lisEmployeesColumns[i].strName + "}"; stDataText[i].Name = "db" + this.lisEmployeesColumns[i].strName; stDataText[i].Font = new Font("B Nazanin", 10); stDataText[i].Brush = new StiSolidBrush(Color.Transparent); stDataText[i].HorAlignment = StiTextHorAlignment.Center; stDataText[i].VertAlignment = StiVertAlignment.Center; stDataText[i].Border = new StiBorder(StiBorderSides.All, Color.Black, 1, StiPenStyle.Solid); dataBand1.Components.Add(stDataText[i]); douX -= this.lisEmployeesColumns[i].douWidth; } //Render srEmployees.Dictionary.Synchronize(); srEmployees.Compile(); srEmployees.Render(false); //srEmployees.Save(@"c:\rpt\report3.mrt"); erEmployeesReport.stvEmployees.Report = srEmployees; erEmployeesReport.ShowDialog(); }