C#
Exporting a SQL Server Reporting Services Report Directly to PDF
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
ReportViewer report = new ReportViewer(); report.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); report.ServerReport.ReportPath = "/ReportFolder/ReportName"; string mimeType, encoding, extension, deviceInfo; string[] streamids; Warning[] warnings; string format = "PDF"; //Desired format (PDF, Excel, or Image) deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>"; byte[] bytes = report.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings); System.IO.FileStream sw; sw = new System.IO.FileStream(@"c:\output.pdf", System.IO.FileMode.OpenOrCreate); for (int i = 0; i < bytes.Length; i++) sw.WriteByte(bytes[i]); sw.Close(); |
How to call a report (reportserver) using C#
by Bruno Rebelo on Feb.11, 2009, under C#, ReportServer
After your report been deployed, you have to add a REPORTVIEWER to your form and then :
reportURL.Text = "/REPORT1/report"; reportURL.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote; reportURL.ServerReport.ReportServerUrl = new Uri(@"http://localhost/reportserver"); reportURL.ServerReport.ReportPath = reportURL.Text; reportURL.RefreshReport(); |
voilá… there its your report
Converting your Barcode to BarCode Text for EAN13 true font
by Bruno Rebelo on Feb.10, 2009, under .Net, C#
public string EAN13(string chaine) { int i; int first; int checksum = 0; string CodeBarre = ""; bool tableA; if (Regex.IsMatch(chaine, "^\\d{12}$")) { for (i = 1; i < 12; i += 2) { System.Diagnostics.Debug.WriteLine(chaine.Substring(i, 1)); checksum += Convert.ToInt32(chaine.Substring(i, 1)); } checksum *= 3; for (i = 0; i < 12; i += 2) { checksum += Convert.ToInt32(chaine.Substring(i, 1)); } chaine += (10 - checksum % 10) % 10; CodeBarre = chaine.Substring(0, 1) + (char)(65 + Convert.ToInt32(chaine.Substring(1, 1))); first = Convert.ToInt32(chaine.Substring(0, 1)); for (i = 2; i <= 6; i++) { tableA = false; switch (i) { case 2: if (first >= 0 && first <= 3) tableA = true; break; case 3: if (first == 0 || first == 4 || first == 7 || first == 8) tableA = true; break; case 4: if (first == 0 || first == 1 || first == 4 || first == 5 || first == 9) tableA = true; break; case 5: if (first == 0 || first == 2 || first == 5 || first == 6 || first == 7) tableA = true; break; case 6: if (first == 0 || first == 3 || first == 6 || first == 8 || first == 9) tableA = true; break; } if (tableA) CodeBarre += (char)(65 + Convert.ToInt32(chaine.Substring(i, 1))); else CodeBarre += (char)(75 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "*"; for (i = 7; i <= 12; i++) { CodeBarre += (char)(97 + Convert.ToInt32(chaine.Substring(i, 1))); } CodeBarre += "+"; } return CodeBarre; } |
Criar uma dal
by pedro on Jan.18, 2009, under .Net, C#
public class DALCON { SqlConnection connection; public DALCON() { string connectionString = ConfigurationManager.ConnectionStrings["aero"].ConnectionString; connection = new SqlConnection(connectionString); connection.Open(); } public void CloseCON() { connection.Close(); } } |
para utilizar
DALCON DalObj = new DALCON(); aux = dalobj.CloseCON; |
How to audit from an extension ?
by Bruno Rebelo on Jan.17, 2009, under C#, OutSystems
How to save to servicenter an exception from one extension :
using OutSystems.HubEdition.RuntimePlatform.Log; … private void LogError(Exception e) { ErrorLog.StaticWrite( DateTime.Now, AppInfo.GetAppInfo().OsContext.Session.SessionID, AppInfo.GetAppInfo().eSpaceId, AppInfo.GetAppInfo().Tenant.Id, AppInfo.GetAppInfo().OsContext.Session.UserId, e.Message, e.ToString(), “My Message here”); } |
