public ScopedBlah( Parameter1 parameter1, Parameter2 parameter2, Parameter3 parameter3) { Parameter1 = parameter1; Parameter2 = parameter2; Parameter3 = parameter3; }
public IEnumerable <SimpleEntity> Filter(IEnumerable <SimpleEntity> items, Parameter3 parameter) { if (parameter != null) { throw new Exception("Parameter null is expected."); } return(new SimpleEntityList { "ef3" }); }
public override string ToString() { return(Parameter3.ToString()); }
///-------------------------------------------------------------------------------- /// <summary>Interpret this node to produce code, output, or model data..</summary> /// /// <param name="interpreterType">The type of interpretation to perform.</param> /// <param name="solutionContext">The associated solution.</param> /// <param name="templateContext">The associated template.</param> /// <param name="modelContext">The associated model context.</param> ///-------------------------------------------------------------------------------- public void InterpretNode(InterpreterTypeCode interpreterType, Solution solutionContext, ITemplate templateContext, IDomainEnterpriseObject modelContext) { try { string path = Parameter1.GetStringValue(solutionContext, templateContext, modelContext, interpreterType); if (!String.IsNullOrEmpty(path)) { if (solutionContext.IsSampleMode == true) { // don't perform removal of output file data, just indicate it would be output templateContext.MessageBuilder.Append("\r\n- "); templateContext.MessageBuilder.Append(path); templateContext.MessageBuilder.Append(": \""); templateContext.MessageBuilder.Append(Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType)); if (Parameter4 != null) { templateContext.MessageBuilder.Append("\", \""); templateContext.MessageBuilder.Append(Parameter3.GetStringValue(solutionContext, templateContext, modelContext, interpreterType)); templateContext.MessageBuilder.Append("\", \""); templateContext.MessageBuilder.Append(Parameter4.GetStringValue(solutionContext, templateContext, modelContext, interpreterType)); } templateContext.MessageBuilder.Append("\""); } else if (solutionContext.LoggedErrors.Count == 0) { if (File.Exists(path) == true) { string text = FileHelper.GetText(path); if (Parameter4 != null) { // remove text bounded by begin and end tags string beginTag = Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType); string endTag = Parameter3.GetStringValue(solutionContext, templateContext, modelContext, interpreterType); string matchingText = Parameter4.GetStringValue(solutionContext, templateContext, modelContext, interpreterType); int beginIndex = text.IndexOf(beginTag); while (beginIndex >= 0) { int endIndex = text.IndexOf(endTag, beginIndex); if (endIndex < 0) { break; } int matchingIndex = text.IndexOf(matchingText, beginIndex); if (matchingIndex >= 0 && matchingIndex < endIndex && matchingIndex + matchingText.Length <= endIndex) { if (endIndex + endTag.Length >= text.Length) { text = text.Substring(0, beginIndex); } else { text = text.Substring(0, beginIndex) + text.Substring(endIndex + endTag.Length); } FileHelper.ReplaceFile(path, text); break; } beginIndex += beginTag.Length; beginIndex = text.IndexOf(beginTag, beginIndex); } } else { // remove text matching input match text string matchingText = Parameter2.GetStringValue(solutionContext, templateContext, modelContext, interpreterType); int index = text.IndexOf(matchingText); if (index >= 0) { if (index + matchingText.Length >= text.Length) { text = text.Substring(0, index); } else { text = text.Substring(0, index) + text.Substring(index + matchingText.Length); } FileHelper.ReplaceFile(path, text); } } } } } } catch (ApplicationAbortException) { throw; } catch (System.Exception ex) { LogException(solutionContext, templateContext, modelContext, ex, interpreterType); } }
private void button1_Click(object sender, RoutedEventArgs e) { string Para1 = Parameter1.GetLineText(0); string Para2 = Parameter2.GetLineText(0); string Para3 = Parameter3.GetLineText(0); if (type.CompareTo("Person") == 0) { if (PersonID) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonID(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } if (PersonName) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPersonName(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } } else if (type.CompareTo("Vehicle") == 0) { ResponseBlock.Visibility = Visibility.Visible; ResponseBlock2.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchVehicle(Para3).DefaultView; ResponseBlock2.ItemsSource = SF.SearchVHR(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else if (type.CompareTo("Part") == 0) { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchPart(Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } else { ResponseBlock.Visibility = Visibility.Visible; SearchFunction SF = new SearchFunction(cn); try { ResponseBlock.ItemsSource = SF.SearchSale(Para1, Para2, Para3).DefaultView; } catch (OleDbException ex) { ErrorWindow Error = new ErrorWindow(ex.Message); Error.ShowDialog(); } } }