public ActionResult UpdateParameters(List <SamplingPlanParameter> parameters, Guid dwId, string reason) { try { foreach (SamplingPlanParameter p in parameters) { p.UpdateIncluded(); } //Create Note Annotation a = new Annotation() { NoteText = reason, ObjectId = new EntityReference("eims_dw_samplingplan", dwId) }; a.Create(new Guid("0E94E8E4-6A12-E811-80F5-3863BB341A20")); return(Json(new { @success = true, @message = "" })); } catch (Exception ex) { return(Json(new { @success = false, @message = ex.Message })); } }
public static void ParseMethodDefinitions(string code, FilePosition filePosition, TypeCollection types, WarningList warnings) { // Find all method definitions var matches = methodDefinitionRegex.Matches(code); // Parse method definitions foreach (Match match in matches) { string className = match.Groups["className"].Value; string nativeMethodName = match.Groups["methodName"].Value; var methodPosition = new MethodPosition(filePosition, className, nativeMethodName); // Parse annotations, filtering out unknown ones Annotation[] annotations = match.Groups["annotation"].Captures .Cast <Capture>() .Select(capture => Annotation.Create(capture.Value, methodPosition, warnings)) .ToArray(); foreach (var unknownAnnotation in annotations.OfType <UnknownAnnotation>()) { warnings.Add(methodPosition, WarningType.UnexpectedAnnotation, "Unknown annotation command '{0}'.", unknownAnnotation.Command); } annotations = annotations .Where(annotation => !(annotation is UnknownAnnotation)) .ToArray(); // Get method body int openingBraceIndex = match.Index + match.Length - 1; int blockLength = BlockParser.GetBlockLength(code, openingBraceIndex); string methodBody = code.Substring(openingBraceIndex + 1, blockLength - 2); // Parse annotation block MoaiClass moaiClass = types.GetOrCreate(className, methodPosition) as MoaiClass; if (moaiClass != null) { if (annotations.Any()) { ParseMethodDocumentation(moaiClass, annotations, methodBody, methodPosition, types, warnings); } else if (nativeMethodName.StartsWith("_")) { warnings.Add(methodPosition, WarningType.MissingAnnotation, "Missing method documentation."); } } } }
public static void ParseClassDefinitions(string code, FilePosition filePosition, TypeCollection types, WarningList warnings) { // Find all class definitions var matches = classDefinitionRegex.Matches(code); // Parse class definitions foreach (Match match in matches) { string className = match.Groups["className"].Value; var classPosition = new ClassPosition(filePosition, className); // Parse annotations, filtering out unknown ones Annotation[] annotations = match.Groups["annotation"].Captures .Cast <Capture>() .Select(capture => Annotation.Create(capture.Value, classPosition, warnings)) .ToArray(); foreach (var unknownAnnotation in annotations.OfType <UnknownAnnotation>()) { warnings.Add(classPosition, WarningType.UnexpectedAnnotation, "Unknown annotation command '{0}'.", unknownAnnotation.Command); } annotations = annotations .Where(annotation => !(annotation is UnknownAnnotation)) .ToArray(); // Get base class names, ignoring all template classes and primitive types MoaiClass[] baseClasses = match.Groups["baseClassName"].Captures .Cast <Capture>() .Where(capture => !capture.Value.Contains("<")) .Select(capture => types.GetOrCreate(capture.Value, null)) .OfType <MoaiClass>() .ToArray(); // Parse annotation block MoaiClass moaiClass = types.GetOrCreate(className, classPosition) as MoaiClass; if (moaiClass != null) { moaiClass.ClassPosition = classPosition; if (annotations.Any()) { ParseClassDocumentation(moaiClass, annotations, baseClasses, classPosition, warnings); } } } }