private void btnStartSvc1_Click(object sender, EventArgs e) { var rptServer = new ReportServer(new Uri("http://localhost:9090/reports")); rptServer.Start(); btnStartReports.Text = rptServer.State.ToString(); }
public ActionResult GenerateExcelReport(ReportExecutionBE reportexecution) { try { LoggingHelper.LogInformation("Retrieving parameters..."); if (reportexecution == null) { return(new EmptyResult()); } Byte[] results = ReportServer.DownloadExcel(HttpContext, reportexecution); var fileName = string.Format("{0}.xls", reportexecution.ReportName); if (results != null && results.Length > 0) { Session[fileName] = results; return(Json(new { success = true, fileName }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } } catch (SqlException ex) { LoggingHelper.LogException("Unable to generate excel bytes from report service.", ex); throw; } catch (Exception ex) { LoggingHelper.LogException("Unable to generate excel bytes from report service.", ex); throw; } }
public ActionResult DeleteConfirmed(int id) { ReportServer reportserver = db.ReportServers.Find(id); db.ReportServers.Remove(reportserver); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /ReportServer/Delete/5 public ActionResult Delete(int id = 0) { ReportServer reportserver = db.ReportServers.Find(id); if (reportserver == null) { return(View("Missing", new MissingItem(id))); } return(View(reportserver)); }
public ActionResult Create(ReportServer reportserver) { if (ModelState.IsValid) { db.ReportServers.Add(reportserver); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }
/// </summary> /// 测试数据: Reports/GetProductDailyData?DataTime=2018-05-11&lineid=1 public string GetProductDailyData(string DataTime, int lineid = 1) { ReportServer reportServer = new ReportServer(); DateTime starttime = Convert.ToDateTime(DataTime); string StartDate = starttime.ToString("yyyy-MM-dd HH:mm:ss"); DateTime endtime = Convert.ToDateTime(DataTime).AddDays(1); string EndDate = endtime.ToString("yyyy-MM-dd HH:mm:ss"); return(reportServer.GetProductDailyData(StartDate, EndDate, lineid)); }
public ActionResult Edit(ReportServer reportserver) { if (ModelState.IsValid) { db.Entry(reportserver).State = EntityState.Modified; db.Entry(reportserver).Property(l => l.Password).IsModified = reportserver._passwordSet; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }
protected override void OnStart(string[] args) { this.rptServer = new ReportServer(new Uri("http://localhost:9090/reports")); rptServer.Start(); this.jobServer = new JobServer(new Uri("http://localhost:9090/scheduler")); jobServer.Start(); //base.OnStart(args); //ItsFrameService<T>.Run(); }
private void Form1_Load(object sender, EventArgs e) { ReportServer.Port = 11121; ReportServer.ReportPath = "D:\\Report"; ReportServer.ReportReceiveEvent += ReportServer_OnReportReceive; ReportServer.LogPath = @"C:\ReportLog\Server"; ReportServer.Start(); _reportServerStarted = true; ReportServer.LogManager.LogEvent += LogManager_LogEvent; }
/// <param name=""begintime"">查询年份(*) /// <param name=""endtime""> 结束日期(*) /// <param name=""groupid"">集团id /// <param name=""companyid"">公司id /// <param name=""foundryid"">车间id /// <param name=""ProductLineId"">产线id" public string DeviceErrYearRpt(string begintime, int?groupid, int?companyid, int?foundryid, int?ProductLineId, string devicemodel, int islisterr = 1) { if (groupid == null && companyid == null && foundryid == null && ProductLineId == null) { return(Global.RETURN_ERROR("部门编号不能全部为空")); } ProductionLinesServer pls = new ProductionLinesServer(); string lineids = Global.GetLinesStr(groupid, companyid, foundryid, ProductLineId); ReportServer rps = new ReportServer(); return(rps.DeviceErrYearRpt(begintime, lineids, devicemodel, islisterr)); }
/// <param name=""begintime"">查询月份(*) /// <param name=""endtime""> 结束日期(*) /// <param name=""groupid"">集团id /// <param name=""companyid"">公司id /// <param name=""foundryid"">车间id /// <param name=""ProductLineId"">产线id" public string LineMonthRpt(string begintime, int?groupid, int?companyid, int?foundryid, int?ProductLineId) { if (groupid == null && companyid == null && foundryid == null && ProductLineId == null) { return(Global.RETURN_ERROR("部门编号不能全部为空")); } ProductionLinesServer pls = new ProductionLinesServer(); string lineids = Global.GetLinesStr(groupid, companyid, foundryid, ProductLineId); ReportServer rps = new ReportServer(); return(rps.LineMonthRpt(begintime, lineids)); }
/// <summary> /// 生成日报表接口(最新一天) /// </summary> /// 测试数据: Reports/GetDailyReport public FileStreamResult GetDailyReport() { //模板路径 string strPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExcelFiles\\华宝硫化鞋生产线日报表模板.xls"); //服务器生成路径 string strServerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExcelFiles\\日报表\\" + "华宝硫化鞋生产线日报表" + DateTime.Now.ToString("yyyy-MM-dd")) + ".xls"; ReportServer reportServer = new ReportServer(); reportServer.GetDailyReport(strPath, strServerPath); return(File(new FileStream(strServerPath, FileMode.Open), "application/octet-stream", Server.UrlEncode("华宝硫化鞋生产线日报表" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls"))); }
private ActionResult Processing_Bank(int claim, PaymentMode payment) { ActionResult result4; if (payment == null) { throw new ArgumentNullException("payment"); } PaymentBeforeProcessingResult result = BookingProvider.BeforePaymentProcessing(UrlLanguage.CurrentLanguage, payment.paymentparam); if (result == null) { throw new Exception("cannot get payment details"); } if (!result.success) { throw new Exception("payment details fail"); } try { List <ReportParam> list = new List <ReportParam>(); ReportParam item = new ReportParam { Name = "vClaimList", Value = claim.ToString() }; list.Add(item); string str = ConfigurationManager.AppSettings["report_PrintInvoice"]; if (string.IsNullOrEmpty(str)) { throw new Exception("report_PrintInvoice is empty"); } ReportResult result2 = ReportServer.BuildReport(str, ReportFormat.pdf, list.ToArray()); if (result2 == null) { throw new Exception("report data is empty"); } MemoryStream fileStream = new MemoryStream(result2.Content); FileStreamResult result3 = new FileStreamResult(fileStream, "application/pdf") { FileDownloadName = string.Format("invoice_{0}.pdf", claim) }; result4 = result3; } catch (Exception exception) { Tracing.ServiceTrace.TraceEvent(TraceEventType.Error, 0, exception.ToString()); throw; } return(result4); }
private void btnStopReportServer_Click(object sender, EventArgs e) { if (_reportServerStarted) { ReportServer.Stop(); btnStopReportServer.Text = "Start Report Server"; _reportServerStarted = false; } else { ReportServer.Start(); btnStopReportServer.Text = "Stop Report Server"; _reportServerStarted = true; } }
/// </summary> /// 测试数据: Reports/GetProductDailyReport?DataTime=2018-05-11&lineid=1 public FileStreamResult GetProductDailyReport(string DataTime, int lineid = 1) { //模板路径 string strPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExcelFiles\\华宝硫化鞋生产线产量日报表模板.xls"); //服务器生成路径 string strServerPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "ExcelFiles\\日报表\\" + "华宝硫化鞋生产线产量日报表" + DataTime) + ".xls"; ReportServer reportServer = new ReportServer(); DateTime starttime = Convert.ToDateTime(DataTime); string StartDate = starttime.ToString("yyyy-MM-dd HH:mm:ss"); DateTime endtime = Convert.ToDateTime(DataTime).AddDays(1); string EndDate = endtime.ToString("yyyy-MM-dd HH:mm:ss"); reportServer.GetProductDailyReport(strPath, strServerPath, StartDate, EndDate, lineid); return(File(new FileStream(strServerPath, FileMode.Open), "application/octet-stream", Server.UrlEncode("华宝硫化鞋生产线产量日报表" + "ExcelFiles\\日报表\\" + "华宝硫化鞋生产线产量日报表" + DataTime) + ".xls")); }
public ActionResult Create(ReportServer reportserver) { if (!reportserver.PasswordSet) { ModelState.AddModelError("PasswordUnmasked", Resources.ProvideAccountPassword); } reportserver.UpdatePassword(db); if (ModelState.IsValid) { db.ReportServers.Add(reportserver); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }
public ActionResult Edit(ReportServer reportserver) { if (!reportserver.PasswordSet) { ModelState.AddModelError("PasswordUnmasked", Resources.ProvideAccountPassword); } reportserver.UpdatePassword(db); if (ModelState.IsValid) { db.Entry(reportserver).State = EntityState.Modified; db.Entry(reportserver).Property(l => l.Password).IsModified = reportserver.PasswordSet; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(reportserver)); }
public async Task GetAllForGuild_ShouldGetServersForTheSameGuild_EvenIfOnDifferentChannels() { IReportServerRepository repo = new ReportServerRepository(GetMysql()); List <ReportServer> repoServers = new List <ReportServer>(); repoServers.Add(await repo.Add(DefaultTestData.SameGuildServers.ElementAt(0), 11u)); repoServers.Add(await repo.Add(DefaultTestData.SameGuildServers.ElementAt(1), 11u)); repoServers.Add(await repo.Add(DefaultTestData.SameGuildServers.ElementAt(2), 22u)); ReportServer differentGuildRepo = await repo.Add(DefaultTestData.DefaultServer, 11u); List <ReportServer> fromRepo = await repo.GetAllForGuild(DefaultTestData.SameGuildServers.First().GuildId); foreach (var r in repoServers) { fromRepo.Single(x => x.ChannelId == r.ChannelId && x.Server.Id == r.Server.Id); } Assert.DoesNotContain(fromRepo, x => x.ChannelId == differentGuildRepo.ChannelId && x.Server.Id == differentGuildRepo.Server.Id); }
public ActionResult GetDependentParameters(ReportExecutionBE reportexecution) { try { string reportPath = reportexecution.ReportPath; List <ReportService.ParameterValue> values = new List <ReportService.ParameterValue>(); for (int i = 0; i < reportexecution.Parameters.Count; ++i) { ReportParameterBE valueList = reportexecution.Parameters[i]; if (valueList.Value != null) { for (int j = 0; j < valueList.Value.Length; ++j) { ReportService.ParameterValue value = new ReportService.ParameterValue(); value.Name = valueList.Name; value.Label = valueList.Label; value.Value = valueList.Value[j]; values.Add(value); } } } ItemParameter[] output = ReportServer.GetItemParameters(HttpContext, reportPath, null, true, values.ToArray(), null); return(Json(output, JsonRequestBehavior.AllowGet)); } catch (SqlException ex) { LoggingHelper.LogException("Unable to generate dependent parameters from report service.", ex); throw; } catch (Exception ex) { LoggingHelper.LogException("Unable to generate dependent parameters from report service.", ex); throw; } }
public ActionResult Report(string reportPath, int headeroption = 1) { var vm = new ReportsModel(); if (!string.IsNullOrEmpty(reportPath)) { UserPrincipal user = GetCurrentPrincipal(); vm = SetReportViewModel(user); vm.ReportPath = reportPath; LoggingHelper.LogInformation("Retrieving Report - " + reportPath); } // getting report service from cache if (ReportServer.IsSessionExpired(HttpContext)) { if (headeroption == 1) { return(RedirectToAction("LogOff", "Account")); } else { var returnUrl = "/Grids?headeroption=2"; return(RedirectToAction("LogOff", "Account", new { returnUrl = returnUrl })); } } //ReportServer rs = new ReportServer(HttpContext); //getting report parameters ItemParameter[] parameters = ReportServer.GetItemParameters(HttpContext, reportPath, null, true, null, null); ViewBag.CurrentUserFirstName = vm.CurrentUserFirstName; ViewBag.CurrentUserLastName = vm.CurrentUserSurName; ViewBag.HeaderOption = headeroption; ViewBag.ReportParameters = parameters; ViewBag.SamAccount = vm.SamAccount; ViewBag.Password = LoginUser.Password; return(View(vm)); }
private ActionResult BuildVoucher(int claimId) { ActionResult result3; try { List <ReportParam> list = new List <ReportParam>(); ReportParam item = new ReportParam { Name = "vClaimList", Value = claimId.ToString() }; list.Add(item); string str = ConfigurationManager.AppSettings["report_PrintVoucher"]; if (string.IsNullOrEmpty(str)) { throw new Exception("report_PrintVoucher is empty"); } ReportResult result = ReportServer.BuildReport(str, ReportFormat.pdf, list.ToArray()); if (result == null) { throw new Exception("report data is empty"); } MemoryStream fileStream = new MemoryStream(result.Content); FileStreamResult result2 = new FileStreamResult(fileStream, "application/pdf") { FileDownloadName = string.Format("voucher_{0}.pdf", claimId) }; result3 = result2; } catch (Exception exception) { Tracing.ServiceTrace.TraceEvent(TraceEventType.Error, 0, exception.ToString()); throw; } return(result3); }
// reportServer=null -> create my own thread; else, use the ReportServer public AsyncActivity(Dictionary <string, object> runParameters, AsynchronousThreadBeginCallback callbackStart, AsynchronousThreadFinishedCallback callbackFinished, bool useBackgroundWoika, ReportServer reportServer) { _callbackFinished = callbackFinished; _callbackStart = callbackStart; _runParameters = runParameters; if (useBackgroundWoika) { ThreadStart threadStart = new ThreadStart(run); Thread thread = new Thread(threadStart); thread.Start(); } else { _BackgroundWorker = new System.ComponentModel.BackgroundWorker(); _BackgroundWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(_BackgroundWorker_DoWork); _BackgroundWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(_BackgroundWorker_RunWorkerCompleted); _BackgroundWorker.RunWorkerAsync(); // reportServer.enqueueReport(this); } }
public ReportServerInfo(ReportServer server) { this.ReportServer = server; }
static void Main1(string[] args) { try { // string key = "设备1"; // Dictionary<string, string> CoorDic = new Dictionary<string, string>(); //List<String> list= RedisList.Get ("robotCoordinate"); // WriteListToTextFile(list, "111.txt"); } catch (Exception ex) { Console.WriteLine(ex.Message); } //AutoTaskServer at= new AutoTaskServer(); //// Console.WriteLine(r.DeviceErrDailyRpt("2018-06-25", "1, 2" ,null)); //at.TaskExec("2018-12-31"); Console.ReadKey(); ReportServer r = new ReportServer(); // Console.WriteLine(r.DeviceErrDailyRpt("2018-06-25", "1, 2" ,null)); // Console.WriteLine(r.DeviceErrDailyRpt("2018-06-25", "1, 2", "HNC-808A",0)); //Console.WriteLine(r.DeviceErrPhaseRpt("2018-06-25", "2018-06-26","1, 2", "HNC-808A", 0)); Console.WriteLine(r.DeviceErrYearRpt("2018", "1, 2", "HNC-808A", 0)); Console.WriteLine(r.DeviceErrYearRpt("2018", "1, 2", "HNC-808A", 1)); Console.ReadKey(); ReportServer ats = new ReportServer(); WorkSataionsServer ws = new WorkSataionsServer(); Console.WriteLine(ats.DeviceDailyRpt("2018-06-25", "1,2", "HNC-808A")); Console.WriteLine(ats.DevicePhaseRpt("2018-06-25", "2018-06-25", "1,2", "HNC-808A")); Console.WriteLine(ats.DeviceMonthRpt("2018-06", "1,2", "HNC-808A")); Console.WriteLine(ats.DeviceYearRpt("2018", "1,2", "HNC-808A")); DevicesServer ds = new DevicesServer(); Console.WriteLine(ds.DeviceModelList()); Console.ReadKey(); string connstr = @"Host=47.96.172.122;UserName=huabao;Password=huabao2025;Database=huabao;Port=3306;CharSet=utf8;Allow Zero Datetime=true"; using (MySqlConnection connection = new MySqlConnection(connstr)) { if (connection.State != ConnectionState.Open) { connection.Open(); } string sql = "update getpics set getpicstime=@getpicstime where id=260"; MySqlCommand cmd = new MySqlCommand(sql, connection); cmd.Parameters.AddWithValue("@getpicstime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); cmd.ExecuteNonQuery(); } }
public ActionResult Index(int headeroption = 1) { LoggingHelper.LogInformation("User goes to the report page..."); var vm = new ReportsModel(); ReportHelper rptHelper = new ReportHelper(); if (ReportServer.IsSessionExpired(HttpContext)) { if (headeroption == 1) { return(RedirectToAction("LogOff", "Account")); } else { var returnUrl = "/Grids?headeroption=2"; return(RedirectToAction("LogOff", "Account", new { returnUrl = returnUrl })); } } ReportServer rs = new ReportServer(HttpContext); UserPrincipal user = GetCurrentPrincipal(); if (user != null) { vm = SetReportViewModel(user); try { vm.ReportDirectoryHierarchy = rptHelper.CreateReportDirectoryHierarchy(rs.CatalogItems.ToList(), HttpContext); } catch (ArgumentNullException Ex) { LoggingHelper.LogException("No reports found", Ex); } catch (Exception Ex) { LoggingHelper.LogException(Ex); } } else { throw new Exception("Unable to determine User Principal"); } ViewBag.CurrentUserFirstName = vm.CurrentUserFirstName; ViewBag.CurrentUserLastName = vm.CurrentUserSurName; ViewBag.HeaderOption = headeroption; try { var filepath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConfigurationManager.AppSettings["CompanyName"]); using (var stream = new StreamReader(filepath)) { ViewBag.CompanyName = stream.ReadToEnd(); } } catch (Exception exc) { return(Content(exc.Message)); } return(View(vm)); }
//------------------------------------------------------------- // Write - write record to repository //------------------------------------------------------------- public void Write() { // Open connection to repository and save reports record. logX.loggerX.Info("Update Reports Record"); try { using (SqlConnection connection = new SqlConnection(Program.gController.Repository.ConnectionString)) { // Open the connection. connection.Open(); // setup parameters SqlParameter paramReportServer = new SqlParameter(ParamReportServer, SqlHelper.CreateSafeString(ReportServer.Trim(), false)); SqlParameter paramServerDir = new SqlParameter(ParamServerDir, SqlHelper.CreateSafeString(ReportServerDirectory.Trim(), false)); SqlParameter paramManagerDir = new SqlParameter(ParamcManagerDir, SqlHelper.CreateSafeString(ReportManagerDirectory.Trim(), false)); SqlParameter paramPort = new SqlParameter(ParamPort, Port); SqlParameter paramSsl = new SqlParameter(ParamSsl, UseSsl); SqlParameter paramUserName = new SqlParameter(ParamUserName, SqlHelper.CreateSafeString(UserName.Trim(), false)); SqlParameter paramRepository = new SqlParameter(ParamRepository, SqlHelper.CreateSafeString(Repository.Trim(), false)); SqlParameter paramTargetDir = new SqlParameter(ParamTargetDir, SqlHelper.CreateSafeString(TargetDirectory.Trim(), false)); // Execute stored procedure and get the users. using (SqlCommand cmd = new SqlCommand(QueryUpdateReport, connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(paramReportServer); cmd.Parameters.Add(paramServerDir); cmd.Parameters.Add(paramManagerDir); cmd.Parameters.Add(paramPort); cmd.Parameters.Add(paramSsl); cmd.Parameters.Add(paramUserName); cmd.Parameters.Add(paramRepository); cmd.Parameters.Add(paramTargetDir); cmd.ExecuteNonQuery(); } } } catch (Exception ex) { logX.loggerX.Error("Unable to save Reports Record", ex); Utility.MsgBox.ShowError(Utility.ErrorMsgs.ReportsCaption, Utility.ErrorMsgs.CantSaveReportsRecord, ex); } }