public void Add_Test1_Adding_string() { Errors target = new Errors(); string newError = string.Empty; target.Add(newError); Assert.AreEqual(target.Count,1); }
public void Add_Test2_Adding_string() { Errors target = new Errors(); string newError = "Test"; target.Add(newError); Assert.AreEqual(target[0].Message, newError); }
bool AssertAGP(Row row, string madeAgpColumn, string ratingColumn, string mgpColumn, Errors errors) { if(!Defined(row, madeAgpColumn, errors) && !Defined(row, ratingColumn, errors) && !Defined(row, mgpColumn, errors)) { return true; } if(AssertDefined(row, madeAgpColumn, errors)) { var madeMgp = row[madeAgpColumn]; Func<double, string> rating = null; if (madeMgp.ToLower() == "yes") rating = RatingYes; if (madeMgp.ToLower() == "no") rating = RatingNo; if(rating != null) { return AssertRating(row, ratingColumn, mgpColumn, rating, errors); } else { errors.Add(row, "Unknown Made MGP State (should be 'Yes' or 'No'):" + madeMgp, GetPrettyName()); } } return false; }
public void Add_Test2_Adding_Non_Empty_Collection() { Errors target = new Errors(); Errors newErrors = new Errors {"Test Error"}; target.Add(newErrors); Assert.AreEqual(target.Count, 1); }
public void LogError(string message, string code = null, string file = null, int lineNumber = 0, int columnNumber = 0) { Errors?.Add(new BuildErrorEventArgs(null, code, file, lineNumber, columnNumber, 0, 0, message, null, null)); ErrorMessages?.Add(message); Interlocked.Exchange(ref _hasLoggedErrors, 1); }
public void Add_Test1_Adding_Empty_Collection() { Errors target = new Errors(); Errors newErrors = new Errors(); target.Add(newErrors); Assert.AreEqual(target.Count,0); }
public override void LogError(string message, string code = null, string file = null, int lineNumber = 0, int columnNumber = 0) { Errors?.Add(new BuildErrorEventArgs(null, code, file, lineNumber, columnNumber, 0, 0, message, null, null)); ErrorMessages?.Add(message); base.LogError(message, code, file, lineNumber, columnNumber); }
public Response(T data, string currentResponseStatus, dynamic errors = null !) { Data = data ?? throw new ArgumentException("the first argument is in an invalid state!"); CurrentResponseStatus = currentResponseStatus; if (errors == null || CurrentResponseStatus == ResponseStatus.Success) { return; } Errors?.Add(errors); CurrentResponseStatus = ResponseStatus.NonAction; Errors?.Add(new { ErrorMessage = "The response is assuming an invalid state and has been defaulted to a state of fault!" }); }
protected bool Defined(Row row, string column, Errors errors) { if(!row.ContainsKey(column)) { errors.Add(row, "Column not defined: " + column, GetPrettyName()); return false; } var value = row[column].Trim(); return !String.IsNullOrEmpty(value) && value != "-"; }
public override void LogError(string message, string code = null) { Errors?.Add(new Tuple <string, string>(message, code)); base.LogError(message, code); }
public void Error(string message, DocRange range, bool vital = true) => Errors.Add(new OverloadMatchError(message, range, vital));
protected bool AssertNumber(Row row, string numberColumn, out double value, Errors errors) { var numberValue = row[numberColumn]; if (double.TryParse(numberValue, out value)) { return true; } errors.Add(row, "Value in '" + numberColumn + "' cannot be converted to a number (" + numberValue + ")", GetPrettyName()); return false; }
public void AddError(string error) { Errors.Add(error); Status = MethodResultType.Error; }
public override UploadResult UploadText(string text, string fileName) { UploadResult result = new UploadResult(); CustomUploaderInput input = new CustomUploaderInput(fileName, text); if (uploader.RequestFormat == CustomUploaderRequestFormat.MultipartFormData) { if (string.IsNullOrEmpty(uploader.FileFormName)) { result.Response = SendRequestMultiPart(uploader.GetRequestURL(input), uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType, uploader.RequestType); } else { byte[] bytes = Encoding.UTF8.GetBytes(text); using (MemoryStream stream = new MemoryStream(bytes)) { result = SendRequestFile(uploader.GetRequestURL(input), stream, fileName, uploader.GetFileFormName(), uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType, uploader.RequestType); } } } else if (uploader.RequestFormat == CustomUploaderRequestFormat.URLQueryString) { result.Response = SendRequest(uploader.RequestType, uploader.GetRequestURL(input), uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType); } else if (uploader.RequestFormat == CustomUploaderRequestFormat.JSON) { result.Response = SendRequest(uploader.RequestType, uploader.GetRequestURL(input), uploader.GetData(input), UploadHelpers.ContentTypeJSON, uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType); } else if (uploader.RequestFormat == CustomUploaderRequestFormat.Binary) { byte[] bytes = Encoding.UTF8.GetBytes(text); using (MemoryStream stream = new MemoryStream(bytes)) { result.Response = SendRequest(uploader.RequestType, uploader.GetRequestURL(input), stream, UploadHelpers.GetMimeType(fileName), uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType); } } else if (uploader.RequestFormat == CustomUploaderRequestFormat.FormURLEncoded) { result.Response = SendRequestURLEncoded(uploader.RequestType, uploader.GetRequestURL(input), uploader.GetArguments(input), uploader.GetHeaders(input), null, uploader.ResponseType); } else { throw new Exception("Unsupported request format: " + uploader.RequestFormat); } try { uploader.ParseResponse(result, input); } catch (Exception e) { Errors.Add(Resources.CustomFileUploader_Upload_Response_parse_failed_ + Environment.NewLine + e); } return(result); }
public ErrorResponse(ErrorModel error) { Errors.Add(error); }
private void Error(string p_msg, PositionData p_positionData) { Errors.Add(p_msg + " on module: " + moduleName + " on position: " + p_positionData); }
public override void AddError(Exception errorInfo) { Errors.Add(errorInfo); }
public void AddError(string key, string message) { Errors.Add(new ErrorResult(key, message)); }
/// <summary> /// Handles validation events and collecting errors /// </summary> void settings_ValidationEventHandler(object sender, ValidationEventArgs e) { Errors.Add(e.Message); }
/// <summary> /// Resolves namespaced queries gracefully. /// /// Example /// /// @context['hash'] = {"name" => 'tobi'} /// assert_equal 'tobi', @context['hash.name'] /// assert_equal 'tobi', @context['hash["name"]'] /// </summary> /// <param name="markup"></param> /// <param name="notifyNotFound"></param> /// <returns></returns> private object Variable(string markup, bool notifyNotFound) { List <string> parts = R.Scan(markup, VariableParserRegex); // first item in list, if any string firstPart = parts.TryGetAtIndex(0); Match firstPartSquareBracketedMatch = SquareBracketedRegex.Match(firstPart); if (firstPartSquareBracketedMatch.Success) { firstPart = Resolve(firstPartSquareBracketedMatch.Groups[1].Value).ToString(); } object @object; if ((@object = FindVariable(firstPart)) == null) { if (notifyNotFound) { Errors.Add(new VariableNotFoundException(string.Format(Liquid.ResourceManager.GetString("VariableNotFoundException"), markup))); } return(null); } // try to resolve the rest of the parts (starting from the second item in the list) for (int i = 1; i < parts.Count; ++i) { var forEachPart = parts[i]; Match partSquareBracketedMatch = SquareBracketedRegex.Match(forEachPart); bool partResolved = partSquareBracketedMatch.Success; object part = forEachPart; if (partResolved) { part = Resolve(partSquareBracketedMatch.Groups[1].Value); } // If object is a KeyValuePair, we treat it a bit differently - we might be rendering // an included template. if (@object is KeyValuePair <string, object> && ((KeyValuePair <string, object>)@object).Key == (string)part) { object res = ((KeyValuePair <string, object>)@object).Value; @object = Liquidize(res); } // If object is a hash- or array-like object we look for the // presence of the key and if its available we return it else if (IsHashOrArrayLikeObject(@object, part)) { // If its a proc we will replace the entry with the proc object res = LookupAndEvaluate(@object, part); @object = Liquidize(res); } // Some special cases. If the part wasn't in square brackets and // no key with the same name was found we interpret following calls // as commands and call them on the current object else if (!partResolved && (@object is IEnumerable) && ((part as string) == "size" || (part as string) == "first" || (part as string) == "last")) { var castCollection = ((IEnumerable)@object).Cast <object>(); if ((part as string) == "size") { @object = castCollection.Count(); } else if ((part as string) == "first") { @object = castCollection.FirstOrDefault(); } else if ((part as string) == "last") { @object = castCollection.LastOrDefault(); } } // No key was present with the desired value and it wasn't one of the directly supported // keywords either. The only thing we got left is to return nil else { if (notifyNotFound) { Errors.Add(new VariableNotFoundException(string.Format(Liquid.ResourceManager.GetString("VariableNotFoundException"), markup))); } return(null); } // If we are dealing with a drop here we have to if (@object is IContextAware contextAwareObject) { contextAwareObject.Context = this; } } return(@object); }
// https://doc.owncloud.org/server/10.0/developer_manual/core/ocs-share-api.html#create-a-new-share public string ShareFile(string path, string fileName) { Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("path", path); // path to the file/folder which should be shared args.Add("shareType", "3"); // ‘0’ = user; ‘1’ = group; ‘3’ = public link // args.Add("shareWith", ""); // user / group id with which the file should be shared // args.Add("publicUpload", "false"); // allow public upload to a public shared folder (true/false) // args.Add("password", ""); // password to protect public link Share with args.Add("permissions", "1"); // 1 = read; 2 = update; 4 = create; 8 = delete; 16 = share; 31 = all (default: 31, for public shares: 1) if (AutoExpire) { if (AutoExpireTime == 0) { throw new Exception("ownCloud Auto Epxire Time is not valid."); } else { try { DateTime expireTime = DateTime.UtcNow.AddDays(AutoExpireTime); args.Add("expireDate", $"{expireTime.Year}-{expireTime.Month}-{expireTime.Day}"); } catch { throw new Exception("ownCloud Auto Expire time is invalid"); } } } string url = URLHelpers.CombineURL(Host, "ocs/v1.php/apps/files_sharing/api/v1/shares?format=json"); url = URLHelpers.FixPrefix(url); NameValueCollection headers = RequestHelpers.CreateAuthenticationHeader(Username, Password); headers["OCS-APIREQUEST"] = "true"; string response = SendRequestMultiPart(url, args, headers); if (!string.IsNullOrEmpty(response)) { OwnCloudShareResponse result = JsonConvert.DeserializeObject <OwnCloudShareResponse>(response); if (result != null && result.ocs != null && result.ocs.meta != null) { if (result.ocs.data != null && result.ocs.meta.statuscode == 100) { OwnCloudShareResponseData data = ((JObject)result.ocs.data).ToObject <OwnCloudShareResponseData>(); string link = data.url; if (PreviewLink && FileHelpers.IsImageFile(path)) { link += "/preview"; } else if (DirectLink) { if (IsCompatibility81) { link += "/download"; } else { link += "&download"; } if (AppendFileNameToURL) { link = URLHelpers.CombineURL(link, URLHelpers.URLEncode(fileName)); } } return(link); } else { Errors.Add(string.Format("Status: {0}\r\nStatus code: {1}\r\nMessage: {2}", result.ocs.meta.status, result.ocs.meta.statuscode, result.ocs.meta.message)); } } } return(null); }
public Response(string currentResponseStatus, dynamic errors) { CurrentResponseStatus = currentResponseStatus; Errors?.Add(errors); }
public virtual DataStoreResult CopyTo(DataStore <TKey, TVal> dbTarget, bool replace) { try { lock (SyncRoot) { Errors.Free(true); } if (Status != DataStoreStatus.Idle) { return(DataStoreResult.Busy); } if (this == dbTarget) { return(DataStoreResult.OK); } Status = DataStoreStatus.Copying; lock (SyncRoot) { foreach (var kvp in this) { dbTarget.AddOrReplace(kvp.Key, kvp.Value); } } try { lock (SyncRoot) { OnCopiedTo(dbTarget); } } catch (Exception e1) { lock (SyncRoot) { Errors.Add(e1); } Status = DataStoreStatus.Idle; return(DataStoreResult.Error); } Status = DataStoreStatus.Idle; return(DataStoreResult.OK); } catch (Exception e2) { lock (SyncRoot) { Errors.Add(e2); } Status = DataStoreStatus.Idle; return(DataStoreResult.Error); } }
public override Practitioner FromXml(XElement element) { if (element == null) { return(null); } var practitioner = new Practitioner { Id = Guid.NewGuid().ToString(), Meta = new Meta { Profile = new List <string> { "http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner" } } }; var role = new PractitionerRole() { Id = Guid.NewGuid().ToString(), Practitioner = new ResourceReference($"{practitioner.TypeName}/{practitioner.Id}") }; var location = new Location { Id = Guid.NewGuid().ToString() }; foreach (var child in element.Elements()) { switch (child.Name.LocalName) { case "id": var id = FromXml(new IdentifierParser(), child); if (id != null) { practitioner.Identifier.Add(id); } break; case "code": var code = FromXml(new CodeableConceptParser(), child); if (code != null) { role.Specialty.Add(code); } break; case "addr": location.Address = FromXml(new AddressParser(), child); break; case "telecom": var telecom = FromXml(new ContactPointParser(), child); if (telecom != null) { location.Telecom.Add(telecom); } break; case "assignedPerson": case "informationRecipient": var name = FromXml(new HumanNameParser(), child.CdaElement("name")); if (name != null) { practitioner.Name.Add(name); } break; case "receivedOrganization": break; } } if (!practitioner.Identifier.Any()) { Errors.Add(ParserError.CreateParseError(element, "does NOT have identifier", ParseErrorLevel.Error)); } if (!practitioner.Name.Any()) { Errors.Add(ParserError.CreateParseError(element, "does NOT have name", ParseErrorLevel.Warning)); } var existingPractitioner = Bundle?.FirstOrDefault <Practitioner>(p => p.Identifier.IsExactly(practitioner.Identifier)); if (existingPractitioner != null) { practitioner = existingPractitioner; } else { Bundle?.AddResourceEntry(practitioner); } role.Practitioner = practitioner.GetResourceReference(); if (location.Address != null || location.Telecom.Any()) { var existingLocation = Bundle?.FirstOrDefault <Location>(l => l.Address.IsExactly(location.Address) && l.Telecom.IsExactly(location.Telecom)); if (existingLocation != null) { location = existingLocation; } else { Bundle?.AddResourceEntry(location); } role.Location.Add(location.GetResourceReference()); } var existingRole = Bundle?.FirstOrDefault <PractitionerRole>(pr => pr.Location.IsExactly(role.Location) && pr.Specialty.IsExactly(role.Specialty) && pr.Practitioner.IsExactly(role.Practitioner)); if (existingRole == null && (role.Location.Any() || role.Specialty.Any())) { Bundle?.AddResourceEntry(role); } return(practitioner); }
private void EmitError(string description) { Errors.Add(new PlaylistError(description, Line, Column)); }
public override UploadResult Upload(Stream stream, string fileName) { bool forcePathStyle = Settings.UsePathStyle; if (!forcePathStyle && Settings.Bucket.Contains(".")) { forcePathStyle = true; } string endpoint = URLHelpers.RemovePrefixes(Settings.Endpoint); string host = forcePathStyle ? endpoint : $"{Settings.Bucket}.{endpoint}"; string algorithm = "AWS4-HMAC-SHA256"; string credentialDate = DateTime.UtcNow.ToString("yyyyMMdd", CultureInfo.InvariantCulture); string region = GetRegion(); string scope = URLHelpers.CombineURL(credentialDate, region, "s3", "aws4_request"); string credential = URLHelpers.CombineURL(Settings.AccessKeyID, scope); string longDate = DateTime.UtcNow.ToString("yyyyMMddTHHmmssZ", CultureInfo.InvariantCulture); string expiresTotalSeconds = ((long)TimeSpan.FromHours(1).TotalSeconds).ToString(); string contentType = Helpers.GetMimeType(fileName); NameValueCollection headers = new NameValueCollection(); headers["content-type"] = contentType; headers["host"] = host; headers["x-amz-acl"] = "public-read"; headers["x-amz-storage-class"] = Settings.UseReducedRedundancyStorage ? "REDUCED_REDUNDANCY" : "STANDARD"; string signedHeaders = GetSignedHeaders(headers); Dictionary <string, string> args = new Dictionary <string, string>(); args.Add("X-Amz-Algorithm", algorithm); args.Add("X-Amz-Credential", credential); args.Add("X-Amz-Date", longDate); args.Add("X-Amz-Expires", expiresTotalSeconds); args.Add("X-Amz-SignedHeaders", signedHeaders); string uploadPath = GetUploadPath(fileName); string canonicalURI = uploadPath; if (forcePathStyle) { canonicalURI = URLHelpers.CombineURL(Settings.Bucket, canonicalURI); } canonicalURI = URLHelpers.AddSlash(canonicalURI, SlashType.Prefix); canonicalURI = URLHelpers.URLPathEncode(canonicalURI); string canonicalQueryString = URLHelpers.CreateQuery(args); string canonicalHeaders = CreateCanonicalHeaders(headers); string canonicalRequest = "PUT" + "\n" + canonicalURI + "\n" + canonicalQueryString + "\n" + canonicalHeaders + "\n" + signedHeaders + "\n" + "UNSIGNED-PAYLOAD"; string stringToSign = algorithm + "\n" + longDate + "\n" + scope + "\n" + Helpers.BytesToHex(Helpers.ComputeSHA256(canonicalRequest)); byte[] dateKey = Helpers.ComputeHMACSHA256(credentialDate, "AWS4" + Settings.SecretAccessKey); byte[] dateRegionKey = Helpers.ComputeHMACSHA256(region, dateKey); byte[] dateRegionServiceKey = Helpers.ComputeHMACSHA256("s3", dateRegionKey); byte[] signingKey = Helpers.ComputeHMACSHA256("aws4_request", dateRegionServiceKey); string signature = Helpers.BytesToHex(Helpers.ComputeHMACSHA256(stringToSign, signingKey)); args.Add("X-Amz-Signature", signature); headers.Remove("content-type"); headers.Remove("host"); string url = URLHelpers.CombineURL(host, canonicalURI); url = URLHelpers.CreateQuery(url, args); url = URLHelpers.ForcePrefix(url, "https://"); NameValueCollection responseHeaders = SendRequestGetHeaders(HttpMethod.PUT, url, stream, contentType, null, headers); if (responseHeaders == null || responseHeaders.Count == 0) { Errors.Add("Upload to Amazon S3 failed. Check your access credentials."); return(null); } if (responseHeaders["ETag"] == null) { Errors.Add("Upload to Amazon S3 failed."); return(null); } return(new UploadResult { IsSuccess = true, URL = GenerateURL(uploadPath) }); }
public override UploadResult Upload(Stream stream, string fileName) { Dictionary <string, string> args = new Dictionary <string, string>(); NameValueCollection headers; if (UploadMethod == AccountType.User) { if (!CheckAuthorization()) { return(null); } if (!string.IsNullOrEmpty(UploadAlbumID)) { args.Add("album", UploadAlbumID); } headers = GetAuthHeaders(); } else { headers = new NameValueCollection(); headers.Add("Authorization", "Client-ID " + AuthInfo.Client_ID); } UploadResult result = UploadData(stream, "https://api.imgur.com/3/image", fileName, "image", args, headers); if (!string.IsNullOrEmpty(result.Response)) { JToken jsonResponse = JToken.Parse(result.Response); if (jsonResponse != null) { bool success = jsonResponse["success"].Value <bool>(); int status = jsonResponse["status"].Value <int>(); if (success && status == 200) { ImgurUploadData uploadData = jsonResponse["data"].ToObject <ImgurUploadData>(); if (uploadData != null && !string.IsNullOrEmpty(uploadData.link)) { if (DirectLink) { result.URL = uploadData.link; } else { result.URL = "http://imgur.com/" + uploadData.id; } int index = result.URL.LastIndexOf('.'); string thumbnail = string.Empty; switch (ThumbnailType) { case ImgurThumbnailType.Small_Square: thumbnail = "s"; break; case ImgurThumbnailType.Big_Square: thumbnail = "b"; break; case ImgurThumbnailType.Small_Thumbnail: thumbnail = "t"; break; case ImgurThumbnailType.Medium_Thumbnail: thumbnail = "m"; break; case ImgurThumbnailType.Large_Thumbnail: thumbnail = "l"; break; case ImgurThumbnailType.Huge_Thumbnail: thumbnail = "h"; break; } result.ThumbnailURL = string.Format("http://i.imgur.com/{0}{1}.jpg", uploadData.id, thumbnail); // Thumbnails always jpg result.DeletionURL = "http://imgur.com/delete/" + uploadData.deletehash; } } else { ImgurErrorData errorData = jsonResponse["data"].ToObject <ImgurErrorData>(); if (errorData != null && !string.IsNullOrEmpty(errorData.error)) { string errorMessage = string.Format("Status: {0}, Error: {1}", status, errorData.error); Errors.Add(errorMessage); } } } } return(result); }
protected bool AssertNumber(Row row, string numberColumn, out double value, Errors errors) { var result = Number(row, numberColumn, out value); var numberValue = row[numberColumn]; if (!result) { errors.Add(row, "Value in '" + numberColumn + "' cannot be converted to a number (" + numberValue + ")", GetPrettyName()); } return result; }
static void LogError(string error) { Errors.Add(error); }
private async Task _logErrorAsync(string errMessage) { Errors.Add(errMessage); }
/// <summary> /// Method to obtain all the errors as a result of the validation of the html /// </summary> /// <param name="htmlValid">Boolean that will indicate if the document is or not valid html.</param> /// <param name="urlDocument">Xml document that represents the result of the validation</param> /// <param name="mNamespace">Namespace using to obtain some data such as line, colum, etc.</param> /// <returns>Boolean that will indicate if the document is or not valid html.</returns> private Boolean HTMLErrors(Boolean htmlValid, XDocument urlDocument, XNamespace mNamespace) { errors = new Errors(); //Obtaining the descendants of the elements labeled "errors". With this we obtain all the errors var errorsElements = from e in urlDocument.Descendants(mNamespace + "errors") select e; //Obtaining the descendants of the elements labeled "errorcount". With this we can obtain the number of errors. var errorCountElement = from e in errorsElements.Descendants(mNamespace + "errorcount") select e; //Obtaining the descendants of the elements labeled "error". With this we can obtain information from each of the errors. var errorListElements = from e in errorsElements.Descendants(mNamespace + "error") select e; //Iterate over the 'errorcount' variable to obtain the number of errors foreach (var element in errorCountElement) { //Store the value of the count errors.errorsCount = element.Value; //If the number of errors is greater than 0 if (int.Parse(errors.errorsCount) > 0) //The document is not a valid html document according to the doctype especified htmlValid = false; //Iterate over the 'errorListElements' variable to obtain each error foreach (var errorElement in errorListElements) { //Create a instance of an Error Error error = new Error(); //If there is a number of line if (errorElement.Descendants(mNamespace + "line").Count() > 0) //Store the line error.line = errorElement.Descendants(mNamespace + "line").First().Value; //If there is a number of line if (errorElement.Descendants(mNamespace + "col").Count() > 0) //Store the col error.col = errorElement.Descendants(mNamespace + "col").First().Value; //If there is a number of line if (errorElement.Descendants(mNamespace + "message").Count() > 0) //Store the message error.message = errorElement.Descendants(mNamespace + "message").First().Value; //If there is a number of line if (errorElement.Descendants(mNamespace + "messageid").Count() > 0) //Store the messageid error.messageId = errorElement.Descendants(mNamespace + "messageid").First().Value; //If there is a number of line if (errorElement.Descendants(mNamespace + "explanation").Count() > 0) //Store the explanation error.explanation = errorElement.Descendants(mNamespace + "explanation").First().Value; //If there is a number of line if (errorElement.Descendants(mNamespace + "source").Count() > 0) //Store the source error.source = errorElement.Descendants(mNamespace + "source").First().Value; //Add the error to the list of errors that are stored in the 'errors' variable. errors.Add(error); } } return htmlValid; }
public void UpdateSchema() { // 1. add declaringtype to widget defs // 2. add declaringassembly to widget defs. // 3. add description to widget defs. // 3. add pathtoeditor to widget defs. string con = Config.Get<string>("Database", "connectstr"); string[] sqlupdates = new string[] { "ALTER TABLE Events ADD [HasMediaFiles] [bit] NULL; ", "ALTER TABLE Events ADD [TotalMediaFiles] [int] NULL;", "ALTER TABLE Posts ADD [HasMediaFiles] [bit] NULL; ", "ALTER TABLE Posts ADD [TotalMediaFiles] [int] NULL;", "ALTER TABLE Profiles ADD [HasMediaFiles] [bit] NULL; ", "ALTER TABLE Profiles ADD [TotalMediaFiles] [int] NULL;", "ALTER TABLE Widgets ADD [Description] [ntext] NULL, [PathToEditor] [nvarchar](150) NULL, [DeclaringType] [nvarchar](150) NULL, [DeclaringAssembly] [nvarchar](150) NULL; ", "ALTER TABLE MediaFiles ADD [Title] [nvarchar](100) NULL;", "ALTER TABLE MediaFiles ALTER COLUMN [Description] [nvarchar](200) NULL;", "ALTER TABLE MediaFolders ALTER COLUMN [Description] [nvarchar](200) NULL;", "ALTER TABLE MediaFolders ADD [HasMediaFiles] [bit] NULL; ", "ALTER TABLE MediaFolders ADD [TotalMediaFiles] [int] NULL;", "UPDATE users SET createuser = username, updateuser = username" }; var dbhelper = new Database(con); var errors = new Errors(); foreach (string sqlupdate in sqlupdates) { Try.Catch( () => dbhelper.ExecuteNonQueryText(sqlupdate), (ex) => errors.Add("Error updateing schema with command : " + sqlupdate + ". " + ex.Message)); } }
private void AddError(HtmlErrorType type) { Errors.Add(new HtmlError(State.Line, State.Column, State.Offset, type)); }
protected bool AssertTrue(Row row, bool result, string message, Errors errors) { if (!result) { errors.Add(row, GetPrettyName() + " - " + message, GetPrettyName()); } return result; }
internal void AddError(string error) { Errors.Add(error); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("Errors")); }
/// <summary> /// Add error /// </summary> /// <param name="key"></param> /// <param name="error"></param> public virtual ResultModel <T> AddError(string key, string error) { Errors?.Add(new ErrorModel(key, error)); return(this); }
/// <summary> /// Add error /// </summary> /// <param name="error">Error</param> public void AddError(string error) { Errors.Add(error); }
private ErrorResponse(HttpStatusCode code, IDictionary <string, dynamic>?errors) : base() { Message = code.ToString(); errors?.ToList().ForEach(e => Errors?.Add(e.Key, e.Value)); }
/// <summary> /// Adds initializaion error to the Errors list /// </summary> /// <param name="message">The error message to be added</param> private void AddInitializationError(string message) { Errors.Add("Failed to initialize algorithm: " + message); }
public void Log(Exception exception) { Console.WriteLine(exception); Errors.Add(exception); throw new Exception("Logged exception found in tested code. Rethrowing...", exception); }
private void InitializeUserComponent() { Text = "PCA会計DX 消込結果連携"; grid.SetupShortcutKeys(); client.ErrorListener = message => Errors.Add(message); }