public static List <skReport> GetReports(string ReportBaseURI) { var retunrlist = new List <skReport>(); var ReportClient = new ReportClient(); try { ReportClient.Open(); var ReportContract = ReportClient.GetReports(ReportBaseURI); foreach (ReportFolder RF in ReportContract.ReporFolders.Where(x => x.DisplayName != "" && x.DisplayName != "Data Sources")) { var folder = new skReport() { FolderName = RF.DisplayName }; foreach (ReportLink RL in ReportContract.ReportLinks.Where(x => x.ReportParentID == RF.FolderId)) { folder.Reports.Add(RL); } retunrlist.Add(folder); } return(retunrlist); } finally { ReportClient.Close(); } }
public ActionResult LoadNoOfLateReport(string Name, string FromDate, string ToDate, bool IsLeaveOnly, bool OnlyReportedToMe, string reqUsr, bool DonotShowRejected) { List <NoOfLateInMonth> noOfLateInMonth = null; if (Name != "") { Name = Name.Replace("|", " "); } DateTime startDateFormatted = DateTime.Now; DateTime endDateFormatted = DateTime.Now; if (FromDate != null) { if (FromDate.Trim() != "") { startDateFormatted = DateTime.ParseExact(FromDate, "d-M-yyyy", CultureInfo.InvariantCulture); endDateFormatted = DateTime.ParseExact(ToDate, "d-M-yyyy", CultureInfo.InvariantCulture); } } if (FromDate == "" || ToDate == "") { startDateFormatted = System.DateTime.Now.Date; endDateFormatted = System.DateTime.Now.Date; } ReportClient reportClient = new ReportClient(); { noOfLateInMonth = reportClient.GetLateReport(this.UserId, startDateFormatted, endDateFormatted, OnlyReportedToMe); } return(PartialView("NoOfLateReportRptPartial", noOfLateInMonth)); }
protected ReportResponse Toggle(ReportRequest request) { ReportResponse response = new ReportResponse(); if (string.IsNullOrEmpty(request.ToggleId)) { response.Status = 2; response.Message = "The ToggleId can not be empty."; return(response); } try { ReportExecuteResult result = new ReportExecuteResult(); LoadReport(request, ref result); var s = ReportClient.ToggleItemAsync(new ToggleItemRequest(request.ToggleId)).GetAwaiter().GetResult(); if (s.Found) { Render(request, ref result); GetPageNumber(request, ref result); response.Data = SetData(result); response.Data.Contents = GetContent(result.Stream, ReportSettings.ShowToolBar); } else { response.Status = 5; response.Message = "Toggle: not found item"; } } catch (Exception ex) { response.Status = 1; response.Message = "Toggle:" + ex.Message; } return(response); }
/// <summary> /// step 4 /// </summary> /// <param name="result"></param> protected void GetPageNumber(ReportRequest rRequest, ref ReportExecuteResult result) { try { Versions.TryGetValue(this.ReportSettings.ReportServer, out Version version); if (version.Major <= SuportExportVersion) { var request = new GetExecutionInfo2Request(); var response = ReportClient.GetExecutionInfo2Async(request).GetAwaiter().GetResult(); result.PageCount = response.executionInfo.NumPages; result.PageIndex = rRequest.PageIndex; result.SessionId = rRequest.SessionId = ReportClient.ExecutionHeader.ExecutionID = response.executionInfo.ExecutionID; } else { var request = new GetExecutionInfo3Request(); var response = ReportClient.GetExecutionInfo3Async(request).GetAwaiter().GetResult(); result.PageCount = response.executionInfo.NumPages; result.PageIndex = rRequest.PageIndex; result.SessionId = rRequest.SessionId = ReportClient.ExecutionHeader.ExecutionID = response.executionInfo.ExecutionID; } } catch (Exception ex) { throw new ReportException("GetPageNumber error: " + ex.Message, ex); } }
public JMessageClient(string appKey, string masterSecret) { if (string.IsNullOrEmpty(appKey)) { throw new ArgumentNullException(nameof(appKey)); } if (string.IsNullOrEmpty(masterSecret)) { throw new ArgumentNullException(nameof(masterSecret)); } AppKey = appKey; MasterSecret = masterSecret; var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes(appKey + ":" + masterSecret)); HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); User = new UserClient(); Message = new MessageClient(); Group = new GroupClient(); Report = new ReportClient(appKey, masterSecret); Chatroom = new ChatroomClient(); }
/// <summary> /// 带两个参数的构造函数,该状态下,ApnsProduction默认为true /// </summary> /// <param name="app_key">Portal上产生的app_key</param> /// <param name="masterSecret">你的API MasterSecret</param> public JPushClient(String app_key, String masterSecret) { HashSet <DeviceEnum> devices = new HashSet <DeviceEnum>(); devices.Add(DeviceEnum.IOS); devices.Add(DeviceEnum.Android); _pushClient = new PushClient(masterSecret, app_key, MessageParams.NO_TIME_TO_LIVE, null, true); _reportClient = new ReportClient(app_key, masterSecret); }
protected ReportResponse FindString(ReportRequest request) { ReportResponse response = new ReportResponse(); if (string.IsNullOrEmpty(request.FindString)) { response.Status = 2; response.Message = "Search value can not be empty."; return(response); } try { ReportExecuteResult result = new ReportExecuteResult(); LoadReport(request, ref result); Render(request, ref result); GetPageNumber(request, ref result); var request0 = new FindStringRequest { FindValue = request.FindString, StartPage = request.PageIndex, EndPage = result.PageCount }; var response0 = ReportClient.FindStringAsync(request0).GetAwaiter().GetResult(); if (response0.PageNumber > 0) { result.PageIndex = request.PageIndex = response0.PageNumber; } else { if (request.PageIndex > 1) { request0.StartPage = 1; } response0 = ReportClient.FindStringAsync(request0).GetAwaiter().GetResult(); if (response0.PageNumber < 1) { response.Status = 23; response.Message = "The Find Text not found in the report"; return(response); } else { result.PageIndex = request.PageIndex = response0.PageNumber; } } Render(request, ref result); response.Data = SetData(result); response.Data.Contents = GetContent(result.Stream, ReportSettings.ShowToolBar); } catch (Exception ex) { response.Status = 1; response.Message = ex.Message; } return(response); }
static void Main(string[] args) { Client = new ReportClient("http://desktop-51p1738/ReportServer_SSRS"); //GetReportTest(); GetReportNamesWithPaths(); Console.ReadKey(); }
public ActionResult Index() { var model = new ReportViewModel(); var reportTypeClient = new ReportClient(); model.ReportTypes = reportTypeClient.GetReportTypes(); var expenseTypeClient = new ExpenseDataClient(_url); model.ExpenseTypes = expenseTypeClient.GetExpenseTypes(); return(View("GetReport", model)); }
static void Main(string[] args) { ConsoleKeyInfo ck; using (var client = new ReportClient("127.0.0.1", 990)) { // client.Start(); do { ck = Console.ReadKey(); } while (ck.Key != ConsoleKey.Escape); } }
private void getValuesFromDatabase() { try { switch ((ReportTypes)cmbReport.SelectedItem) { case ReportTypes.vehicle: ReportHolder.vehicleReports = ReportClient.GetVehicleReport(dtpFrom.Value, dtpTo.Value); break; case ReportTypes.worker: ReportHolder.workerReports = ReportClient.GetWorkerReport(dtpFrom.Value, dtpTo.Value); break; case ReportTypes.route: ReportHolder.routeDisplays = RouteHelper.makeRoutesDisplayable( DeliveryClient.GetRoutes()) .FindAll((elem) => elem.startDate.Date >= dtpFrom.Value.Date && elem.startDate <= dtpTo.Value.Date); break; case ReportTypes.received: ReportHolder.receiveReports = ReportClient.GetReceiveReport(dtpFrom.Value, dtpTo.Value); break; case ReportTypes.intermediateWarehouse: ReportHolder.iWReports = ReportClient.GetIWReport(dtpFrom.Value, dtpTo.Value); break; case ReportTypes.returned: ReportHolder.returnReports = ReportClient.GetReturnToSupplierReport(dtpFrom.Value, dtpTo.Value); break; case ReportTypes.writeOff: ReportHolder.writeOffReports = ReportClient.GetWriteOffReport(dtpFrom.Value, dtpTo.Value); break; default: break; } } catch (Exception) { MessageBox.Show("Failed to get values from database"); } }
/// <summary> /// step 2. /// </summary> protected void SetParameters(ReportRequest rRequest, ReportExecuteResult result) { if (result.ParametersRequired && rRequest.Parameters.Count == 0) { throw new ReportException("The report parameters is required."); } try { var paramenters = rRequest.Parameters.Select(t => new ParameterValue { Name = t.Key, Value = t.Value }).ToArray(); var request = new SetExecutionParametersRequest(paramenters, "en-us"); var response = ReportClient.SetExecutionParametersAsync(request).GetAwaiter().GetResult(); result.SessionId = rRequest.SessionId = response.executionInfo.ExecutionID; } catch (Exception ex) { throw new ReportException("SetParameters error: " + ex.Message, ex); } }
/// <summary> /// step 3. /// </summary> /// <param name="result"></param> protected void Render(ReportRequest rRequest, ref ReportExecuteResult result, string findString = null) { try { var deviceInfo = GenerateDeviceInfo(rRequest); string format; Versions.TryGetValue(this.ReportSettings.ReportServer, out Version version); switch (rRequest.RenderType) { case ReportRenderType.Html4_0: format = "Html4.0"; break; case ReportRenderType.ExcelOpenXml: if (version.Major < SuportExportVersion) { format = ReportRenderType.Excel.ToString(); } else { format = ReportRenderType.ExcelOpenXml.ToString(); } break; case ReportRenderType.WordOpenXml: if (version.Major < SuportExportVersion) { format = ReportRenderType.Word.ToString(); } else { format = ReportRenderType.WordOpenXml.ToString(); } break; default: format = rRequest.RenderType.ToString(); break; } var strDeviceInfo = deviceInfo.ToString(); //strDeviceInfo = @"<DeviceInfo><HTMLFragment>true</HTMLFragment><Section>0</Section></DeviceInfo>"; var request = new Render2Request(format, strDeviceInfo, ReportExecutionService.PageCountMode.Actual); var response = ReportClient.Render2Async(request).GetAwaiter().GetResult(); if (rRequest.RenderType == ReportRenderType.Html4_0 || rRequest.RenderType == ReportRenderType.Html5) { StringBuilder sb = new StringBuilder(Encoding.UTF8.GetString(response.Result)); Regex reg = new Regex("(<img [^>]*? src=\"([^\"]+&rs%3AImageID=([^\"']+))\")", RegexOptions.IgnoreCase); var matchs = reg.Match(sb.ToString()); while (matchs.Success) { var a = matchs.Result("$1"); var b = matchs.Result("$2"); var c = matchs.Result("$3"); var cc = ReportClient.RenderStreamAsync(new RenderStreamRequest(format, c, strDeviceInfo)).GetAwaiter().GetResult(); var img = $"data:{cc.MimeType};base64,{Convert.ToBase64String(cc.Result)}"; var aa = a.Replace(b, img); sb.Replace(a, aa); matchs = matchs.NextMatch(); } result.Contents = sb.ToString(); } result.Stream = response.Result; result.Encoding = response.Encoding; result.Extension = response.Extension; result.MimeType = response.MimeType; } catch (Exception ex) { throw new ReportException("Render error: " + ex.Message, ex); } }
/// <summary> /// step 1 /// </summary> protected void LoadReport(ReportRequest request, ref ReportExecuteResult result) { if (string.IsNullOrEmpty(request.Path)) { throw new ReportException("Please set ReportPath to execute."); } try { if (!string.IsNullOrEmpty(request.SessionId)) { try { if (request.Reset) { var r = ReportClient.ResetExecutionAsync(new ResetExecutionRequest()).GetAwaiter().GetResult(); result.SessionId = r.executionInfo.ExecutionID; } ReportClient.ExecutionHeader.ExecutionID = request.SessionId; var rr = ReportClient.GetExecutionInfoAsync(new GetExecutionInfoRequest()).GetAwaiter().GetResult(); } catch { request.SessionId = null; } } if (string.IsNullOrEmpty(request.SessionId)) { LoadReportRequest request0 = new LoadReportRequest(request.Path, null); LoadReportResponse response = ReportClient.LoadReportAsync(request0).GetAwaiter().GetResult(); try { var match = VersionRegex.Match(response.ServerInfoHeader.ReportServerVersion); if (match.Success) { Versions.TryAdd(this.ReportSettings.ReportServer, Version.Parse(match.Result("$1"))); } } catch { } result.ParametersRequired = response.executionInfo.ParametersRequired; var dict = new Dictionary <string, string>(response.executionInfo.Parameters.Length); if (response.executionInfo.Parameters.Length > 0) { foreach (var p in response.executionInfo.Parameters) { if (p.DefaultValues != null && p.DefaultValues.Length > 0) { dict[p.Name] = p.DefaultValues.SingleOrDefault(); } if (request.Parameters.ContainsKey(p.Name)) { dict[p.Name] = request.Parameters[p.Name]; } } } request.Parameters = dict; result.SessionId = request.SessionId = response.executionInfo.ExecutionID; //ReportClient.ToggleItemAsync() SetParameters(request, result); } } catch (Exception ex) { throw new ReportException("LoadReport error: " + ex.Message, ex); } }
/// <summary> /// Initializes a new instance of the <see cref="IssuedTaxDocumentReport"/> class. /// </summary> /// <param name="client">Client.</param> public IssuedTaxDocumentReport(ReportClient client) : base(client, Enums.ReportDocumentType.IssuedTaxDocument) { }
/// <summary> /// Initializes a new instance of the <see cref="IssuedInvoiceDetailReport"/> class. /// </summary> /// <param name="invoiceId">Id.</param> /// <param name="client">Client.</param> /// <param name="documentType">Document type.</param> public IssuedInvoiceDetailReport(int invoiceId, ReportClient client, ReportDocumentType documentType) : base(invoiceId, client, documentType) { }
public static void GetCallCosts(string accessToken, string userID) { if (string.IsNullOrEmpty(userID)) { Console.WriteLine("The userID parameter cannot be null or empty"); return; } if (string.IsNullOrEmpty(accessToken)) { Console.WriteLine("The access token cannot be null or empty!"); return; } ServicePointManager.ServerCertificateValidationCallback += delegate(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return(true); }; ServicePointManager.Expect100Continue = false; userCredentials credentials = new userCredentials() { accessToken = accessToken }; CallCosts request = CreateCallCostsRequest(userID); CallCostsResponse response = new CallCostsResponse(); ReportClient reportClient = new ReportClient("ReportPort"); Console.WriteLine("Getting the call costs for the user with the id = {0}", userID); try { reportClient.CallCosts(credentials, request, out response); } catch (Exception e) { //exception found, so we check the stack trc String trace = e.StackTrace; //write the stack trace to the console Console.WriteLine("{0} Exception caught.", e); //wait for the user to press a key before closing the console Console.Read(); } finally { Console.WriteLine("The operation response:"); foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(response)) { string name = descriptor.Name; object value = descriptor.GetValue(response); Console.WriteLine("\t{0}={1}", name, value); } Console.WriteLine(); } }
/// <summary> /// Initializes a new instance of the <see cref="SalesOrderDetailReport"/> class. /// </summary> /// <param name="id">Id.</param> /// <param name="client">Report client.</param> public SalesOrderDetailReport(int id, ReportClient client) : base(id, client, ReportDocumentType.SalesOrder) { }
/// <summary> /// JPushClient构造函数,可指定 /// </summary> /// <param name="app_key">Portal上产生的app_key</param> /// <param name="masterSecret">你的API MasterSecret</param> /// <param name="time_to_live">有效期</param> /// <param name="platform">目标推送平台</param> /// <param name="apnsProduction">是否iOS生产环境 - true为生产环境,false为开发环境</param> public JPushClient(String app_key, String masterSecret, int time_to_live, HashSet <DeviceEnum> platform, bool apnsProduction) { _pushClient = new PushClient(masterSecret, app_key, time_to_live, platform, apnsProduction); _reportClient = new ReportClient(app_key, masterSecret); }
/// <summary> /// Initializes a new instance of the <see cref="ReportBaseDetail" /> class. /// </summary> /// <param name="id">Id.</param> /// <param name="client">Report client.</param> /// <param name="documentType">Document type.</param> public ReportBaseDetail(int id, ReportClient client, ReportDocumentType documentType) { Client = client; _id = id; _documentType = documentType; }
public JPushClient(string app_key, string masterSecret) { this._pushClient = new PushClient(app_key, masterSecret); this._reportClient = new ReportClient(app_key, masterSecret); this._deviceClient = new DeviceClient(app_key, masterSecret); }
/// <summary> /// Initializes a new instance of the <see cref="ReceivedInvoiceReport"/> class. /// </summary> /// <param name="client">Client.</param> public ReceivedInvoiceReport(ReportClient client) : base(client, ReportDocumentType.ReceivedInvoice) { }
/// <summary> /// Initializes a new instance of the <see cref="IssuedInvoiceReport"/> class. /// </summary> /// <param name="client">Client.</param> /// <param name="documentType">Document type.</param> public IssuedInvoiceReport(ReportClient client, ReportDocumentType documentType) { _client = client; _documentType = documentType; }
/// <summary> /// Initializes a new instance of the <see cref="SalesReceiptReport"/> class. /// </summary> /// <param name="client">Client.</param> public SalesReceiptReport(ReportClient client) : base(client, ReportDocumentType.SalesReceipt) { }
/// <summary> /// Initializes a new instance of the <see cref="Report"/> class. /// </summary> /// <param name="client">Client.</param> /// <param name="documentType">Document type.</param> public Report(ReportClient client, ReportDocumentType documentType) { Client = client; _documentType = documentType; }
/// <summary> /// Initializes a new instance of the <see cref="SalesOrderReport"/> class. /// </summary> /// <param name="client">Client.</param> public SalesOrderReport(ReportClient client) : base(client, ReportDocumentType.SalesOrder) { }
/// <summary> /// Initializes a new instance of the <see cref="CashVoucherReport"/> class. /// </summary> /// <param name="client">Client.</param> public CashVoucherReport(ReportClient client) : base(client, ReportDocumentType.CashVoucher) { }
private void BtnOk_Click(object sender, EventArgs e) { this.CalcQty(null, null); var wo = new WorkOrderDAL().GetModel(card.M.WOGuid); //是否母件 if (wo.Grade == 0) { //所有子件卡是否完工 if (!dal.ChildCardAllComplete(wo.U8Modid)) { throw new Exception("存在未完工的零件流转卡, 不能报工!"); } } var cardD = card.M.curOperation; if (cardD.hgQty <= 0) { throw new Exception("合格数量不能小于等0"); } else if (string.IsNullOrEmpty(cardD.cWorker)) { throw new Exception("操作工不能为空!"); } //检验报工数量, 不能大于上道 if (cardD.OpSeq != "0010") { var preOperation = card.DList.FindLast(x => Convert.ToInt32(x.OpSeq) < Convert.ToInt32(cardD.OpSeq)); var preQty = preOperation.hgQty + preOperation.bhgQty; if (cardD.hgQty + cardD.bhgQty > preQty) { throw new Exception("当前工序报工数量不能大于上道报工数量(" + preQty + ")"); } } if (!string.IsNullOrEmpty(txt_worker.Text.Trim())) { this.GetPerson(txt_worker.Text.Trim()); } cardD.cRepPsn = Information.UserInfo.cUser_Name; //报工 var u8rdid = new ReportClient().ReportOP(cardD); if (!string.IsNullOrEmpty(u8rdid)) { MsgBox.ShowInfoMsg("已生成产品入库单, ID: " + u8rdid); } //var wo = new WorkOrderDAL().Get(cardM.WOGuid); //if (wo.Grade == 0) //{ // if (!cardM.bChild && !dal.HaveNextOpSeq(cardD.CardNo, cardD.OpSeq)) // { // string id = new U8API.U8OperationClient().ProductIn(cardM.CardNo, cardD.OpSeq); // MsgBox.ShowInfoMsg("已生成产品入库单, ID: " + id); // } //} this.DialogResult = DialogResult.OK; }
/// <summary> /// 带两个参数的构造函数,该状态下,ApnsProduction默认为false /// </summary> /// <param name="app_key">Portal上产生的app_key</param> /// <param name="masterSecret">你的API MasterSecret</param> public JPushClient(String app_key, String masterSecret) { _pushClient = new PushClient(app_key, masterSecret); _reportClient = new ReportClient(app_key, masterSecret); _deviceClient = new DeviceClient(app_key, masterSecret); }
/// <summary> /// Initializes a new instance of the <see cref="ReportDetail"/> class. /// </summary> /// <param name="invoiceId">Id.</param> /// <param name="client">Client.</param> /// <param name="documentType">Document type.</param> public ReportDetail(int invoiceId, ReportClient client, ReportDocumentType documentType) : base(invoiceId, client, documentType) { }