private void btnProcessReport_Click(object sender, EventArgs e) { var instanceContext = new InstanceContext(this); var client = new ReportServiceClient(instanceContext); client.ProcessReport(); }
/// <summary> /// check if app is up to date /// </summary> /// <param name="latestVerLink"></param> /// <returns></returns> public bool IsUpToDate(out string latestVerLink) { string currVersion = CfgFile.Get("Version"); BasicHttpBinding binding = new BasicHttpBinding(); EndpointAddress address = new EndpointAddress("http://service.freemiumlab.com/ReportService.svc"); ReportServiceClient client = new ReportServiceClient(binding, address); string[] latestVersion; try { latestVersion = client.GetLatestVersion(); client.Close(); } catch { latestVerLink = string.Empty; return true; } latestVerLink = latestVersion[1]; return latestVersion[0] == currVersion; }
/// <summary> /// Handles send button click event to send bug details to the server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnSend_Click(object sender, EventArgs e) { // OS info string os = Environment.OSVersion.VersionString; if (Is64Bit()) os += " 64-bit"; else os += " 32-bit"; // MAC address string mac = String.Empty; NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface intrfce in interfaces) { mac = intrfce.GetPhysicalAddress().ToString(); if (!string.IsNullOrEmpty(mac)) break; } // IP address IPHostEntry ipEntry = Dns.GetHostEntry(Dns.GetHostName()); string ip = ipEntry.AddressList[0].ToString(); // Host name string hostName = Dns.GetHostName(); string stackTraceTrimmed; try { // Bug stack trace int trimLimit = Program.BugStackTrace.IndexOf("line"); stackTraceTrimmed = Program.BugStackTrace.Substring(0, trimLimit + 10); } catch (Exception) { stackTraceTrimmed = Program.BugStackTrace.Length > 100 ? Program.BugStackTrace.Substring(0, 100) : Program.BugStackTrace; } // Hide window ShowInTaskbar = false; Hide(); // Submit report var binding = new BasicHttpBinding(); var address = new EndpointAddress("http://service.freemiumlab.com/ReportService.svc"); ReportServiceClient client = null; try { client = new ReportServiceClient(binding, address); } catch { // MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException); } try { string str_ver = String.Empty; string str_mac = String.Empty; string str_ip = String.Empty; string str_os = String.Empty; string str_host = String.Empty; string str_stacktrace = String.Empty; string str_bugtype = String.Empty; string str_bugmsg = String.Empty; string str_userinput = String.Empty; string str_target = String.Empty; string str_source = String.Empty; try { if (Program.Version.Length > 0) str_ver = Program.Version; } catch { } try { if (mac.Length > 0) str_mac = mac; } catch { } try { if (ip.Length > 0) str_ip = ip; } catch { } try { if (os.Length > 0) str_os = os; } catch { } try { if (hostName.Length > 0) str_host = hostName; } catch { } try { if (stackTraceTrimmed.Length > 0) str_stacktrace = stackTraceTrimmed; } catch { } try { if (Program.BugType.Length > 0) str_bugtype = Program.BugType; } catch { } try { if (Program.BugMessage.Length > 0) str_bugmsg = Program.BugMessage; } catch { } try { if (txtContext.Text.Length > 0) str_userinput = txtContext.Text; } catch { } try { if (Program.BugTargetSite.Length > 0) str_target = Program.BugTargetSite; } catch { } try { if (Program.BugSource.Length > 0) str_source = Program.BugSource; } catch { } client.SubmitBugReport( str_ver, str_mac, str_ip, str_os, str_host, str_stacktrace, str_bugtype, str_bugmsg, str_userinput, str_target, str_source ); } catch { // MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException); } client.Close(); // Close program Application.Exit(); }
private void btnSend_Click(object sender, EventArgs e) { // OS info var os = Environment.OSVersion.VersionString; if (Is64Bit()) os += " 64-bit"; else os += " 32-bit"; // MAC address var mac = ""; var interfaces = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface intrfce in interfaces) { mac = intrfce.GetPhysicalAddress().ToString(); if (!string.IsNullOrEmpty(mac)) break; } // IP address var ipEntry = Dns.GetHostEntry(Dns.GetHostName()); var ip = ipEntry.AddressList[0].ToString(); // Host name var hostName = Dns.GetHostName(); string stackTrace = ""; try { stackTrace = GZipStreamStringHelper.Zip(Program.BugStackTrace); } catch { } // Hide window ShowInTaskbar = false; Hide(); // Submit report var binding = new BasicHttpBinding(); var address = new EndpointAddress("http://driverservice.freemiumlab.com/ReportService.svc"); //EndpointAddress address = new EndpointAddress("http://localhost:12758/ReportService.svc"); ReportServiceClient client = null; try { client = new ReportServiceClient(binding, address); } catch (Exception ex) { // MessageBox.Show(ex.Message + " " + ex.Source + " " + ex.InnerException); } try { string str_ver = ""; string str_mac = ""; string str_ip = ""; string str_os = ""; string str_host = ""; string str_stacktrace = ""; string str_bugtype = ""; string str_bugmsg = ""; string str_userinput = ""; string str_target = ""; string str_source = ""; try { if (Program.Version.Length > 0)str_ver = Program.Version; } catch { } try { if (mac.Length > 0)str_mac = mac; } catch { } try { if (ip.Length > 0)str_ip = ip; } catch { } try { if (os.Length > 0)str_os = os; } catch { } try { if (hostName.Length > 0)str_host = hostName; } catch { } try { if (stackTrace.Length > 0)str_stacktrace = stackTrace; } catch { } try { if (Program.BugType.Length > 0)str_bugtype = Program.BugType; } catch { } try { if (Program.BugMessage.Length > 0)str_bugmsg = Program.BugMessage; } catch { } try { if (txtContext.Text.Length > 0)str_userinput = txtContext.Text; } catch { } try { if (Program.BugTargetSite.Length > 0)str_target = Program.BugTargetSite; } catch { } try { if (Program.BugSource.Length > 0)str_source = Program.BugSource; } catch { } client.SubmitBugReport( str_ver, str_mac, str_ip, str_os, str_host, str_stacktrace, str_bugtype, str_bugmsg, str_userinput, str_target, str_source ); client.SubmitNormalReport( str_ver, str_userinput, str_mac, str_ip, str_os, str_host); } catch { } client.Close(); // Close program Application.Exit(); }
public void sendReports() { ReportServiceClient rclient = new ReportServiceClient(); DailyReport dr = new DailyReport(); dr.Date = DateTime.Now.Date; FuelItem[] prchs=getFuelOrders(); FuelData[] purchase = new FuelData[2]; purchase[0] = new FuelData(); purchase[1] = new FuelData(); for (int i = 0; i < prchs.Length; i++) { if(prchs[i]!=null && prchs[i].Date==dr.Date) { int ind = 1; if (prchs[i].Type == "unleaded") ind = 0; purchase[ind].FuelType = prchs[i].Type; purchase[ind].Quantity += prchs[i].Amount; purchase[ind].Value += prchs[i].Value; } } dr.Purchases = purchase; FuelItem[] sl = getSaleData(); FuelData[] sales=new FuelData[2]; sales[0] = new FuelData(); sales[1] = new FuelData(); for (int i = 0; i < sl.Length; i++) { if (sl[i] != null && sl[i].Date == dr.Date) { int ind = 1; if (sl[i].Type == "unleaded") ind = 0; sales[ind].FuelType = sl[i].Type; sales[ind].Quantity = sl[i].Amount; sales[ind].Value = sl[i].Value; } } dr.Sales = sales; rclient.SendDailyReport(dr); }
public ReportServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(ReportServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public ReportServiceClient(EndpointConfiguration endpointConfiguration) : base(ReportServiceClient.GetBindingForEndpoint(endpointConfiguration), ReportServiceClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public ReportServiceClient() : base(ReportServiceClient.GetDefaultBinding(), ReportServiceClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.NetTcpEndpoint.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public Form1() { InitializeComponent(); client = new ReportServiceClient("NetTcpBinding_IReportService"); }
private static void Static(WeakEventListener<ReportViewerViewModel, ReportServiceClient, RenderAndCacheEventArgs> listener, ReportServiceClient source) { source.RenderAndCacheCompleted -= listener.OnEvent; }
/// <summary> /// Creates a new instance of <see cref="T:Telerik.Reporting.Service.SilverlightClient.ReportServiceClient" />. /// </summary> /// <param name="remoteAddress">The absolute address of the service.</param> /// <returns>A new instance of <see cref="T:Telerik.Reporting.Service.SilverlightClient.ReportServiceClient" />.</returns> /// <seealso cref="P:Telerik.ReportViewer.Silverlight.ReportViewer.ReportServiceClientFactory" /> /// <remarks>For additional information and example see <see cref="P:Telerik.ReportViewer.Silverlight.ReportViewer.ReportServiceClientFactory" />.</remarks> public ReportServiceClient Create(Uri remoteAddress) { var securityMode = remoteAddress != null && remoteAddress.ToString().StartsWith("https", StringComparison.Ordinal) ? BasicHttpSecurityMode.Transport : BasicHttpSecurityMode.None; var binding = new BasicHttpBinding(securityMode) { CloseTimeout = TimeSpan.FromMinutes(5), OpenTimeout = TimeSpan.FromMinutes(5), ReceiveTimeout = TimeSpan.FromMinutes(5), SendTimeout = TimeSpan.FromMinutes(5), MaxBufferSize = 2147483647, MaxReceivedMessageSize = 2147483647, TransferMode = TransferMode.Buffered, }; var endpointAddress = new EndpointAddress(remoteAddress); var client = new ReportServiceClient(binding, endpointAddress); var weakListener = new WeakEventListener<ReportViewerViewModel, ReportServiceClient, RenderAndCacheEventArgs>(this, client); client.RenderAndCacheCompleted += weakListener.OnEvent; weakListener.OnEventAction += OnReportServiceClientRenderAndCacheCompleted; weakListener.OnDetachAction += Static; return client; }