public void ProcessRequest(HttpContext context) { string request = context.Request["request"]; string[] parts = request.Split('~'); string Query = string.Empty; Query = "SELECT Appointment.ID as Id, person.FirstName as FirstName, person.LastName as LastName," + " CONVERT(varchar, [ApptDay], 101) as DateOfAppointment,CONVERT(varchar(15), CAST([ApptTime] AS TIME), 100) as TimeOfAppointment," + " CONVERT(varchar, person.DOB, 101) as DateOfBirth, '0' as Account" + " FROM Appointment" + " inner join webid" + " on webid.ID = appointment.UserID" + " inner join person" + " on person.ID = webid.PersonID" + " where[ApptDay] = '" + parts[0] + "'" //+ " where[ApptDay] = '06/26/2020'" + " and person.locationid = " + parts[1] //+ " and person.locationid = 2" + " order by Appointment.ApptDay, Appointment.ApptTime"; var report = new PrintSchedule(); Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(); sqlDataSource.ConnectionString = "Server = 64.41.86.25; Database = Appointment; Uid = Appointment; Pwd = 0griswold;"; sqlDataSource.SelectCommand = Query; report.DataSource = sqlDataSource; var reportPackager = new ReportPackager(); using (var targetStream = System.IO.File.Create(@"C:\temp\PrintReport.trdp")) { reportPackager.Package(report, targetStream); } var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); var deviceInfo = new System.Collections.Hashtable(); var reportSource = new Telerik.Reporting.UriReportSource(); //// reportName is the path to the TRDP/TRDX file reportSource.Uri = @"C:\temp\PrintReport.trdp"; Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo); string filePath = System.IO.Path.Combine(@"C:\waldenltd\ionicwithvuedev\fairfield-app-admin\public\", "output.pdf"); using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); } context.Response.ContentType = "text/plain"; context.Response.Write("OK"); }
protected void Page_Load(object sender, EventArgs e) { var processRepo = new ProcessRepository(); var finishProductionProcessId = processRepo.Get(a => a.Name == "اتمام تولید").FirstOrDefault().Id; CheckShamsiDateFunctions(); int id; if (Page.Request.QueryString[0].ToSafeInt() == 0) { id = new WorksheetRepository().GetMaxId(); } else { id = Page.Request.QueryString[0].ToSafeInt(); } Report report = new ReportWorksheets(); Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(); sqlDataSource.ConnectionString = "Tarin"; sqlDataSource.SelectCommand = "select WID,[Date],PartNo,WaxNo,ColorName,OperatorId,OperatorName,ProcessId,ProcessName from (" + "SELECT distinct w.Id WID, dbo.shamsidate(w.Date) as [Date] ,w.PartNo,w.WaxNo,c.Name ColorName, u.FriendlyName OperatorName," + //" d.ProductId,p.Code PCode, cat.Name + ' ' + p.Name PName" + " pro.Name ProcessName," + " pro.Id ProcessId," + " cat.Id CatId," + " u.Id OperatorId " + //" pcat.[order] " + "FROM worksheets w " + "join Colors c on c.Id = w.ColorId " + "join Users u on u.Id = w.OperatorId " + "join WorksheetDetails d on w.Id = d.WorksheetId " + "join Products p on p.Id = d.ProductId " + "join Categories cat on cat.Id = p.ProductCategoryId " + "join ProcessCategories pcat on pcat.CategoryId = cat.Id " + "join Processes pro on pro.Id = pcat.ProcessId" + ") s1 " + "where WId = @id " + "group by WID,[Date],PartNo,WaxNo,ColorName,OperatorId,OperatorName,ProcessId,ProcessName " + "order by ProcessId"; sqlDataSource.Parameters.Add("@id", System.Data.DbType.Int32, id); report.DataSource = sqlDataSource; InstanceReportSource reportSource = new InstanceReportSource(); reportSource.ReportDocument = report; ReportViewer1.ReportSource = reportSource; var table1 = report.Items.Find("table1", true)[0]; ((table1 as Telerik.Reporting.Table).DataSource as Telerik.Reporting.SqlDataSource).Parameters[0].Value = id; ReportViewer1.RefreshReport(); }
static void Main(string[] args) { string databaseConnection = System.Configuration.ConfigurationManager.AppSettings["allergyConnection"]; string reportLocation = System.Configuration.ConfigurationManager.AppSettings["reportLocation"]; string outputPath = System.Configuration.ConfigurationManager.AppSettings["outputPath"]; string Query = string.Empty; Query = "SELECT Appointment.ID as Id,person.HPhone, person.FirstName as FirstName, person.LastName as LastName," + " CONVERT(varchar, [ApptDay], 101) as DateOfAppointment,CONVERT(varchar(15), CAST([ApptTime] AS TIME), 100) as TimeOfAppointment," + " CONVERT(varchar, person.DOB, 101) as DateOfBirth, '0' as Account" + " FROM Appointment" + " inner join webid" + " on webid.ID = appointment.UserID" + " inner join person" + " on person.ID = webid.PersonID" + " where[ApptDay] = '" + args[0] + "'" + " and person.locationid = " + args[1] + " order by Appointment.ApptDay, Appointment.ApptTime"; Console.WriteLine(Query); var report = new PrintSchedule(); Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(); sqlDataSource.ConnectionString = databaseConnection; sqlDataSource.SelectCommand = Query; report.DataSource = sqlDataSource; var reportPackager = new ReportPackager(); using (var targetStream = System.IO.File.Create(reportLocation)) { reportPackager.Package(report, targetStream); } var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); var deviceInfo = new System.Collections.Hashtable(); var reportSource = new Telerik.Reporting.UriReportSource(); //// reportName is the path to the TRDP/TRDX file reportSource.Uri = reportLocation; Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("PDF", reportSource, deviceInfo); string filePath = System.IO.Path.Combine(outputPath, "output.pdf"); using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create)) { fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length); } }
protected void Page_Load(object sender, EventArgs e) { //try //{ // CheckShamsiDateFunctions(); //} //catch (Exception ex) //{ //} int id; id = Page.Request.QueryString[0].ToSafeInt(); Report report = new ReportShareDiv(); Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(); sqlDataSource.ConnectionString = "Tarin"; sqlDataSource.SelectCommand = " SELECT Members.Name, Members.Code, Members.Type, Members.ShareAmount, Members.ShareCount, Members.HasPriority, ShareDivisionDetails.MemberId, ShareDivisionDetails.ShareAmount AS SharedAmount, " + " ShareDivisionDetails.ShareDivisionId, ShareDivisions.Type AS Expr2, ShareDivisions.Amount As TotalProfit, ShareDivisions.InsertDateTime,dbo.shamsidate(ShareDivisions.InsertDateTime) as [Date]" + " FROM Members INNER JOIN" + " ShareDivisionDetails ON Members.Id = ShareDivisionDetails.MemberId INNER JOIN" + " ShareDivisions ON ShareDivisionDetails.ShareDivisionId = ShareDivisions.Id" + $" where ShareDivisions.Id ={id} order by cast(Members.Code as bigint)"; sqlDataSource.Parameters.Add("@id", System.Data.DbType.Int32, id); report.DataSource = sqlDataSource; InstanceReportSource reportSource = new InstanceReportSource(); reportSource.ReportDocument = report; ReportViewer1.ReportSource = reportSource; var table1 = report.Items.Find("table1", true)[0]; ((table1 as Telerik.Reporting.Table).DataSource as Telerik.Reporting.SqlDataSource).Parameters[0].Value = id; ReportViewer1.RefreshReport(); }
public void ProcessServiceReports(string fromDate, string toDate, string company, string totalBillable, string balanceFromPreviousMonth, string hoursPurchasedThisMonth, string balancedRemaining, string month) { string Query = string.Empty; var report = new ServiceReport(totalBillable, balanceFromPreviousMonth, hoursPurchasedThisMonth, balancedRemaining, month); Telerik.Reporting.SqlDataSource sqlDataSource = new Telerik.Reporting.SqlDataSource(); sqlDataSource.ConnectionString = "Server=ITD-CW02.ITD.local;User ID=reports;password=C0nn3ct3d;Database=cwwebapp_itd;Persist Security Info=True"; sqlDataSource.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; sqlDataSource.SelectCommand = "ITD_ServiceRpt"; sqlDataSource.Parameters.Add("@FromDate", (System.Data.DbType)TypeCode.String, fromDate); sqlDataSource.Parameters.Add("@ToDate", (System.Data.DbType)TypeCode.String, toDate); sqlDataSource.Parameters.Add("@company", (System.Data.DbType)TypeCode.String, company); report.DataSource = sqlDataSource; var reportPackager = new ReportPackager(); using (var targetStream = System.IO.File.Create("C:\\temp\\ServiceReport.trdp")) { reportPackager.Package(report, targetStream); } }