protected void Button1_Click(object sender, EventArgs e) { ReportExecutionService reportExecutionService = new ReportExecutionService(); // Web Service proxy reportExecutionService.Credentials = new NetworkCredential("reportservice", "Asdfghjkl?", "kswh107"); string reportPath = "/ReconCurrent/ReconInvest"; string format = "PDF"; // Render arguments byte[] result = null; string historyID = null; string encoding; string mimeType; string extension; Warning[] warnings = null; string[] streamIDs = null; ParameterValue[] parameters = new ParameterValue[4]; parameters[0] = new ParameterValue(); parameters[0].Name = "StartDate"; parameters[1] = new ParameterValue(); parameters[1].Name = "EndDate"; parameters[2] = new ParameterValue(); parameters[2].Name = "IsinCode"; parameters[3] = new ParameterValue(); parameters[3].Name = "AccountNumber"; ExecutionInfo execInfo = new ExecutionInfo(); ExecutionHeader execHeader = new ExecutionHeader(); reportExecutionService.ExecutionHeaderValue = execHeader; execInfo = reportExecutionService.LoadReport(reportPath, historyID); String SessionId = reportExecutionService.ExecutionHeaderValue.ExecutionID; parameters[0].Value = DatePickerBegin.SelectedDate.ToShortDateString(); parameters[1].Value = DatePickerEnd.SelectedDate.ToShortDateString(); parameters[3].Value = ddlAccount.SelectedValue.ToString(); parameters[2].Value = ddlInstrument.SelectedValue.ToString(); reportExecutionService.SetExecutionParameters(parameters, "nl-nl"); result = reportExecutionService.Render(format, null, out extension, out encoding, out mimeType, out warnings, out streamIDs); Response.ClearContent(); Response.AppendHeader("content-length", result.Length.ToString()); Response.ContentType = "application/pdf"; Response.BinaryWrite(result); Response.End(); //Response.Flush(); //Response.Close(); }
public bool Evaluate(ParameterValue o, EvaluationContext context) { if (Disjunction) { return Left.Evaluate(o, context) || Right.Evaluate(o, context); } else { return Left.Evaluate(o, context) && Right.Evaluate(o, context); } }
public string FormatValue(ParameterValue value, EvaluationContext context) { if (value.DefaultFormat != null) { return value.DefaultFormat.FormatValue(value, context); } else { return string.Format(context.Language.Culture, "{0}", value.Value); } }
private static ParameterValueOrFieldReference[] setPassword(ParameterValueOrFieldReference[] parameterValueOrFieldReference) { ParameterValue[] paramVals = new ParameterValue[parameterValueOrFieldReference.Length + 1]; for (int i = 0; i < parameterValueOrFieldReference.Length; i++) { paramVals[i] = (ParameterValue)parameterValueOrFieldReference[i]; } paramVals[parameterValueOrFieldReference.Length] = new ParameterValue(); paramVals[parameterValueOrFieldReference.Length].Name = "PASSWORD"; paramVals[parameterValueOrFieldReference.Length].Value = "pass"; return paramVals; }
public bool Evaluate(ParameterValue o, EvaluationContext context) { var pattern = (string) Evaluator.GetValue(context).Value; if (!string.IsNullOrEmpty(pattern)) { return Dialect.GetSwitchConditionEvaluator(Expression.Text(pattern), Evaluator.Manager).Evaluate(o, context); } else { throw new LocalizedKeyNotFoundException( "Exceptions.LookupConditionParameterNotResolved", "The condition '{0}' could not be resolved", new { Key = Evaluator.PatternKey }); } }
public bool Evaluate(ParameterValue o, EvaluationContext context) { try { double n = Convert.ToDouble(o.Value); foreach (var rhs in Operations) { n = n.Evaluate(rhs.Number, rhs.Operator); } return n.CompareTo(TargetValue, CompareOperator); } catch { return false; } }
public string FormatValue(ParameterValue value, EvaluationContext context) { var s = "" + value.Value; if (!string.IsNullOrEmpty(s)) { switch (TransformationType) { case StringCaseTransformationType.Lowercase: return s.ToLower(context.Language.Culture); case StringCaseTransformationType.Uppercase: return s.ToUpper(context.Language.Culture); case StringCaseTransformationType.CapitalizeFirst: return Capitalize(s, context.Language.Culture); case StringCaseTransformationType.CapitalizeAll: return string.Join(" ", s.Split(' ').Select(w => Capitalize(w, context.Language.Culture))); } } return s; }
/// <remarks/> public string EndGetSubscriptionProperties(System.IAsyncResult asyncResult, out ExtensionSettings ExtensionSettings, out string Description, out ActiveState Active, out string Status, out string EventType, out string MatchData, out ParameterValue[] Parameters) { object[] results = this.EndInvoke(asyncResult); ExtensionSettings = ((ExtensionSettings)(results[1])); Description = ((string)(results[2])); Active = ((ActiveState)(results[3])); Status = ((string)(results[4])); EventType = ((string)(results[5])); MatchData = ((string)(results[6])); Parameters = ((ParameterValue[])(results[7])); return ((string)(results[0])); }
/// <remarks/> public void GetReportParametersAsync(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials) { this.GetReportParametersAsync(Report, HistoryID, ForRendering, Values, Credentials, null); }
/// <summary> /// Callback for changes in system parameters; request all queries to have their state checked /// </summary> void HandleSystemParameterValueChanged(ParameterDefinition definition, ParameterValue sender) { CheckCommands(); }
/// <remarks/> public void CreateSubscriptionAsync(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) { this.CreateSubscriptionAsync(Report, ExtensionSettings, Description, EventType, MatchData, Parameters, null); }
/// <summary> /// Cache the parameters for an element's subelement (subelementHandle), allowing quick access later. /// </summary> /// <param name="elementId">The element id.</param> /// <param name="subelementHandle">The subelement ifc handle.</param> /// <param name="param">The element's parameter that we want to override.</param> /// <param name="paramVal">The override value.</param> static public void CacheParameterValuesForSubelementHandle(ElementId elementId, IFCAnyHandle subelementHandle, Parameter param, ParameterValue paramVal) { if ((elementId == ElementId.InvalidElementId) || (subelementHandle == null) || (param == null) || (paramVal == null)) { return; } if (IsDuplicateParameter(param)) { return; } Definition paramDefinition = param.Definition; if (paramDefinition == null) { return; } // Don't cache parameters that aren't visible to the user. InternalDefinition internalDefinition = paramDefinition as InternalDefinition; if (internalDefinition != null && internalDefinition.Visible == false) { return; } if (string.IsNullOrWhiteSpace(paramDefinition.Name)) { return; } string cleanPropertyName = NamingUtil.RemoveSpaces(paramDefinition.Name); IDictionary <IFCAnyHandle, ParameterValueSubelementCache> anyHandleParamValMap; if (!m_SubelementParameterValueCache.TryGetValue(elementId, out anyHandleParamValMap)) { anyHandleParamValMap = new Dictionary <IFCAnyHandle, ParameterValueSubelementCache>(); m_SubelementParameterValueCache[elementId] = anyHandleParamValMap; } ParameterValueSubelementCache paramCache; if (!anyHandleParamValMap.TryGetValue(subelementHandle, out paramCache)) { paramCache = new ParameterValueSubelementCache(); anyHandleParamValMap[subelementHandle] = paramCache; } ParameterValue cachedParamVal; if (paramCache.ParameterValueCache.TryGetValue(cleanPropertyName, out cachedParamVal)) { return; } paramCache.ParameterValueCache[cleanPropertyName] = paramVal; }
public Parameter(string name, ParameterValue <T> value) : base(name) { Value = value; }
/// <summary> /// Creates parameter list and sets values for the specified request to the specified route. /// </summary> internal static List <ParameterValue> FillParameters(HttpRequest request, RouteMatch route) { List <ParameterValue> values = new List <ParameterValue>(); foreach (ActionParameter ap in route.Route.Parameters) { ParameterValue paramValue = new ParameterValue { Name = ap.ParameterName, Type = ap.ParameterType, Source = ap.Source }; //by source find the value of the parameter and set it to "value" local variable switch (ap.Source) { case ParameterSource.None: case ParameterSource.Route: paramValue.Value = ChangeType(route.Values[ap.FromName], ap.ParameterType, ap.Nullable); break; case ParameterSource.Body: { string content = Encoding.UTF8.GetString(request.ContentStream.ToArray()); if (ap.FromName == "json") { paramValue.Value = Newtonsoft.Json.JsonConvert.DeserializeObject(content, ap.ParameterType); } else if (ap.FromName == "xml") { using MemoryStream ms = new MemoryStream(Encoding.UTF8.GetBytes(content)); XmlSerializer serializer = new XmlSerializer(ap.ParameterType); paramValue.Value = serializer.Deserialize(ms); } break; } case ParameterSource.Form: if (ap.IsClass) { object obj = Activator.CreateInstance(ap.ParameterType); string start = $"{ap.FromName}."; var props = request.Form.Where(x => x.Key.StartsWith(start, StringComparison.InvariantCultureIgnoreCase)); foreach (var kv in props) { string propName = kv.Key.Substring(start.Length); PropertyInfo propInfo; ap.ClassProperties.TryGetValue(propName, out propInfo); if (propInfo != null) { propInfo.SetValue(obj, ChangeType(kv.Value, propInfo.PropertyType, Nullable.GetUnderlyingType(propInfo.PropertyType) != null)); } } paramValue.Value = obj; } else if (request.Form.ContainsKey(ap.FromName)) { paramValue.Value = ChangeType(request.Form[ap.FromName], ap.ParameterType, ap.Nullable); } break; case ParameterSource.QueryString: if (request.QueryString.ContainsKey(ap.FromName)) { paramValue.Value = ChangeType(request.QueryString[ap.FromName], ap.ParameterType, ap.Nullable); } break; case ParameterSource.Header: if (request.Headers.ContainsKey(ap.FromName)) { paramValue.Value = ChangeType(request.Headers[ap.FromName], ap.ParameterType, ap.Nullable); } break; } //return value values.Add(paramValue); } return(values); }
public void SendMailReportPo(string reportName, string subject, string body, int tblAuthUser, TblSalesOrder salesOrder) { string deviceInfo = null; var extension = String.Empty; var mimeType = String.Empty; var encoding = String.Empty; Warning[] warnings = null; string[] streamIDs = null; string historyId = null; // Create a Report Execution object var rsExec = new ReportExecutionService(); rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials; using (var context = new WorkFlowManagerDBEntities()) { if (string.IsNullOrEmpty(ReportServer)) { ReportServer = context.tblChainSetups.SingleOrDefault(x => x.sGlobalSettingCode == "ReportServer").sSetupValue; } } rsExec.Url = ReportServer + "/ReportExecution2005.asmx"; // Load the report var execInfo = rsExec.LoadReport("/Report/" + reportName, historyId); var para = new ObservableCollection <string> { salesOrder.Iserial.ToString() }; var parameters = new ParameterValue[para.Count]; foreach (var row in para) { var index = para.IndexOf(row); parameters[0] = new ParameterValue(); parameters[index].Value = row; parameters[index].Name = execInfo.Parameters[index].Name; // paramters) { Name = , Value = row } }, "en-us"); } rsExec.SetExecutionParameters(parameters, "en-us"); // get pdf of report var results = rsExec.Render("PDF", deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs); //Walla...almost no code, it's easy to manage and your done. //Take the bytes and add as an attachment to a MailMessage(SMTP): var attach = new Attachment(new MemoryStream(results), String.Format("{0}.pdf", reportName)); string emailFrom; var emailTo = new List <string>(); using (var model = new WorkFlowManagerDBEntities()) { try { var code = model.TblAuthUsers.FirstOrDefault(w => w.Iserial == tblAuthUser).Code; //emailFrom = "*****@*****.**";// emailFrom = model.Employees.FirstOrDefault(x => x.EMPLID == code).Email; var style = model.TblStyles.FirstOrDefault(x => x.Iserial == salesOrder.TblStyle); var brandsectionMail = model.TblBrandSectionMails.Where( x => x.TblBrand == style.Brand && x.TblLkpBrandSection == style.TblLkpBrandSection); foreach (var variable in brandsectionMail.Select(x => x.Emp)) { //emailTo.Add("*****@*****.**");// emailTo.Add(model.Employees.FirstOrDefault(x => x.EMPLID == variable).Email); } } catch (Exception) { emailFrom = model.Employees.FirstOrDefault(x => x.EMPLID == "0158").Email; } } //string emailTo; //using (var Model = new WorkFlowManagerDBEntities()) //{ // emailTo = "*****@*****.**"; // // emailFrom = Model.Employees.FirstOrDefault(x => x.EMPLID == EmpCode).Email; //} SendEmail(attach, emailFrom, emailTo, subject, body); }
protected override string ParameterValueToCode(MethodInfo methodInfo) { return(ParameterValue.ToString()); }
public void SenderMarkerMail(string reportName, string subject, string body, int markerHeader) { string deviceInfo = null; var extension = String.Empty; var mimeType = String.Empty; var encoding = String.Empty; Microsoft.Reporting.WebForms.Internal.Soap.ReportingServices2005.Execution.Warning[] warnings = null; string[] streamIDs = null; string historyId = null; var rsExec = new ReportExecutionService(); rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials; using (var context = new WorkFlowManagerDBEntities()) { if (string.IsNullOrEmpty(ReportServer)) { ReportServer = context.tblChainSetups.SingleOrDefault(x => x.sGlobalSettingCode == "ReportServer").sSetupValue; } } rsExec.Url = ReportServer + "/ReportExecution2005.asmx"; // Load the report var execInfo = rsExec.LoadReport("/Report/" + reportName, historyId); var para = new ObservableCollection <string> { markerHeader.ToString() }; var parameters = new ParameterValue[para.Count]; foreach (var row in para) { var index = para.IndexOf(row); parameters[0] = new ParameterValue(); parameters[index].Value = row; parameters[index].Name = execInfo.Parameters[index].Name; // paramters) { Name = , Value = row } }, "en-us"); } rsExec.SetExecutionParameters(parameters, "en-us"); // get pdf of report var results = rsExec.Render("PDF", deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs); //Walla...almost no code, it's easy to manage and your done. //Take the bytes and add as an attachment to a MailMessage(SMTP): var attach = new Attachment(new MemoryStream(results), String.Format("{0}.pdf", reportName)); string emailFrom; var emailTo = new List <string>(); using (var model = new WorkFlowManagerDBEntities()) { emailFrom = "*****@*****.**"; var brandsectionMail = model.TblMarkerMails; foreach (var variable in brandsectionMail.Select(x => x.Emp)) { emailTo.Add(model.Employees.FirstOrDefault(x => x.EMPLID == variable).Email); } } SendEmail(attach, emailFrom, emailTo, subject, body); }
protected bool SendReport(ReportSubscription subscription) { string mimeType, extension; ParameterValue[] reportParameters = new ParameterValue[1]; if (subscription.ReportName == "CasesPending") { reportParameters = new ParameterValue[5]; reportParameters[0] = new ParameterValue() { Name = "ouID", Value = subscription.ParamOUID }; reportParameters[1] = new ParameterValue() { Name = "year", Value = subscription.ParamYear }; reportParameters[2] = new ParameterValue() { Name = "jrwa", Value = subscription.ParamJRWA }; reportParameters[3] = new ParameterValue() { Name = "daysFrom", Value = subscription.ParamDaysFrom }; reportParameters[4] = new ParameterValue() { Name = "daysTo", Value = subscription.ParamDaysTo }; } if (subscription.ReportName == "CasesOutOfDate") { reportParameters = new ParameterValue[3]; reportParameters[0] = new ParameterValue() { Name = "ouID", Value = subscription.ParamOUID }; reportParameters[1] = new ParameterValue() { Name = "year", Value = subscription.ParamYear }; reportParameters[2] = new ParameterValue() { Name = "jrwa", Value = subscription.ParamJRWA }; } ReportCallContext reportContext = new ReportCallContext() { ReportName = subscription.ReportName , ReportFormat = subscription.Format , ReportTitle = subscription.ReportTitle , Parameters = reportParameters }; try { byte[] reportContent = new ReportService().GetReportFromRS(reportContext, out mimeType, out extension); MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "eSoda-Raporty"); mail.To.Add(subscription.EmailAddress); mail.Subject = "Raport z systemu eSoda "; mail.Body = "W załączniku znajduje się raport. Został wysłany z systemu eSoda w ramach zdefiniowanej subskrypcji."; using (MemoryStream ms = new MemoryStream(reportContent)) { try { mail.Attachments.Add(new Attachment(ms, "Raport.pdf")); SmtpClient client = new SmtpClient(); client.Send(mail); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); } } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message); return(false); } return(true); }
public static string GetReportDataModel(DateTime startDate, DateTime endDate, string nodeId, string appId, //string segmentId, //string schemeId, string cultureInfo, string strategy ) { ReportingStartDate = startDate; ReportingEndDate = endDate; ReportingAppID = appId; ParameterValue[] paramval = new ParameterValue[0]; UserDTO user = FormsAuthenticationWrapper.User; var userApplications = (UserDTO)HttpContext.Current.Session["user"]; // userApplications.Accounts var reportPathPrefix = ""; var reportName = string.Empty; // the node id should reference feature enum versus primary key switch (nodeId) { case "1": case "9004": reportPathPrefix = ConfigurationManager.AppSettings["ReportPrefix"]; reportName = "RecommendationDemand"; paramval = new ParameterValue[4]; paramval[0] = new ParameterValue(); paramval[0].Name = "account"; paramval[0].Value = user.LastAccountID; paramval[1] = new ParameterValue(); paramval[1].Name = "applicationid"; paramval[1].Value = appId.ToLower(); paramval[2] = new ParameterValue(); paramval[2].Name = "startdate"; paramval[2].Value = ReportingStartDate.ToShortDateString(); paramval[3] = new ParameterValue(); paramval[3].Name = "enddate"; paramval[3].Value = ReportingEndDate.ToShortDateString(); break; case "2": case "9005": reportPathPrefix = ConfigurationManager.AppSettings["ReportPrefix"]; reportName = "RecommendationDetail"; paramval = new ParameterValue[4]; paramval[0] = new ParameterValue(); paramval[0].Name = "account"; paramval[0].Value = user.LastAccountID; paramval[1] = new ParameterValue(); paramval[1].Name = "app_id"; paramval[1].Value = appId.ToLower(); paramval[2] = new ParameterValue(); paramval[2].Name = "startdate"; paramval[2].Value = ReportingStartDate.ToShortDateString(); paramval[3] = new ParameterValue(); paramval[3].Name = "enddate"; paramval[3].Value = ReportingEndDate.ToShortDateString(); break; case "3": case "9006": reportPathPrefix = ConfigurationManager.AppSettings["ReportPrefix"]; reportName = "RecommendedItems"; paramval = new ParameterValue[4]; paramval[0] = new ParameterValue(); paramval[0].Name = "Account_ID"; paramval[0].Value = user.LastAccountID; // "Nike" paramval[1] = new ParameterValue(); paramval[1].Name = "ApplicationID"; paramval[1].Value = appId.ToLower(); // "Nike01US" paramval[2] = new ParameterValue(); paramval[2].Name = "T_Start"; paramval[2].Value = ReportingStartDate.ToShortDateString(); //paramval[3] = new ParameterValue(); //paramval[3].Name = "Scheme_ID"; //paramval[3].Value = schemeId; // "All Schemes" paramval[3] = new ParameterValue(); paramval[3].Name = "T_End"; paramval[3].Value = ReportingEndDate.ToShortDateString(); paramval[4] = new ParameterValue(); paramval[4].Name = "Segment"; paramval[4].Value = "All Segments"; break; case "4": case "9007": reportPathPrefix = ConfigurationManager.AppSettings["ReportPrefix"]; reportName = "StrategyComparison"; paramval = new ParameterValue[7]; paramval[0] = new ParameterValue(); paramval[0].Name = "Account_ID"; paramval[0].Value = user.LastAccountID; paramval[1] = new ParameterValue(); paramval[1].Name = "ApplicationID"; paramval[1].Value = appId.ToLower(); paramval[2] = new ParameterValue(); paramval[2].Name = "T_Start"; paramval[2].Value = ReportingStartDate.ToShortDateString(); //paramval[3] = new ParameterValue(); //paramval[3].Name = "Scheme_ID"; //paramval[3].Value = schemeId; // "All Schemes" paramval[3] = new ParameterValue(); paramval[3].Name = "T_End"; paramval[3].Value = ReportingEndDate.ToShortDateString(); paramval[4] = new ParameterValue(); paramval[4].Name = "Strategy_Status"; paramval[4].Value = strategy; paramval[5] = new ParameterValue(); paramval[5].Name = "Tag"; paramval[5].Value = "Ungroup"; paramval[6] = new ParameterValue(); paramval[6].Name = "GroupByTag"; paramval[6].Value = "0"; break; } Warning[] warnings = null; string[] streamIDs = null; string encoding = string.Empty; string mimeType = string.Empty; string extension = string.Empty; var reportHtml = string.Empty; try { var rs = new ReportExecutionService(); var reportUsername = ConfigurationManager.AppSettings["ReportUsername"]; var reportPassword = ConfigurationManager.AppSettings["ReportPassword"]; var reportDomain = ConfigurationManager.AppSettings["ReportDomain"]; rs.Credentials = new NetworkCredential(reportUsername, reportPassword, reportDomain); rs.LoadReport(string.Format("{0}{1}", reportPathPrefix, reportName), null); rs.SetExecutionParameters(paramval, "en-us"); reportHtml = System.Text.Encoding.Default.GetString(rs.Render("HTML4.0", string.Empty, out extension, out encoding, out mimeType, out warnings, out streamIDs)); rs.Timeout = 10000; } catch (Exception ex) { _certonaService.Abort(); throw; } return(reportHtml); }
private void GetParameters_Load(object sender, EventArgs e) { rs = new ReportingService2010(); rs.Credentials = System.Net.CredentialCache.DefaultCredentials; bool forRendering = true; string historyID = null; ParameterValue[] values = new ParameterValue[1]; DataSourceCredentials[] credentials = null; ItemParameter[] parametersSSRS = null; ValidValue[] pvs = null; int x = 5; int y = 30; try { values[0] = new ParameterValue(); values[0].Label = "ServiceYear"; values[0].Name = "ServiceYear"; values[0].Value = "2005"; parametersSSRS = rs.GetItemParameters(report, historyID, forRendering, values, credentials); if (parametersSSRS != null) { foreach (ItemParameter rp in parametersSSRS) { this.SuspendLayout(); this.parameterPanel.SuspendLayout(); this.parameterPanel.SendToBack(); // now create a label for the combo box below Label lbl = new Label(); lbl.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left); lbl.Location = new System.Drawing.Point(x, y); lbl.Name = rp.Name; lbl.Text = rp.Name; lbl.Size = new System.Drawing.Size(150, 20); this.parameterPanel.Controls.Add(lbl); x = x + 150; // now make a combo box and fill it ComboBox a = new ComboBox(); a.Anchor = (System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right); a.Location = new System.Drawing.Point(x, y); a.Name = rp.Name; a.Size = new System.Drawing.Size(200, 20); x = 5; y = y + 30; this.parameterPanel.Controls.Add(a); this.parameterPanel.ResumeLayout(false); this.ResumeLayout(false); if (rp.ValidValues != null) { //Build listitems ArrayList aList = new ArrayList(); pvs = rp.ValidValues; foreach (ValidValue pv in pvs) { aList.Add(new ComboItem(pv.Label, pv.Value)); } //Bind listitmes to combobox a.DataSource = aList; a.DisplayMember = "Display"; a.ValueMember = "Value"; } } } } catch (SoapException ex) { MessageBox.Show(ex.Detail.InnerXml.ToString()); } }
public string GetSubscriptionProperties(string SubscriptionID, out ExtensionSettings ExtensionSettings, out string Description, out ActiveState Active, out string Status, out string EventType, out string MatchData, out ParameterValue[] Parameters) { object[] results = this.Invoke("GetSubscriptionProperties", new object[] { SubscriptionID}); ExtensionSettings = ((ExtensionSettings)(results[1])); Description = ((string)(results[2])); Active = ((ActiveState)(results[3])); Status = ((string)(results[4])); EventType = ((string)(results[5])); MatchData = ((string)(results[6])); Parameters = ((ParameterValue[])(results[7])); return ((string)(results[0])); }
/// <summary> /// This first version of RenderReport is strictly for legacy support of NIFTransferShipment. NIFTransferShipment should be re-worked to use the rendorReport /// version that accepts an array of ParameterValues. /// </summary> /// <param name="reportPath"></param> /// <param name="identifier"></param> /// <returns></returns> public byte[][] renderReport(string reportPath, ParameterValue[] reportParameters) { // Private variables for rendering string historyID = null; ExecutionHeader execHeader = new ExecutionHeader(); try { rs.Timeout = 300000; rs.ExecutionHeaderValue = execHeader; ExecutionInfo execInfo = new ExecutionInfo(); execInfo = rs.LoadReport(reportPath, historyID); if (reportParameters != null) { rs.SetExecutionParameters(reportParameters, "en-us"); } Byte[][] pages = new Byte[0][]; string format = "IMAGE"; int numberOfPages = 1; byte[] currentPageStream = new byte[1] { 0x00 }; // this single byte will prime the while loop string extension = null; string encoding = null; string mimeType = null; string[] streamIDs = null; Warning[] warnings = null; while (currentPageStream.Length > 0) { string deviceInfo = String.Format(@"<DeviceInfo><OutputFormat>EMF</OutputFormat><PrintDpiX>96</PrintDpiX><PrintDpiY>96</PrintDpiY><StartPage>{0}</StartPage></DeviceInfo>", numberOfPages); //Execute the report and get page count. currentPageStream = rs.Render( format, deviceInfo, out extension, out encoding, out mimeType, out warnings, out streamIDs); if (currentPageStream.Length == 0 && numberOfPages == 1) { break; // nothing rendered } if (currentPageStream.Length > 0) { Array.Resize(ref pages, pages.Length + 1); pages[pages.Length - 1] = currentPageStream; numberOfPages++; } } m_numberOfPages = numberOfPages - 1; return pages; } catch (SoapException ex) { eventLog.WriteEntry(ex.Detail.InnerXml, EventLogEntryType.Information, 7001); Console.WriteLine(ex.Detail.InnerXml); } catch (Exception ex) { eventLog.WriteEntry(ex.Message, EventLogEntryType.Information, 7001); Console.WriteLine(ex.Message); } finally { } return null; }
public ReportParameterViewItem(ReportParameter parameter, ParameterValue value) : this(parameter, value, null) { }
internal InjectedProperty(string propertyName, ParameterValue propertyValue) { this.PropertyName = propertyName; this.PropertyValue = propertyValue; }
private ParameterValue[] GetSubscriptionTypeParameters(string[] subscriptionInfoText) { ParameterValue[] extensionParams; switch (SubscriptionInfo(subscriptionInfoText, "subscriptionType")) { case "FILESHARE": case "fileshare": case "CSV": case "csv": extensionParams = new ParameterValue[7]; extensionParams[0] = new ParameterValue { Name = "PATH", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionToFile_FilePath") }; //Set the filename to always have a timestamp extensionParams[1] = new ParameterValue { Name = "FILENAME", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionToFile_FileName") + "_@timestamp" }; // Add a file extension always extensionParams[2] = new ParameterValue { Name = "FILEEXTN", Value = "True" }; extensionParams[3] = new ParameterValue { Name = "USERNAME", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionToFile_UserName") }; extensionParams[4] = new ParameterValue { Name = "PASSWORD", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionToFile_Password") }; var subscriptionRenderFormat = SubscriptionInfo(subscriptionInfoText, "subscriptionRenderFormat"); extensionParams[5] = new ParameterValue { Name = "RENDER_FORMAT", Value = !string.IsNullOrEmpty(subscriptionRenderFormat) ? subscriptionRenderFormat : "CSV" }; extensionParams[6] = new ParameterValue { Name = "WRITEMODE", Value = "Overwrite" }; return(extensionParams); default: extensionParams = new ParameterValue[10]; extensionParams[0] = new ParameterValue { Name = "TO", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionSendTo") }; extensionParams[1] = new ParameterValue { Name = "CC", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionCCto") }; extensionParams[2] = new ParameterValue { Name = "BCC", Value = SubscriptionInfo(subscriptionInfoText, "subscriptionBCCto") }; extensionParams[3] = new ParameterValue { Name = "ReplyTo", Value = "*****@*****.**" }; extensionParams[4] = new ParameterValue { Name = "IncludeReport", Value = "True" }; extensionParams[5] = new ParameterValue { Name = "RenderFormat", Value = "EXCEL" }; extensionParams[6] = new ParameterValue { Name = "Subject", Value = SubscriptionInfo(subscriptionInfoText, "subjectPrefix") + " - @ReportName executed at @ExecutionTime" }; extensionParams[7] = new ParameterValue { Name = "Comment", Value = SubscriptionInfo(subscriptionInfoText, "emailBodyText") }; extensionParams[8] = new ParameterValue { Name = "IncludeLink", Value = "False" }; extensionParams[9] = new ParameterValue { Name = "Priority", Value = "NORMAL" }; return(extensionParams); } }
public void ParameterValueImplicitValueTest() { var pv = new ParameterValue <int>(8); Assert.IsTrue(pv > 5); }
private static InjectionParameterValue GetInjectionParameterValue(ParameterValue dependencyParameter) { var visitor = new UnityParameterVisitor(); visitor.Visit(dependencyParameter); return visitor.InjectionParameter; }
/// <remarks/> public System.IAsyncResult BeginSetSubscriptionProperties(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("SetSubscriptionProperties", new object[] { SubscriptionID, ExtensionSettings, Description, EventType, MatchData, Parameters}, callback, asyncState); }
public static void Set(this Calculation calculation, ParameterName name, ParameterValue value) { calculation.Set(new Parameter(name, value)); }
private static void AddEntities(ApplicationDbContext context, AppTenant tenant, string languageId, string appId) { // Div bileşenini ekle var ct1 = new ComponentType() { Name = "DivComponent", DisplayName = "Div Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(ct1); context.SaveChanges(); // Div bileşeninin parametrelerini ekle var p1 = new Parameter() { Name = "CssClass", DisplayName = "CssClass", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct1.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(p1); context.SaveChanges(); // FormComponent bileşenini ekle var Fc = new ComponentType() { Name = "FormComponent", DisplayName = "Form Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(Fc); context.SaveChanges(); // FormComponent bileşeninin parametrelerini ekle var Fcv = new Parameter() { Name = "FormName", DisplayName = "Form Adı", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = Fc.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(Fcv); context.SaveChanges(); // Link bileşenini ekle var ct2 = new ComponentType() { Name = "LinkComponent", DisplayName = "Link Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(ct2); context.SaveChanges(); // link bileşeninin parametrelerini ekle var p2 = new Parameter() { Name = "CssClass", DisplayName = "CssClass", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct2.Id, AppTenantId = tenant.AppTenantId }; var p3 = new Parameter() { Name = "Href", DisplayName = "Href", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct2.Id, AppTenantId = tenant.AppTenantId }; var p4 = new Parameter() { Name = "Text", DisplayName = "Text", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct2.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(p2); context.Parameters.Add(p3); context.Parameters.Add(p4); context.SaveChanges(); // Image bileşenini ekle var ct3 = new ComponentType() { Name = "ImageComponent", DisplayName = "Resim Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(ct3); context.SaveChanges(); // link bileşeninin parametrelerini ekle var p5 = new Parameter() { Name = "Src", DisplayName = "Src", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct3.Id, AppTenantId = tenant.AppTenantId }; var p6 = new Parameter() { Name = "Width", DisplayName = "Width", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct3.Id, AppTenantId = tenant.AppTenantId }; var p7 = new Parameter() { Name = "Height", DisplayName = "Height", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct3.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(p5); context.Parameters.Add(p6); context.Parameters.Add(p7); context.SaveChanges(); // veri tablosu bileşenini ekle var ct4 = new ComponentType { Name = "DataTableComponent", DisplayName = "Veri Tablosu Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(ct4); context.SaveChanges(); // veri tablosu bileşeninin parametrelerini ekle var p8 = new Parameter() { Name = "DataTableName", DisplayName = "DataTableName", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 1, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p11 = new Parameter() { Name = "CreateButtonText", DisplayName = "Oluştur Butonu Metni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 2, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p12 = new Parameter() { Name = "CreateButtonHref", DisplayName = "Oluştur Butonu Linki", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 3, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p13 = new Parameter() { Name = "EditButtonText", DisplayName = "Düzenle Butonu Metni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 4, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p14 = new Parameter() { Name = "EditButtonHref", DisplayName = "Düzenle Butonu Linki", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 5, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p15 = new Parameter() { Name = "DeleteButtonText", DisplayName = "Sil Butonu Metni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 6, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; var p16 = new Parameter() { Name = "DeleteButtonHref", DisplayName = "Sil Butonu Linki", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", Position = 7, ComponentTypeId = ct4.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(p8); context.Parameters.Add(p11); context.Parameters.Add(p12); context.Parameters.Add(p13); context.Parameters.Add(p14); context.Parameters.Add(p15); context.Parameters.Add(p16); context.SaveChanges(); // Text tablosu bileşenini ekle var ct5 = new ComponentType() { Name = "TextComponent", DisplayName = "Yazı Bileşeni", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.ComponentTypes.Add(ct5); context.SaveChanges(); // text bileşeninin parametrelerini ekle var p9 = new Parameter() { Name = "Content", DisplayName = "Content", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ComponentTypeId = ct5.Id, AppTenantId = tenant.AppTenantId }; context.Parameters.Add(p9); context.SaveChanges(); //Giriş Menüsü Ekle var m1 = new Menu() { Name = "MenuComponent", MenuLocation = "Primary2", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId }; context.Menus.Add(m1); context.SaveChanges(); // text bileşeninin parametrelerini ekle var mI1 = new MenuItem() { Icon = "icon-bar-chart", Name = "Giriş", Url = "/eduxcentralpanel/tr/giris", IsPublished = true, CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", MenuId = m1.Id, AppTenantId = tenant.AppTenantId }; context.MenuItems.Add(mI1); context.SaveChanges(); var mI2 = new MenuItem() { Icon = "icon-bulb", Name = "Yardım", Url = "/eduxcentralpanel/tr/yardim", IsPublished = true, CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", MenuId = m1.Id, AppTenantId = tenant.AppTenantId }; context.MenuItems.Add(mI2); context.SaveChanges(); var p10 = new Page() { Title = "Giriş", Slug = "giris", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppTenantId = tenant.AppTenantId, AppId = appId, LanguageId = languageId }; context.Pages.Add(p10); context.SaveChanges(); var c1 = new Component() { Name = "Container", DisplayName = "Container", ComponentTypeId = ct1.Id, CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", PageId = p10.Id, AppTenantId = tenant.AppTenantId }; context.Components.Add(c1); context.SaveChanges(); var p20 = new Page() { Title = "Yardım", Slug = "yardim", CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", AppId = appId, AppTenantId = tenant.AppTenantId, LanguageId = languageId }; context.Pages.Add(p20); context.SaveChanges(); var c2 = new Component() { Name = "Container", DisplayName = "Container", ComponentTypeId = ct1.Id, CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", PageId = p20.Id, AppTenantId = tenant.AppTenantId }; context.Components.Add(c2); context.SaveChanges(); var t1 = new Component() { Name = "TextComponent", DisplayName = "Yazı Bileşeni", ComponentTypeId = ct5.Id, CreateDate = DateTime.Parse("2017-07-26"), UpdateDate = DateTime.Parse("2017-07-26"), CreatedBy = "username", UpdatedBy = "username", ParentComponentId = c2.Id, PageId = p20.Id, AppTenantId = tenant.AppTenantId }; context.Components.Add(t1); context.SaveChanges(); var p22 = new ParameterValue() { ComponentId = t1.Id, ParameterId = p9.Id, Value = "<br/><br/><b>Edux Özelleştirmesi Nasıl Yapılır?</b><br/><br/> 1. Verileri saklamak için Varlık nasıl oluşturulur? <br/>Varlıklar modülünden verileri saklayabileceğimiz varlıklar oluşturup,bu varlıkların özelliklerini oluşturmamız gerekiyor.<br/><br/> 2. Verileri görüntülemek için Veri Tablosu nasıl oluşturulur?<br/> Veri Tabloları modülünden veri tablosu oluşturulup,sütunları tanımlanmalıdır.Sütunlar hangi varlığın hangi özelliğinin değerinin görüntüleneceğini belirlemeye yarar.<br/><br/> 3. Verileri girmek ve düzenlemek için Form nasıl oluşturulur?<br/> Formlar modülünden veri girmek ve düzenlemek için form oluşturup, alanlarını tanımlamamız gerekmektedir.Form alanları ile girilen değerlerin hangi varlığın özelliği için olduğu tanımlanır.<br/><br/> 4. Yönetim paneli sayfaları nasıl hazırlanır?<br/>Sayfalar modülünden veri tabloları ve formlar içeren sayfalar tasarlanabilir.Sayfayı oluşturup sayfada görüntülenecek Veri Tablosu ve Form bileşeni gibi bileşenleri parametre değerlerini girerek o sayfaya eklemek gerekmektedir.", AppTenantId = tenant.AppTenantId }; context.ParameterValues.Add(p22); context.SaveChanges(); }
/// <remarks/> public System.IAsyncResult BeginGetReportParameters(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("GetReportParameters", new object[] { Report, HistoryID, ForRendering, Values, Credentials}, callback, asyncState); }
public bool Evaluate(ParameterValue val, EvaluationContext context) { bool success = Value.Equals(Convert.ChangeType(val.Value, typeof(TValue))); return(NotEquals ? !success : success); }
public string CreateSubscription(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) { object[] results = this.Invoke("CreateSubscription", new object[] { Report, ExtensionSettings, Description, EventType, MatchData, Parameters}); return ((string)(results[0])); }
/// <summary> /// Asynchronously executes the query using the parameter values supplied /// </summary> /// <param name="parameterValues">The parameter values</param> /// <returns>The query results</returns> public virtual async Task <QueryResults> ExecuteAsync ( params ParameterValue[] parameterValues ) { var watch = Stopwatch.StartNew(); if (parameterValues == null) { parameterValues = new ParameterValue[] { }; } if (this.OnlyRunWithParameterValues) { var valueFound = parameterValues.Any ( pv => pv.Value != null && false == pv.ValueAutoSetByConstraint ); if (false == valueFound) { return(new QueryResults ( this, 0 )); } } var parameterErrors = ValidateParameterValues ( parameterValues ); if (parameterErrors.Any()) { var results = new QueryResults ( this, 0, false ); return(results.WithErrors ( parameterErrors )); } else { var fetchTask = FetchDataAsync ( parameterValues ); var rows = await fetchTask.ConfigureAwait ( false ); EnsureRowCountValid(rows); rows = SortRows(rows); var groupings = GroupRows(rows); watch.Stop(); var executionTime = watch.ElapsedMilliseconds; var results = new QueryResults ( this, executionTime ); return(results.WithData ( groupings )); } }
/// <remarks/> public void CreateSubscriptionAsync(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, object userState) { if ((this.CreateSubscriptionOperationCompleted == null)) { this.CreateSubscriptionOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateSubscriptionOperationCompleted); } this.InvokeAsync("CreateSubscription", new object[] { Report, ExtensionSettings, Description, EventType, MatchData, Parameters}, this.CreateSubscriptionOperationCompleted, userState); }
public Gain(FlightControlSystem fcs, XmlElement element) : base(fcs, element) { gain = null; Table = null; InMin = -1.0; InMax = 1.0; OutMin = OutMax = 0.0; if (compType == "PURE_GAIN") { if (element.FindElement("gain") == null) { log.Error(" No GAIN specified (default: 1.0)"); } } XmlElement gain_element = element.FindElement("gain"); if (gain_element != null) { gain = new ParameterValue(gain_element, propertyManager); } else { gain = new RealValue(1.0); } if (compType == "AEROSURFACE_SCALE") { XmlElement scale_element = element.FindElement("domain"); if (scale_element != null) { if (scale_element.FindElement("max") != null && scale_element.FindElement("min") != null) { XmlElement elem = scale_element.FindElement("max"); InMax = FormatHelper.ValueAsNumber(elem); elem = scale_element.FindElement("min"); InMin = FormatHelper.ValueAsNumber(elem); } } scale_element = element.FindElement("range"); if (scale_element == null) { throw new Exception("No range supplied for aerosurface scale component"); } if (scale_element.FindElement("max") != null && scale_element.FindElement("min") != null) { XmlElement elem = scale_element.FindElement("max"); OutMax = FormatHelper.ValueAsNumber(elem); elem = scale_element.FindElement("min"); OutMin = FormatHelper.ValueAsNumber(elem); } else { log.Error("Maximum and minimum output values must be supplied for the " + "aerosurface scale component"); throw new Exception("Some inputs are missing."); } ZeroCentered = true; XmlElement zero_centered = element.FindElement("zero_centered"); //ToDo if zero centered, then mins must be <0 and max's must be >0 if (zero_centered != null) { string sZeroCentered = element.FindElementValue("zero_centered"); if (sZeroCentered == "0" || sZeroCentered == "false") { ZeroCentered = false; } } } if (compType == "SCHEDULED_GAIN") { if (element.FindElement("table") != null) { Table = new Table(propertyManager, element.FindElement("table")); } else { log.Error("A table must be provided for the scheduled gain component"); throw new Exception("Some inputs are missing."); } } Bind(element); Debug(0); }
public ReportParameter[] GetReportParameters(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials) { object[] results = this.Invoke("GetReportParameters", new object[] { Report, HistoryID, ForRendering, Values, Credentials}); return ((ReportParameter[])(results[0])); }
private void syncTreeNodes(string destPath, TreeNodeCollection nodes) { foreach (TreeNode node in nodes) { if ((bool)node.Tag) { if (node.Nodes.Count > 0) { var childPath = destPath; if (node.Checked) { if (destPath.Equals(ROOT_FOLDER)) { childPath = ROOT_FOLDER + node.Text; } else { childPath = destPath + PATH_SEPERATOR + node.Text; } } syncTreeNodes(childPath, node.Nodes); } else { if (!existingPaths.Contains(destPath)) { EnsureDestDir(destPath); existingPaths.Add(destPath); } var itemPath = ROOT_FOLDER + node.FullPath.Replace("\\", PATH_SEPERATOR); var itemType = sourceRS.GetItemType(itemPath); if (itemType == ItemTypeEnum.Resource) { //Download the resource string resourceType; var contents = sourceRS.GetResourceContents(itemPath, out resourceType); uploadResource(destPath, node.Text, resourceType, contents); processedNodeCount++; continue; } var reportDef = sourceRS.GetReportDefinition(itemPath); uploadReport(destPath, node.Text, reportDef); //Sync subscriptions ExtensionSettings extSettings; string desc; ActiveState active; string status; string eventType; string matchData; ParameterValue[] values = null; Subscription[] subscriptions = null; ParameterValueOrFieldReference[] extensionParams = null; var destReportPath = destPath; if (destReportPath.EndsWith("/")) { destReportPath += node.Text; } else { destReportPath += "/" + node.Text; } subscriptions = sourceRS.ListSubscriptions(itemPath, txtSourceUser.Text); foreach (var subscription in subscriptions) { sourceRS.GetSubscriptionProperties(subscription.SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values); if (extSettings.Extension == "Report Server FileShare") { ParameterValue para = new ParameterValue(); para.Name = "PASSWORD"; para.Value = txtDestPassword.Text; ParameterValueOrFieldReference[] exParams = new ParameterValueOrFieldReference[extSettings.ParameterValues.Length + 1]; Array.Copy(extSettings.ParameterValues, exParams, extSettings.ParameterValues.Length); exParams[extSettings.ParameterValues.Length] = para; extSettings.ParameterValues = exParams; } destRS.CreateSubscription(destReportPath, extSettings, desc, eventType, matchData, values); } processedNodeCount++; bwSync.ReportProgress(processedNodeCount * 100 / selectedNodeCount); } } } }
/// <remarks/> public void GetReportParametersAsync(string Report, string HistoryID, bool ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials, object userState) { if ((this.GetReportParametersOperationCompleted == null)) { this.GetReportParametersOperationCompleted = new System.Threading.SendOrPostCallback(this.OnGetReportParametersOperationCompleted); } this.InvokeAsync("GetReportParameters", new object[] { Report, HistoryID, ForRendering, Values, Credentials}, this.GetReportParametersOperationCompleted, userState); }
protected override void Context() { base.Context(); _parameterValue1 = new ParameterValue("PATH1", 11, 0.1); _parameterValue2 = new ParameterValue("PATH2", 21, 0.2); }
internal void Deconstruct(int uniqueName, ref Microsoft.ReportingServices.ReportProcessing.Action action, out ActionInstance actionInstance, Microsoft.ReportingServices.ReportProcessing.CustomReportItem context) { Global.Tracer.Assert(IsCustomControl && context != null); actionInstance = null; if (Processing.m_actionCollection == null || Processing.m_actionCollection.Count == 0) { if (action == null) { return; } Global.Tracer.Assert(action.ActionItems != null && 0 < action.ActionItems.Count); int count = action.ActionItems.Count; actionInstance = new ActionInstance(); actionInstance.UniqueName = uniqueName; actionInstance.ActionItemsValues = new ActionItemInstanceList(count); for (int i = 0; i < count; i++) { ActionItemInstance actionItemInstance = new ActionItemInstance(); if (action.ActionItems[i].DrillthroughParameters != null) { int count2 = action.ActionItems[i].DrillthroughParameters.Count; actionItemInstance.DrillthroughParametersValues = new object[count2]; actionItemInstance.DrillthroughParametersOmits = new BoolList(count2); } actionInstance.ActionItemsValues.Add(actionItemInstance); } return; } bool flag = action == null; int count3 = Processing.m_actionCollection.Count; Global.Tracer.Assert(1 <= count3); if (flag) { action = new Microsoft.ReportingServices.ReportProcessing.Action(); action.ActionItems = new ActionItemList(count3); action.ComputedActionItemsCount = count3; } else if (count3 != action.ComputedActionItemsCount) { context.ProcessingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemProperties, Severity.Error, context.CustomObjectType, context.CustomObjectName, context.Type, context.Name, "Actions", action.ComputedActionItemsCount.ToString(CultureInfo.InvariantCulture), count3.ToString(CultureInfo.InvariantCulture)); throw new ReportProcessingException(context.ProcessingContext.ErrorContext.Messages); } actionInstance = new ActionInstance(); actionInstance.UniqueName = uniqueName; actionInstance.ActionItemsValues = new ActionItemInstanceList(count3); for (int j = 0; j < count3; j++) { Action action2 = Processing.m_actionCollection[j]; ActionItem actionItem = null; if (flag) { actionItem = new ActionItem(); actionItem.ComputedIndex = j; actionItem.Label = new ExpressionInfo(ExpressionInfo.Types.Expression); switch (action2.m_actionType) { case ActionType.HyperLink: actionItem.HyperLinkURL = new ExpressionInfo(ExpressionInfo.Types.Expression); break; case ActionType.DrillThrough: actionItem.DrillthroughReportName = new ExpressionInfo(ExpressionInfo.Types.Expression); if (action2.m_parameters != null && 0 < action2.m_parameters.Count) { int count4 = action2.m_parameters.Count; actionItem.DrillthroughParameters = new ParameterValueList(count4); for (int k = 0; k < count4; k++) { ParameterValue parameterValue = new ParameterValue(); parameterValue.Name = action2.m_parameters.GetKey(k); parameterValue.Omit = new ExpressionInfo(ExpressionInfo.Types.Constant); parameterValue.Omit.BoolValue = false; parameterValue.Value = new ExpressionInfo(ExpressionInfo.Types.Expression); actionItem.DrillthroughParameters.Add(parameterValue); } } break; case ActionType.BookmarkLink: actionItem.BookmarkLink = new ExpressionInfo(ExpressionInfo.Types.Expression); break; } action.ActionItems.Add(actionItem); } else { actionItem = action.ActionItems[j]; } Global.Tracer.Assert(actionItem != null); ActionItemInstance actionItemInstance2 = new ActionItemInstance(); actionItemInstance2.Label = action2.Processing.m_label; switch (action2.m_actionType) { case ActionType.HyperLink: actionItemInstance2.HyperLinkURL = action2.Processing.m_action; break; case ActionType.DrillThrough: actionItemInstance2.DrillthroughReportName = action2.Processing.m_action; if (action2.m_parameters != null) { int count5 = action2.m_parameters.Count; if (actionItem.DrillthroughParameters == null && 0 < count5) { context.ProcessingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemProperties, Severity.Error, context.CustomObjectType, context.CustomObjectName, context.Type, context.Name, "Action.DrillthroughParameters", "0", count5.ToString(CultureInfo.InvariantCulture)); throw new ReportProcessingException(context.ProcessingContext.ErrorContext.Messages); } if (count5 != actionItem.DrillthroughParameters.Count) { context.ProcessingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemProperties, Severity.Error, context.CustomObjectType, context.CustomObjectName, context.Type, context.Name, "Action.DrillthroughParameters", actionItem.DrillthroughParameters.Count.ToString(CultureInfo.InvariantCulture), count5.ToString(CultureInfo.InvariantCulture)); throw new ReportProcessingException(context.ProcessingContext.ErrorContext.Messages); } Global.Tracer.Assert(0 < count5); actionItemInstance2.DrillthroughParametersValues = new object[count5]; actionItemInstance2.DrillthroughParametersOmits = new BoolList(count5); DrillthroughParameters drillthroughParameters = new DrillthroughParameters(count5); for (int l = 0; l < count5; l++) { actionItemInstance2.DrillthroughParametersValues[l] = action2.m_parameters.GetValues(l); actionItemInstance2.DrillthroughParametersOmits.Add(false); drillthroughParameters.Add(actionItem.DrillthroughParameters[l].Name, actionItemInstance2.DrillthroughParametersValues[l]); } DrillthroughInformation drillthroughInfo = new DrillthroughInformation(actionItemInstance2.DrillthroughReportName, drillthroughParameters, null); string drillthroughId = uniqueName.ToString(CultureInfo.InvariantCulture) + ":" + j.ToString(CultureInfo.InvariantCulture); context.ProcessingContext.DrillthroughInfo.AddDrillthrough(drillthroughId, drillthroughInfo); } break; case ActionType.BookmarkLink: actionItemInstance2.BookmarkLink = action2.Processing.m_action; break; } actionInstance.ActionItemsValues.Add(actionItemInstance2); } Global.Tracer.Assert(action != null && actionInstance != null && Processing.m_actionCollection != null); Microsoft.ReportingServices.ReportProcessing.Style style = action.StyleClass; object[] styleAttributeValues = null; Microsoft.ReportingServices.ReportProcessing.CustomReportItem.DeconstructRenderStyle(flag, Processing.m_sharedStyles, Processing.m_nonSharedStyles, ref style, out styleAttributeValues, context); action.StyleClass = style; actionInstance.StyleAttributeValues = styleAttributeValues; }
private ReportParameter[] GetReportParameters(ParameterValue[] values) { string serverUrl; string modelsFolder; string company; string languageCulture; ReportParameter[] parameters = null; string errMsg = null; try { ReportUtility.GetSessionInfo(out serverUrl, out modelsFolder, out company, out languageCulture); if (string.IsNullOrEmpty(serverUrl)) { throw new InvalidOperationException(Resources.GetString(Report.NoServerUrl)); } ReportSettings settings = new ReportSettings(); settings.ReportManagerUrl = serverUrl; settings.RootFolder = modelsFolder; settings.ReportPath = this.ReportPath; string fullPath = settings.ResolveFullPath(); // Ask reporting services for a list of all reports and all the parameters for the currently selected report. using (ReportingService2005 rs = new ReportingService2005()) { // Provoke potential exceptions by validating the full path settings.ValidateFullPath(fullPath); rs.Url = settings.ResolvedServiceUrl; rs.Credentials = System.Net.CredentialCache.DefaultCredentials; parameters = rs.GetReportParameters(fullPath, null, values != null, values, null); } } catch (System.Net.WebException) { errMsg = Resources.GetString(Report.cant_read_from_server); } catch (InvalidOperationException reportException) { errMsg = Microsoft.SharePoint.Utilities.SPHttpUtility.HtmlEncode(reportException.Message); } catch (ReportException reportException) { errMsg = AxRSReportWebPart.FormatMissingReportExceptionMessage( reportException, this.WebPartToEdit.CultureInfo, this.WebPartToEdit.Title, this.ReportPath); } catch (Exception exception) { errMsg = Microsoft.SharePoint.Utilities.SPHttpUtility.HtmlEncode(exception.Message); } if (!string.IsNullOrEmpty(errMsg)) { this.AddErrorMessage(errMsg); } return parameters; }
public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value) { if (context != null && context.Instance != null && provider != null) { ParameterValue pv = context.Instance as ParameterValue; if (pv == null) { MapItem item = context.Instance as MapItem; if (item != null) { pv = item.Item.Value as ParameterValue; } } if (pv == null) { pv = value as ParameterValue; } if (pv != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { IMathExpression mew = value as IMathExpression; if (mew == null) { mew = pv.MathExpression; if (mew == null) { MathNodeRoot r = new MathNodeRoot(); r.Name = pv.Name; mew = r; } } System.Drawing.Point curPoint = System.Windows.Forms.Cursor.Position; rc.X = curPoint.X; rc.Y = curPoint.Y; IMathEditor dlg = mew.CreateEditor(rc); // MathPropertyGrid pg = null; Type t = edSvc.GetType(); PropertyInfo pif0 = t.GetProperty("OwnerGrid"); if (pif0 != null) { object g = pif0.GetValue(edSvc, null); pg = g as MathPropertyGrid; } IMethod imScope = pv.ScopeMethod; if (imScope == null) { imScope = mew.ScopeMethod; if (imScope == null) { if (pg != null) { imScope = pg.ScopeMethod; } } } // dlg.ActionContext = pv.ActionContext; dlg.SetScopeMethod(imScope); dlg.VariableMapTargetType = typeof(ParameterValue); dlg.MathExpression = (IMathExpression)mew.Clone(); dlg.MathExpression.ScopeMethod = imScope; dlg.MathExpression.EnableUndo = true; if (edSvc.ShowDialog((Form)dlg) == DialogResult.OK) { mew = dlg.MathExpression; if (value != pv) { value = mew; pv.SetValue(value); } else { pv.SetValue(mew); } if (pg != null) { pg.OnValueChanged(mew, EventArgs.Empty); } } } } } return(value); }
public string FormatValue(ParameterValue value, EvaluationContext context) { return(_converter.NumberToRoman((int)Convert.ChangeType(value.Value, typeof(int)))); }
public static void Init() { if (!_knowTypesAdded) { XmlUtil.AddKnownType("WebPage", typeof(WebPage)); VPLUtil.DelegateLogIdeProfiling = DesignUtil.LogIdeProfile; _knowTypesAdded = true; // VirtualWebDir.OnValidationError = new EventHandler(MathNode.OnSetLastValidationError); // XmlUtil.CreateDesignTimeType = new fnCreateDesignTimeType(CreateClassType); // VPLUtil.GetClassTypeFromDynamicType = new fnGetClassTypeFromDynamicType(ClassPointerX.GetClassTypeFromDynamicType); VPLUtil.CollectLanguageIcons = ProjectResources.CollectLanguageIcons; VPLUtil.GetLanguageImageByName = TreeViewObjectExplorer.GetLangaugeBitmapByName; VPLUtil.SetServiceByName(VPLUtil.SERVICE_ComponentSelector, typeof(ComponentPointerSelector <EasyDataSet>)); VPLUtil.PropertyValueLinkEditor = ParameterValue.GetValueSelector(); VPLUtil.PropertyValueLinkType = typeof(PropertyValue); VPLUtil.delegateGetComponentID = GetComponentID; VPLUtil.delegateGetComponentList = GetProjectComponents; VPLUtil.RemoveDialogCaches = FrmObjectExplorer.RemoveDialogueCaches; VPLUtil.VariableMapTargetType = typeof(ParameterValue); // VariableMap.ValueTypeSelectorType = typeof(SelectorEnumValueType); // XmlSerializerUtility.OnCreateWriterFromReader = new fnCreateWriterFromReader(CreateWriterFromReader); // MathNode.Init(); MathNode.AddPlugin(typeof(MathNodeActionInput)); // XmlUtil.AddKnownType("ParameterValue", typeof(ParameterValue)); XmlUtil.AddKnownType("ActionClass", typeof(ActionClass)); XmlUtil.AddKnownType("SetterPointer", typeof(SetterPointer)); XmlUtil.AddKnownType("PropertyPointer", typeof(PropertyPointer)); XmlUtil.AddKnownType("ClassPointer", typeof(ClassPointer)); // XmlUtil.AddKnownType("MethodClass", typeof(MethodClass)); XmlUtil.AddKnownType("CustomMethodPointer", typeof(CustomMethodPointer)); XmlUtil.AddKnownType("ConstructorClass", typeof(ConstructorClass)); XmlUtil.AddKnownType("GetterClass", typeof(GetterClass)); XmlUtil.AddKnownType("PropertyClass", typeof(PropertyClass)); // XmlUtil.AddKnownType("SetterClass", typeof(SetterClass)); XmlUtil.AddKnownType("CustomPropertyPointer", typeof(CustomPropertyPointer)); XmlUtil.AddKnownType("UserControl", typeof(UserControl)); XmlUtil.AddKnownType("ConstObjectPointer", typeof(ConstObjectPointer)); XmlUtil.AddKnownType("DataTypePointer", typeof(DataTypePointer)); // XmlUtil.AddKnownType("Form", typeof(Form)); XmlUtil.AddKnownType("LimnorWinApp", typeof(LimnorWinApp)); XmlUtil.AddKnownType("ComponentPointer", typeof(ComponentPointer)); XmlUtil.AddKnownType("TypePointerCollection", typeof(TypePointerCollection)); XmlUtil.AddKnownType("MessageBox", typeof(MessageBox)); // XmlUtil.AddKnownType("WebService", typeof(WebService)); XmlUtil.AddKnownType("WebServiceAttribute", typeof(WebServiceAttribute)); XmlUtil.AddKnownType("WebMethodAttribute", typeof(WebMethodAttribute)); XmlUtil.AddKnownType("WebServiceBindingAttribute", typeof(WebServiceBindingAttribute)); // XmlUtil.AddKnownType("LimnorKioskApp", typeof(LimnorKioskApp)); XmlUtil.AddKnownType("LimnorConsole", typeof(LimnorConsole)); XmlUtil.AddKnownType("Console", typeof(Console)); XmlUtil.AddKnownType("Object", typeof(Object)); XmlUtil.AddKnownType("MethodInfoPointer", typeof(MethodInfoPointer)); // XmlUtil.AddKnownType("Control", typeof(Control)); XmlUtil.AddKnownType("EventAction", typeof(EventAction)); XmlUtil.AddKnownType("EventPointer", typeof(EventPointer)); XmlUtil.AddKnownType("TaskID", typeof(TaskID)); XmlUtil.AddKnownType("Button", typeof(Button)); // XmlUtil.AddKnownType("ActionMethodReturn", typeof(ActionMethodReturn)); XmlUtil.AddKnownType("MathNodeRoot", typeof(MathNodeRoot)); XmlUtil.AddKnownType("EnumIconType", typeof(EnumIconType)); XmlUtil.AddKnownType("Size", typeof(Size)); XmlUtil.AddKnownType("Font", typeof(Font)); // XmlUtil.AddKnownType("Color", typeof(Color)); XmlUtil.AddKnownType("Point", typeof(Point)); XmlUtil.AddKnownType("MathNodeVariable", typeof(MathNodeVariable)); XmlUtil.AddKnownType("RaisDataType", typeof(RaisDataType)); XmlUtil.AddKnownType("MathNodePropertyField", typeof(MathNodePropertyField)); // XmlUtil.AddKnownType("ActionAssignment", typeof(ActionAssignment)); XmlUtil.AddKnownType("MathNodePropertySetValue", typeof(MathNodePropertySetValue)); XmlUtil.AddKnownType("TypePointer", typeof(TypePointer)); XmlUtil.AddKnownType("AB_SingleAction", typeof(AB_SingleAction)); XmlUtil.AddKnownType("ActionPortOut", typeof(ActionPortOut)); // XmlUtil.AddKnownType("enumPositionType", typeof(enumPositionType)); XmlUtil.AddKnownType("DrawingVariable", typeof(DrawingVariable)); XmlUtil.AddKnownType("ActionPortIn", typeof(ActionPortIn)); XmlUtil.AddKnownType("PropertyReturnAction", typeof(PropertyReturnAction)); XmlUtil.AddKnownType("ParameterClass", typeof(ParameterClass)); // XmlUtil.AddKnownType("MemberComponentId", typeof(MemberComponentId)); XmlUtil.AddKnownType("MathNodeIntegral", typeof(MathNodeIntegral)); XmlUtil.AddKnownType("MathExpItem", typeof(MathExpItem)); XmlUtil.AddKnownType("MathExpGroup", typeof(MathExpGroup)); XmlUtil.AddKnownType("EnumIncludeReturnPorts", typeof(EnumIncludeReturnPorts)); // XmlUtil.AddKnownType("MathNodeArgument", typeof(MathNodeArgument)); XmlUtil.AddKnownType("MathNodeAssign", typeof(MathNodeAssign)); XmlUtil.AddKnownType("MathNodeCondition", typeof(MathNodeCondition)); XmlUtil.AddKnownType("MathNodeConditions", typeof(MathNodeConditions)); XmlUtil.AddKnownType("MathNodeDefaultValue", typeof(MathNodeDefaultValue)); // XmlUtil.AddKnownType("MathNodeFunction", typeof(MathNodeFunction)); XmlUtil.AddKnownType("MathNodeInc", typeof(MathNodeInc)); XmlUtil.AddKnownType("IntegerVariable", typeof(IntegerVariable)); XmlUtil.AddKnownType("Modulus", typeof(Modulus)); XmlUtil.AddKnownType("MathNodeBitAnd", typeof(MathNodeBitAnd)); // XmlUtil.AddKnownType("MathNodeBitOr", typeof(MathNodeBitOr)); XmlUtil.AddKnownType("LogicVariable", typeof(LogicVariable)); XmlUtil.AddKnownType("LogicFalse", typeof(LogicFalse)); XmlUtil.AddKnownType("LogicTrue", typeof(LogicTrue)); XmlUtil.AddKnownType("LogicNot", typeof(LogicNot)); // XmlUtil.AddKnownType("LogicAnd", typeof(LogicAnd)); XmlUtil.AddKnownType("LogicOr", typeof(LogicOr)); XmlUtil.AddKnownType("LogicGreaterThan", typeof(LogicGreaterThan)); XmlUtil.AddKnownType("LogicGreaterThanOrEqual", typeof(LogicGreaterThanOrEqual)); XmlUtil.AddKnownType("LogicValueEquality", typeof(LogicValueEquality)); // XmlUtil.AddKnownType("LogicValueInEquality", typeof(LogicValueInEquality)); XmlUtil.AddKnownType("LogicLessThan", typeof(LogicLessThan)); XmlUtil.AddKnownType("LogicLessThanOrEqual", typeof(LogicLessThanOrEqual)); XmlUtil.AddKnownType("MathNodeMethodInvoke", typeof(MathNodeMethodInvoke)); XmlUtil.AddKnownType("MathNodeParameter", typeof(MathNodeParameter)); // XmlUtil.AddKnownType("MathNodeStringContains", typeof(MathNodeStringContains)); XmlUtil.AddKnownType("MathNodeStringBegins", typeof(MathNodeStringBegins)); XmlUtil.AddKnownType("MathNodeStringEnds", typeof(MathNodeStringEnds)); XmlUtil.AddKnownType("MathNodeStringGT", typeof(MathNodeStringGT)); XmlUtil.AddKnownType("MathNodeStringGET", typeof(MathNodeStringGET)); // XmlUtil.AddKnownType("MathNodeStringLT", typeof(MathNodeStringLT)); XmlUtil.AddKnownType("MathNodeStringLET", typeof(MathNodeStringLET)); XmlUtil.AddKnownType("MathNodeStringEQ", typeof(MathNodeStringEQ)); XmlUtil.AddKnownType("MathNodeStringValue", typeof(MathNodeStringValue)); XmlUtil.AddKnownType("StringVariable", typeof(StringVariable)); // XmlUtil.AddKnownType("MathNodeStringAdd", typeof(MathNodeStringAdd)); XmlUtil.AddKnownType("MathNodeSum", typeof(MathNodeSum)); XmlUtil.AddKnownType("MathNodeValue", typeof(MathNodeValue)); XmlUtil.AddKnownType("MathNodeNumber", typeof(MathNodeNumber)); XmlUtil.AddKnownType("MathNodeVariable", typeof(MathNodeVariable)); // XmlUtil.AddKnownType("MathNodeVariableDummy", typeof(MathNodeVariableDummy)); XmlUtil.AddKnownType("MathNodeSqrt", typeof(MathNodeSqrt)); XmlUtil.AddKnownType("MathNodeAbs", typeof(MathNodeAbs)); XmlUtil.AddKnownType("MathNodeAcos", typeof(MathNodeAcos)); XmlUtil.AddKnownType("MathNodeAsin", typeof(MathNodeAsin)); // XmlUtil.AddKnownType("MathNodeAtan", typeof(MathNodeAtan)); XmlUtil.AddKnownType("MathNodeAtan2", typeof(MathNodeAtan2)); XmlUtil.AddKnownType("MathNodeCeiling", typeof(MathNodeCeiling)); XmlUtil.AddKnownType("MathNodeCos", typeof(MathNodeCos)); XmlUtil.AddKnownType("MathNodeCos2", typeof(MathNodeCos2)); // XmlUtil.AddKnownType("MathNodeCosh", typeof(MathNodeCosh)); XmlUtil.AddKnownType("MathNodeFloor", typeof(MathNodeFloor)); XmlUtil.AddKnownType("MathNodeIEEERemainder", typeof(MathNodeIEEERemainder)); XmlUtil.AddKnownType("MathNodeConstE", typeof(MathNodeConstE)); XmlUtil.AddKnownType("MathNodeConstPI", typeof(MathNodeConstPI)); // XmlUtil.AddKnownType("MathNodeExp", typeof(MathNodeExp)); XmlUtil.AddKnownType("MathNodeLog", typeof(MathNodeLog)); XmlUtil.AddKnownType("MathNodeLog10", typeof(MathNodeLog10)); XmlUtil.AddKnownType("MathNodeLogX", typeof(MathNodeLogX)); XmlUtil.AddKnownType("MathNodeMax", typeof(MathNodeMax)); // XmlUtil.AddKnownType("MathNodeMin", typeof(MathNodeMin)); XmlUtil.AddKnownType("MathNodeRound", typeof(MathNodeRound)); XmlUtil.AddKnownType("MathNodeRound2", typeof(MathNodeRound2)); XmlUtil.AddKnownType("MathNodeSign", typeof(MathNodeSign)); XmlUtil.AddKnownType("MathNodeSin", typeof(MathNodeSin)); // XmlUtil.AddKnownType("MathNodeSinh", typeof(MathNodeSinh)); XmlUtil.AddKnownType("MathNodeTan", typeof(MathNodeTan)); XmlUtil.AddKnownType("MathNodeTanh", typeof(MathNodeTanh)); XmlUtil.AddKnownType("MathNodeTruncate", typeof(MathNodeTruncate)); XmlUtil.AddKnownType("MathNodePower", typeof(MathNodePower)); // XmlUtil.AddKnownType("LinkLineNodeInPort", typeof(LinkLineNodeInPort)); XmlUtil.AddKnownType("EventHandlerMethod", typeof(EventHandlerMethod)); XmlUtil.AddKnownType("ComponentIconPublic", typeof(ComponentIconPublic)); XmlUtil.AddKnownType("ComponentIconLocal", typeof(ComponentIconLocal)); XmlUtil.AddKnownType("ComponentIconMethodReturnPointer", typeof(ComponentIconMethodReturnPointer)); XmlUtil.AddKnownType("HandlerMathodID", typeof(HandlerMethodID)); // XmlUtil.AddKnownType("AB_ActionString", typeof(AB_ActionString)); XmlUtil.AddKnownType("LinkLineNode", typeof(LinkLineNode)); XmlUtil.AddKnownType("PlusNode", typeof(PlusNode)); XmlUtil.AddKnownType("DivNode", typeof(DivNode)); XmlUtil.AddKnownType("MinusNode", typeof(MinusNode)); // XmlUtil.AddKnownType("MultiplyNode", typeof(MultiplyNode)); XmlUtil.AddKnownType("MultiplyNodeBig", typeof(MultiplyNodeBig)); XmlUtil.AddKnownType("ArrayVariable", typeof(ArrayVariable)); XmlUtil.AddKnownType("ComponentIconArrayPointer", typeof(ComponentIconArrayPointer)); XmlUtil.AddKnownType("ArrayPointer", typeof(ArrayPointer)); // XmlUtil.AddKnownType("ConstructorPointer", typeof(ConstructorPointer)); XmlUtil.AddKnownType("LocalVariable", typeof(LocalVariable)); XmlUtil.AddKnownType("CustomMethodReturnPointer", typeof(CustomMethodReturnPointer)); XmlUtil.AddKnownType("AB_SubMethodAction", typeof(AB_SubMethodAction)); XmlUtil.AddKnownType("ActionSubMethod", typeof(ActionSubMethod)); XmlUtil.AddKnownType("SubMethodInfoPointer", typeof(SubMethodInfoPointer)); // XmlUtil.AddKnownType("ComponentIconParameter", typeof(ComponentIconParameter)); XmlUtil.AddKnownType("ParameterClassArrayIndex", typeof(ParameterClassArrayIndex)); XmlUtil.AddKnownType("ParameterClassArrayItem", typeof(ParameterClassArrayItem)); XmlUtil.AddKnownType("AB_ConditionBranch", typeof(AB_ConditionBranch)); XmlUtil.AddKnownType("Label", typeof(System.Windows.Forms.Label)); // XmlUtil.AddKnownType("PropertyValueClass", typeof(PropertyValueClass)); XmlUtil.AddKnownType("MethodReturnMethod", typeof(MethodReturnMethod)); XmlUtil.AddKnownType("AB_MethodReturn", typeof(AB_MethodReturn)); XmlUtil.AddKnownType("MathNodeActionInput", typeof(MathNodeActionInput)); XmlUtil.AddKnownType("InterfaceClass", typeof(InterfaceClass)); // XmlUtil.AddKnownType("InterfaceElementMethod", typeof(InterfaceElementMethod)); XmlUtil.AddKnownType("InterfacePointer", typeof(InterfacePointer)); XmlUtil.AddKnownType("InterfaceElementEvent", typeof(InterfaceElementEvent)); XmlUtil.AddKnownType("InterfaceElementProperty", typeof(InterfaceElementProperty)); XmlUtil.AddKnownType("NamedDataType", typeof(NamedDataType)); // XmlUtil.AddKnownType("InterfaceElementMethodParameter", typeof(InterfaceElementMethodParameter)); XmlUtil.AddKnownType("PropertyOverride", typeof(PropertyOverride)); XmlUtil.AddKnownType("CustomPropertyOverridePointer", typeof(CustomPropertyOverridePointer)); XmlUtil.AddKnownType("ParameterClassBaseProperty", typeof(ParameterClassBaseProperty)); XmlUtil.AddKnownType("BaseMethod", typeof(BaseMethod)); // XmlUtil.AddKnownType("MethodOverride", typeof(MethodOverride)); XmlUtil.AddKnownType("EventClass", typeof(EventClass)); XmlUtil.AddKnownType("ActionInput", typeof(ActionInput)); XmlUtil.AddKnownType("CustomEventPointer", typeof(CustomEventPointer)); XmlUtil.AddKnownType("CustomMethodParameterPointer", typeof(CustomMethodParameterPointer)); // XmlUtil.AddKnownType("InterfaceMethodPointer", typeof(InterfaceMethodPointer)); XmlUtil.AddKnownType("InterfacePropertyPointer", typeof(InterfacePropertyPointer)); XmlUtil.AddKnownType("InterfaceMethodPointer", typeof(InterfaceMethodPointer)); XmlUtil.AddKnownType("InterfaceEventPointer", typeof(InterfaceEventPointer)); XmlUtil.AddKnownType("InterfaceCustomProperty", typeof(InterfaceCustomProperty)); // XmlUtil.AddKnownType("AB_DecisionTableActions", typeof(AB_DecisionTableActions)); XmlUtil.AddKnownType("DecisionTable", typeof(DecisionTable)); XmlUtil.AddKnownType("MathNodeRandom", typeof(MathNodeRandom)); XmlUtil.AddKnownType("AB_ActionList", typeof(AB_ActionList)); XmlUtil.AddKnownType("ActionItem", typeof(ActionItem)); // XmlUtil.AddKnownType("ClassInstancePointer", typeof(ClassInstancePointer)); XmlUtil.AddKnownType("AB_LoopActions", typeof(AB_LoopActions)); XmlUtil.AddKnownType("ActionAssignInstance", typeof(ActionAssignInstance)); XmlUtil.AddKnownType("AB_ForLoop", typeof(AB_ForLoop)); XmlUtil.AddKnownType("ActionBranchParameter", typeof(ActionBranchParameter)); // XmlUtil.AddKnownType("ComponentIconActionBranchParameter", typeof(ComponentIconActionBranchParameter)); XmlUtil.AddKnownType("ActionBranchParameterPointer", typeof(ActionBranchParameterPointer)); XmlUtil.AddKnownType("EnumImageFormat", typeof(EnumImageFormat)); XmlUtil.AddKnownType("AB_Constructor", typeof(AB_Constructor)); XmlUtil.AddKnownType("ExpressionValue", typeof(ExpressionValue)); // XmlUtil.AddKnownType("CustomEventHandlerType", typeof(CustomEventHandlerType)); XmlUtil.AddKnownType("MemberComponentIdCustom", typeof(MemberComponentIdCustom)); XmlUtil.AddKnownType("Environment", typeof(Environment)); XmlUtil.AddKnownType("String[]", typeof(String[])); XmlUtil.AddKnownType("StringCollectionVariable", typeof(StringCollectionVariable)); // XmlUtil.AddKnownType("StringCollectionPointer", typeof(StringCollectionPointer)); XmlUtil.AddKnownType("FireEventMethod", typeof(FireEventMethod)); XmlUtil.AddKnownType("FieldPointer", typeof(FieldPointer)); XmlUtil.AddKnownType("NullObjectPointer", typeof(NullObjectPointer)); XmlUtil.AddKnownType("BreakActionMethod", typeof(BreakActionMethod)); // XmlUtil.AddKnownType("AB_Break", typeof(AB_Break)); XmlUtil.AddKnownType("AttributeConstructor", typeof(AttributeConstructor)); XmlUtil.AddKnownType("IXDesignerViewer", typeof(IXDesignerViewer)); XmlUtil.AddKnownType("EnumMaxButtonLocation", typeof(EnumMaxButtonLocation)); XmlUtil.AddKnownType("ICustomEventMethodDescriptor", typeof(ICustomEventMethodDescriptor)); // XmlUtil.AddKnownType("MultiPanes", typeof(MultiPanes)); XmlUtil.AddKnownType("IAction", typeof(IAction)); XmlUtil.AddKnownType("INonHostedObject", typeof(INonHostedObject)); XmlUtil.AddKnownType("LimnorService", typeof(LimnorService)); XmlUtil.AddKnownType("TextBox", typeof(TextBox)); // XmlUtil.AddKnownType("GroupBox", typeof(GroupBox)); XmlUtil.AddKnownType("EventPortOutExecuteMethod", typeof(EventPortOutExecuteMethod)); XmlUtil.AddKnownType("EventPortOutExecuter", typeof(EventPortOutExecuter)); XmlUtil.AddKnownType("ComponentIconMethod", typeof(ComponentIconMethod)); XmlUtil.AddKnownType("EventPathData", typeof(EventPathData)); // XmlUtil.AddKnownType("ComponentIconEvent", typeof(ComponentIconEvent)); XmlUtil.AddKnownType("ComponentIconEventhandle", typeof(ComponentIconEventhandle)); XmlUtil.AddKnownType("ActionAssignComponent", typeof(ActionAssignComponent)); XmlUtil.AddKnownType("ComponentIconCollectionPointer", typeof(ComponentIconCollectionPointer)); XmlUtil.AddKnownType("CollectionTypePointer", typeof(CollectionTypePointer)); // XmlUtil.AddKnownType("CollectionVariable", typeof(CollectionVariable)); XmlUtil.AddKnownType("ParameterClassCollectionItem", typeof(ParameterClassCollectionItem)); XmlUtil.AddKnownType("CustomConstructorPointer", typeof(CustomConstructorPointer)); XmlUtil.AddKnownType("ComponentIconProperty", typeof(ComponentIconProperty)); XmlUtil.AddKnownType("EventPortOutSetProperty", typeof(EventPortOutSetProperty)); // XmlUtil.AddKnownType("ComponentIconFireEvent", typeof(ComponentIconFireEvent)); XmlUtil.AddKnownType("EventPortOutFirer", typeof(EventPortOutFirer)); XmlUtil.AddKnownType("EventPortInFireEvent", typeof(EventPortInFireEvent)); XmlUtil.AddKnownType("EventPortIn", typeof(EventPortIn)); XmlUtil.AddKnownType("EventHandler", typeof(EventHandler)); // XmlUtil.AddKnownType("EventArgs", typeof(EventArgs)); XmlUtil.AddKnownType("MemberComponentIdInstance", typeof(MemberComponentIdInstance)); XmlUtil.AddKnownType("MemberComponentIdCustomInstance", typeof(MemberComponentIdCustomInstance)); XmlUtil.AddKnownType("LimnorScreenSaverApp", typeof(LimnorScreenSaverApp)); XmlUtil.AddKnownType("CollectionPointer", typeof(CollectionPointer)); // XmlUtil.AddKnownType("AB_CastAs", typeof(AB_CastAs)); XmlUtil.AddKnownType("Component", typeof(Component)); XmlUtil.AddKnownType("ComponentIconClass", typeof(ComponentIconClass)); XmlUtil.AddKnownType("ComponentIconClassType", typeof(ComponentIconClassType)); XmlUtil.AddKnownType("EventPortOutTypeAction", typeof(EventPortOutTypeAction)); // XmlUtil.AddKnownType("EventPortOutClassTypeAction", typeof(EventPortOutClassTypeAction)); XmlUtil.AddKnownType("MemberComponentIdDefaultInstance", typeof(MemberComponentIdDefaultInstance)); XmlUtil.AddKnownType("ExceptionHandler", typeof(ExceptionHandler)); XmlUtil.AddKnownType("ExceptionHandlerList", typeof(ExceptionHandlerList)); XmlUtil.AddKnownType("SelectExceptionToHandle", typeof(SelectExceptionToHandle)); // XmlUtil.AddKnownType("ComponentIconLocalSubScope", typeof(ComponentIconException)); XmlUtil.AddKnownType("SubscopeActions", typeof(SubscopeActions)); XmlUtil.AddKnownType("ComponentIconSubscopeVariable", typeof(ComponentIconSubscopeVariable)); XmlUtil.AddKnownType("ComponentID", typeof(ComponentID)); XmlUtil.AddKnownType("ListVariable", typeof(ListVariable)); // XmlUtil.AddKnownType("ComponentIconListPointer", typeof(ComponentIconListPointer)); XmlUtil.AddKnownType("ListTypePointer", typeof(ListTypePointer)); XmlUtil.AddKnownType("RuntimeInstance", typeof(RuntimeInstance)); XmlUtil.AddKnownType("ActionSubMethodGlobal", typeof(ActionSubMethodGlobal)); XmlUtil.AddKnownType("SubMethodInfoPointerGlobal", typeof(SubMethodInfoPointerGlobal)); // XmlUtil.AddKnownType("MethodActionForeachAtServer", typeof(MethodActionForeachAtServer)); XmlUtil.AddKnownType("MethodActionForeachAtClient", typeof(MethodActionForeachAtClient)); XmlUtil.AddKnownType("MethodDataTransfer", typeof(MethodDataTransfer)); XmlUtil.AddKnownType("StringMapList", typeof(StringMapList)); XmlUtil.AddKnownType("StringMap", typeof(StringMap)); // XmlUtil.AddKnownType("ParameterValueArrayItem", typeof(ParameterValueArrayItem)); XmlUtil.AddKnownType("NameTypePair", typeof(NameTypePair)); XmlUtil.AddKnownType("InlineAction", typeof(InlineAction)); XmlUtil.AddKnownType("AB_Group", typeof(AB_Group)); XmlUtil.AddKnownType("FileDownloadEventArgs", typeof(FileDownloadEventArgs)); // XmlUtil.AddKnownType("BrowserNavigationEventArgs", typeof(BrowserNavigationEventArgs)); XmlUtil.AddKnownType("ConstValueSelector", typeof(ConstValueSelector)); XmlUtil.AddKnownType("EnumBorderStyle", typeof(EnumBorderStyle)); XmlUtil.AddKnownType("EnumBorderWidthStyle", typeof(EnumBorderWidthStyle)); // XmlUtil.AddKnownType("WebClientEventHandlerMethodDownloadActions", typeof(WebClientEventHandlerMethodDownloadActions)); XmlUtil.AddKnownType("WebMouseEventArgs", typeof(WebMouseEventArgs)); XmlUtil.AddKnownType("WebKeyEventArgs", typeof(WebKeyEventArgs)); XmlUtil.AddKnownType("FileDownloadEventHandler", typeof(FileDownloadEventHandler)); // XmlUtil.AddKnownType("HtmlElementPointer", typeof(HtmlElementPointer)); XmlUtil.AddKnownType("ComponentIconHtmlElement", typeof(ComponentIconHtmlElement)); XmlUtil.AddKnownType("ComponentIconHtmlElementCurrent", typeof(ComponentIconHtmlElementCurrent)); XmlUtil.AddKnownType("WebClientEventHandlerMethodClientActions", typeof(WebClientEventHandlerMethodClientActions)); XmlUtil.AddKnownType("WebClientEventHandlerMethodServerActions", typeof(WebClientEventHandlerMethodServerActions)); // XmlUtil.AddKnownType("IWebClientControl", typeof(IWebClientControl)); XmlUtil.AddKnownType("WebMouseButton", typeof(WebMouseButton)); XmlUtil.AddKnownType("IWebClientComponent", typeof(IWebClientComponent)); XmlUtil.AddKnownType("CollectionComponents", typeof(CollectionComponentNames)); // XmlUtil.AddKnownType("LogonUser", typeof(LogonUser)); XmlUtil.AddKnownType("CustomInterfaceMethodPointer", typeof(CustomInterfaceMethodPointer)); // Type[] ts = typeof(HtmlElement_body).Assembly.GetExportedTypes(); for (int i = 0; i < ts.Length; i++) { if (typeof(HtmlElement_Base).IsAssignableFrom(ts[i])) { XmlUtil.AddKnownType(ts[i].Name, ts[i]); } } XmlUtil.AddKnownType("WebClientValueCollection", typeof(WebClientValueCollection)); // XmlUtil.AddKnownType("OLECMDF", typeof(OLECMDF)); XmlUtil.AddKnownType("OLECMDID", typeof(OLECMDID)); XmlUtil.AddKnownType("OLECMDEXECOPT", typeof(OLECMDEXECOPT)); XmlUtil.AddKnownType("EnumPopupLevel", typeof(EnumPopupLevel)); XmlUtil.AddKnownType("IWebBrowser2", typeof(IWebBrowser2)); // XmlUtil.AddKnownType("ConnectionItem", typeof(ConnectionItem)); XmlUtil.AddKnownType("PluginManager`1", typeof(PluginManager <>)); XmlUtil.AddKnownType("MethodAssignActions", typeof(MethodAssignActions)); XmlUtil.AddKnownType("AB_AssignActions", typeof(AB_AssignActions)); XmlUtil.AddKnownType("ActionAttachEvent", typeof(ActionAttachEvent)); XmlUtil.AddKnownType("ActionDetachEvent", typeof(ActionDetachEvent)); // XmlUtil.AddKnownType("EventHandlerDataChanged", typeof(EventHandlerDataChanged)); XmlUtil.AddKnownType("EventArgsDataName", typeof(EventArgsDataName)); XmlUtil.AddKnownType("IPluginManager", typeof(IPluginManager)); XmlUtil.AddKnownType("IPlugin", typeof(IPlugin)); // XmlUtil.AddKnownType("ILicenseRequestHandler", typeof(ILicenseRequestHandler)); XmlUtil.AddKnownType("EventArgsRegister", typeof(EventArgsRegister)); XmlUtil.AddKnownType("CopyProtector", typeof(CopyProtector)); XmlUtil.AddKnownType("EnumHideDialogButtons", typeof(EnumHideDialogButtons)); XmlUtil.AddKnownType("VplMethodPointer", typeof(VplMethodPointer)); } }
async static void GenerateData(object userContext) { Dictionary <string, string> paramCurrentValues = new Dictionary <string, string>(); Console.WriteLine("########### STARTING SIMULATOR ################"); int erraticCounter = 1; Boolean isErratic = false; ModuleClient moduleClient = (ModuleClient)userContext; Message message = null; while (true) { try { if (config == null || config.algorithm == null || config.algorithm.Trim().Equals("")) { Console.WriteLine("Awaiting configuration... "); Thread.Sleep(1000); } else { counter++; var prevValue = paramCurrentValues; paramCurrentValues = new Dictionary <string, string>(); //paramCurrentValues.Add("cycle", counter.ToString()); paramCurrentValues.Add("timestamp", DateTime.Now.ToString()); paramCurrentValues.Add("deviceName", Environment.GetEnvironmentVariable("IOTEDGE_DEVICEID")); //paramCurrentValues.Add("moduleId", Environment.GetEnvironmentVariable("PUMP_ID")); if (reset) { Console.WriteLine("########### RE-STARTING SIMULATOR" + (counter) + " ################"); foreach (String paramItem in config.paramValues.Keys) { paramCurrentValues.Add(config.paramValues[paramItem].name, config.paramValues[paramItem].avg.ToString()); } erraticCounter = 1; isErratic = false; Console.WriteLine("Current Values: " + JsonConvert.SerializeObject(paramCurrentValues)); message = createMessage(paramCurrentValues); await moduleClient.SendEventAsync("output1", message); reset = false; } else { Console.WriteLine("########### CONTINUING SIMULATOR" + (counter) + " ################"); switch (config.algorithm) { case ALG_STABLE: Random rnd = new Random(); List <ParameterValue> sensorList = new List <ParameterValue>(); foreach (String paramItem in config.paramValues.Keys) { var sensorDataValues = new ParameterValue(); ParamValue item = config.paramValues[paramItem]; var ramdomSeed = GetRandomNumber(-0.09, 0.09); var value = (((item.max + item.min)) / 2) * (1 + ramdomSeed); //Old changes //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Value"),value.ToString()); //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Unit"),config.paramValues[paramItem].uom.ToString()); //changes for new client sensorDataValues.Name = item.name; sensorDataValues.Value = value.ToString(); sensorDataValues.Unit = item.uom; sensorDataValues.Status = "Good"; sensorDataValues.ValueType = null; sensorList.Add(sensorDataValues); } String parameterValues = JsonConvert.SerializeObject(sensorList); parameterValues.Replace("\"[", "["); parameterValues.Replace("]\"", "]"); parameterValues.Replace("\\", ""); paramCurrentValues.Add("ParameterValues", parameterValues); Console.WriteLine("Current Values: " + JsonConvert.SerializeObject(paramCurrentValues)); message = createMessage(paramCurrentValues); await moduleClient.SendEventAsync("output1", message); Console.WriteLine("message sent"); break; case ALG_DECAY: Console.WriteLine("Previous Values: " + JsonConvert.SerializeObject(paramCurrentValues)); List <ParameterValue> decaySensorList = new List <ParameterValue>(); foreach (String paramItem in config.paramValues.Keys) { var sensorDataValues = new ParameterValue(); ParamValue item = config.paramValues[paramItem]; var value = 0.0; Console.WriteLine("param: " + paramItem + " value: " + prevValue.GetValueOrDefault(config.paramValues[paramItem].name)); if (prevValue.ContainsKey(config.paramValues[paramItem].name)) { value = Double.Parse(prevValue.GetValueOrDefault(config.paramValues[paramItem].name)); } else if (prevValue.ContainsKey(config.paramValues[paramItem].name.ToLower() + "Value")) { value = Double.Parse(prevValue.GetValueOrDefault(config.paramValues[paramItem].name.ToLower() + "Value")); } value = value - value * config.decayRate; if (value > config.paramValues[paramItem].min || value < config.paramValues[paramItem].max) { // paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Value"),value.ToString()); //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Unit"),config.paramValues[paramItem].uom.ToString()); sensorDataValues.Name = item.name; sensorDataValues.Value = value.ToString(); sensorDataValues.Unit = item.uom; sensorDataValues.Status = "Good"; sensorDataValues.ValueType = null; decaySensorList.Add(sensorDataValues); } } String decayParameterValues = JsonConvert.SerializeObject(decaySensorList); decayParameterValues.Replace("\"[", "["); decayParameterValues.Replace("]\"", "]"); decayParameterValues.Replace("\\", ""); paramCurrentValues.Add("ParameterValues", decayParameterValues); Console.WriteLine("Current Values: " + JsonConvert.SerializeObject(paramCurrentValues)); message = createMessage(paramCurrentValues); await moduleClient.SendEventAsync("output1", message); Console.WriteLine("message sent"); break; case ALG_ERRATIC: List <ParameterValue> erraticSensorList = new List <ParameterValue>(); if (!isErratic) { foreach (String paramItem in config.paramValues.Keys) { var sensorDataValues = new ParameterValue(); ParamValue item = config.paramValues[paramItem]; var ramdomSeed = GetRandomNumber(-0.09, 0.09); var value = (((item.max + item.min)) / 2) * (1 + ramdomSeed); //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Value"),value.ToString()); //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Unit"),config.paramValues[paramItem].uom.ToString()); sensorDataValues.Name = item.name; sensorDataValues.Value = value.ToString(); sensorDataValues.Unit = item.uom; sensorDataValues.Status = "Good"; sensorDataValues.ValueType = null; erraticSensorList.Add(sensorDataValues); } erraticCounter++; if (erraticCounter > config.erraticFreq) { erraticCounter = 1; isErratic = true; } } else { foreach (String paramItem in config.paramValues.Keys) { var sensorDataValues = new ParameterValue(); ParamValue item = config.paramValues[paramItem]; var ramdomSeed = GetRandomNumber(0.01, 0.1); var value = item.min - ramdomSeed; //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Value"),value.ToString()); //paramCurrentValues.Add((((config.paramValues[paramItem].name).ToLower())+"Unit"),config.paramValues[paramItem].uom.ToString()); sensorDataValues.Name = item.name; sensorDataValues.Value = value.ToString(); sensorDataValues.Unit = item.uom; sensorDataValues.Status = "Good"; sensorDataValues.ValueType = null; erraticSensorList.Add(sensorDataValues); } erraticCounter++; if (erraticCounter > config.erraticCount) { erraticCounter = 0; isErratic = false; } } String erraticParameterValues = JsonConvert.SerializeObject(erraticSensorList); erraticParameterValues.Replace("\"[", "["); erraticParameterValues.Replace("]\"", "]"); erraticParameterValues.Replace("\\", ""); paramCurrentValues.Add("ParameterValues", erraticParameterValues); Console.WriteLine("Current Values: " + JsonConvert.SerializeObject(paramCurrentValues)); message = createMessage(paramCurrentValues); await moduleClient.SendEventAsync("output1", message); Console.WriteLine("message sent"); break; } } Console.WriteLine("Waiting for: " + config.dataFreq + "msec"); Thread.Sleep(config.dataFreq); } } catch (Exception e) { Console.WriteLine("Error occured: " + e); } } }
/// <summary> /// Creates an assignment object to be submitted /// </summary> /// <param name="identityType"></param> /// <param name="bpLocation"></param> /// <param name="blueprintId"></param> /// <param name="lockMode"></param> /// <param name="Parameters"></param> /// <param name="ResourceGroups"></param> /// <returns></returns> protected Assignment CreateAssignmentObject(string identityType, string userAssignedIdentity, string bpLocation, string blueprintId, PSLockMode? lockMode, Hashtable parameters, Hashtable resourceGroups, Hashtable secureStringParameters) { Dictionary<string, UserAssignedIdentity> userAssignedIdentities = null; if (userAssignedIdentity != null) { userAssignedIdentities = new Dictionary<string, UserAssignedIdentity>() { { userAssignedIdentity, new UserAssignedIdentity() } }; } var localAssignment = new Assignment { Identity = new ManagedServiceIdentity { Type = identityType, UserAssignedIdentities = userAssignedIdentities }, Location = bpLocation, BlueprintId = blueprintId, Locks = new AssignmentLockSettings { Mode = lockMode == null ? PSLockMode.None.ToString() : lockMode.ToString() }, Parameters = new Dictionary<string, ParameterValueBase>(), ResourceGroups = new Dictionary<string, ResourceGroupValue>() }; if (parameters != null) { foreach (var key in parameters.Keys) { var value = new ParameterValue(parameters[key], null); localAssignment.Parameters.Add(key.ToString(), value); } } if (secureStringParameters != null) { foreach (var key in secureStringParameters.Keys) { var kvp = secureStringParameters[key] as Hashtable; string keyVaultId = null; string secretName = null; string secretVersion = null; foreach (var k in kvp.Keys) { var paramKey = k.ToString(); if (string.Equals(paramKey, "keyVaultId", StringComparison.InvariantCultureIgnoreCase)) { keyVaultId = kvp[k].ToString(); } else if (string.Equals(paramKey, "secretName", StringComparison.InvariantCultureIgnoreCase)) { secretName = kvp[k].ToString(); } else if (string.Equals(paramKey, "secretVersion", StringComparison.InvariantCultureIgnoreCase)) { secretVersion = kvp[k].ToString(); } } var secretValue = new SecretReferenceParameterValue(new SecretValueReference(new KeyVaultReference(keyVaultId), secretName, secretVersion)); localAssignment.Parameters.Add(key.ToString(), secretValue); } } if (resourceGroups != null) { foreach (var key in resourceGroups.Keys) { var kvp = resourceGroups[key] as Hashtable; string name = null; string location = null; foreach (var k in kvp.Keys) { var rgKey = k.ToString(); if (string.Equals(rgKey, "name", StringComparison.InvariantCultureIgnoreCase)) { name = kvp[k].ToString(); } if (string.Equals(rgKey, "location", StringComparison.InvariantCultureIgnoreCase)) { location = kvp[k].ToString(); } } var rgv = new ResourceGroupValue(name, location); localAssignment.ResourceGroups.Add(key.ToString(), rgv); } } return localAssignment; }
private void ScheduleReport() { // See if the user wants to schedule this vs. run it now if (sharedSchedules.SelectedValue.ToString() != "NS") { string desc = "Send report via email"; string eventType = String.Empty; string matchData = String.Empty; // If the user selected SnapShot then set up the parameters for a snapshot if (sharedSchedules.SelectedValue.ToString() == "SS") { eventType = "SnapshotUpdated"; matchData = null; } // otherwise the user is using a subscription else { eventType = "TimedSubscription"; matchData = sharedSchedules.SelectedValue.ToString(); } ParameterValue[] extensionParams = new ParameterValue[8]; extensionParams[0] = new ParameterValue(); extensionParams[0].Name = "TO"; extensionParams[0].Value = GetEmailFromAD(); extensionParams[1] = new ParameterValue(); extensionParams[1].Name = "ReplyTo"; extensionParams[1].Value = "*****@*****.**"; extensionParams[2] = new ParameterValue(); extensionParams[2].Name = "IncludeReport"; extensionParams[2].Value = "True"; extensionParams[3] = new ParameterValue(); extensionParams[3].Name = "RenderFormat"; extensionParams[3].Value = "PDF"; extensionParams[4] = new ParameterValue(); extensionParams[4].Name = "Subject"; extensionParams[4].Value = "@ReportName was executed at @ExecutionTime"; extensionParams[5] = new ParameterValue(); extensionParams[5].Name = "Comment"; extensionParams[5].Value = "Here is your @ReportName report."; extensionParams[6] = new ParameterValue(); extensionParams[6].Name = "IncludeLink"; extensionParams[6].Value = "True"; extensionParams[7] = new ParameterValue(); extensionParams[7].Name = "Priority"; extensionParams[7].Value = "NORMAL"; // Configure the extension settings required for the CreateSubscription method ExtensionSettings extSettings = new ExtensionSettings(); extSettings.ParameterValues = extensionParams; extSettings.Extension = "Report Server Email"; // Get the reports parameters using the GetParameters form GetParameters reportParameters = new GetParameters(url); reportParameters.ShowDialog(); Microsoft.Reporting.WinForms.ReportParameter[] rps = reportParameters.Parameters; // Convert the Winforms.ReportParameter returned from the GetParameters // to ParameterValues required for the CreateSubscription method int i = 0; foreach (Microsoft.Reporting.WinForms.ReportParameter rp in rps) { if (rp.Values.Count != 0) { i++; } } ParameterValue[] pvs = new ParameterValue[i]; int j = 0; foreach (Microsoft.Reporting.WinForms.ReportParameter rp in rps) { if (rp.Values.Count != 0) { pvs[j] = new ParameterValue(); pvs[j].Name = rp.Name; pvs[j].Value = rp.Values[0]; j++; } } // Now setup the subscription try { rs.CreateSubscription(report, extSettings, desc, eventType, matchData, pvs); } catch (SoapException ex) { MessageBox.Show(ex.Detail.InnerXml.ToString()); } } }
internal InjectedProperty(string propertyName, ParameterValue propertyValue) { this.PropertyName = propertyName; this.PropertyValue = propertyValue; }
/// <summary> /// Исполнение блока sql-команд /// </summary> /// <param name="query">Sql-команда</param> /// <param name="parameterID">Параметр, возвращающий значение новой записи</param> /// <param name="commandType">Тип команды, если не указан, то определяется по содержанию ключевого слова <b>begin</b></param> protected void ExecuteBlock(Query query, ParameterValue parameterID, System.Data.CommandType? commandType = null) { IDbCommand command = CreateCommand(query); if (commandType.HasValue) command.CommandType = commandType.Value; else if (!command.CommandText.ToLower().Contains("begin")) command.CommandType = System.Data.CommandType.StoredProcedure; IDataParameter id = null; if (!object.ReferenceEquals(parameterID, null) && command.Parameters.Count > 0) { id = (IDataParameter)command.Parameters[0]; id.Direction = ParameterDirection.Output; id.DbType = DbType.Int32; } try { command.ExecuteNonQuery(); if (id != null) parameterID.Value = id.Value; } catch (Exception e) { throw WrapException(e, command); } }
public Actuator(FlightControlSystem fcs, XmlElement element) : base(fcs, element) { // inputs are read from the base class constructor PreviousOutput = 0.0; PreviousHystOutput = 0.0; PreviousRateLimOutput = 0.0; PreviousLagInput = PreviousLagOutput = 0.0; bias = lag = hysteresis_width = deadband_width = 0.0; rate_limit_incr = rate_limit_decr = null; // no limit fail_zero = fail_hardover = fail_stuck = false; ca = cb = 0.0; initialized = false; saturated = false; if (element.FindElement("deadband_width") != null) { deadband_width = element.FindElementValueAsNumber("deadband_width"); } if (element.FindElement("hysteresis_width") != null) { hysteresis_width = element.FindElementValueAsNumber("hysteresis_width"); } // There can be a single rate limit specified, or increasing and // decreasing rate limits specified, and rate limits can be numeric, or // a property. XmlNodeList nodeList = element.GetElementsByTagName("rate_limit"); foreach (var node in nodeList) { XmlElement ratelim_el = node as XmlElement; if (ratelim_el != null) { string rate_limit_str = ratelim_el.InnerText; Parameter rate_limit = new ParameterValue(rate_limit_str, propertyManager); if (ratelim_el.HasAttribute("sense")) { string sense = ratelim_el.GetAttribute("sense"); if (sense.StartsWith("incr")) { rate_limit_incr = rate_limit; } else if (sense.StartsWith("decr")) { rate_limit_decr = rate_limit; } } else { rate_limit_incr = rate_limit; rate_limit_decr = rate_limit; } } } if (element.FindElement("bias") != null) { bias = element.FindElementValueAsNumber("bias"); } if (element.FindElement("lag") != null) { lag = element.FindElementValueAsNumber("lag"); double denom = 2.00 + dt * lag; ca = dt * lag / denom; cb = (2.00 - dt * lag) / denom; } Bind(element); Debug(0); }
public string FormatValue(ParameterValue value, EvaluationContext context) { return string.Format(context.Language.Culture, "{0:" + FormatExpression + "}", value.Value); }
public void SetSubscriptionProperties(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) { this.Invoke("SetSubscriptionProperties", new object[] { SubscriptionID, ExtensionSettings, Description, EventType, MatchData, Parameters}); }
public static LookupBlockDefinition.LookupTableRow AddValue(this LookupBlockDefinition.LookupTableRow row, ParameterName parameterName, ParameterValue value) { row.Values.Add(new Parameter(parameterName, value)); return(row); }
public string FormatValue(ParameterValue value, EvaluationContext context) { return _converter.NumberToRoman((int) Convert.ChangeType(value.Value, typeof(int))); }
/// <remarks/> public void SetSubscriptionPropertiesAsync(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters) { this.SetSubscriptionPropertiesAsync(SubscriptionID, ExtensionSettings, Description, EventType, MatchData, Parameters, null); }
public bool Evaluate(ParameterValue val, EvaluationContext context) { return true; }
/// <remarks/> public void SetSubscriptionPropertiesAsync(string SubscriptionID, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, object userState) { if ((this.SetSubscriptionPropertiesOperationCompleted == null)) { this.SetSubscriptionPropertiesOperationCompleted = new System.Threading.SendOrPostCallback(this.OnSetSubscriptionPropertiesOperationCompleted); } this.InvokeAsync("SetSubscriptionProperties", new object[] { SubscriptionID, ExtensionSettings, Description, EventType, MatchData, Parameters}, this.SetSubscriptionPropertiesOperationCompleted, userState); }
public void ParameterValueImplicitValueTest() { var pv = new ParameterValue<int>(8); Assert.IsTrue(pv > 5); }
/// <remarks/> public System.IAsyncResult BeginCreateSubscription(string Report, ExtensionSettings ExtensionSettings, string Description, string EventType, string MatchData, ParameterValue[] Parameters, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("CreateSubscription", new object[] { Report, ExtensionSettings, Description, EventType, MatchData, Parameters}, callback, asyncState); }