public ActionResult ImportContent(HttpPostedFileBase file, PublishTypes publishTypes) { var view = string.Format(ViewsFolder, "Index"); if (file == null) { ModelState.AddModelError("importError", "Select a file to import"); } if (ModelState.IsValid) { try { var ic = new ImportContent { PublishType = publishTypes }; ic.Import(file); view = string.Format(ViewsFolder, "ImportReport"); IncreaseConveyorCounter(); return(View(view, ic.Report)); } catch (Exception ex) { ModelState.AddModelError("importError", ex.Message); } } return(View(view)); }
public IUploadService GetService(PublishTypes publishType) { switch (publishType) { case PublishTypes.Ftp: return(new FtpUploadService()); case PublishTypes.AzureBlobStorage: return(new AzureUploadService()); case PublishTypes.Unknown: throw new ArgumentOutOfRangeException(); default: throw new ArgumentOutOfRangeException(); } }
internal static Publisher CreatePublisher(PublishTypes publishType) { switch (publishType) { default: case PublishTypes.Database: { return(new DbPublisher()); } case PublishTypes.File: { return(new FilePublisher()); } case PublishTypes.Email: { return(new MailPublisher()); } } }
internal static bool LogCore(LogLevel logLevel, PublishTypes publishType, string source, string userName, string message, Exception exception, bool autoInform) { try { Publisher publisher = PublisherFactory.CreatePublisher(publishType); publisher.Message = message; publisher.Level = logLevel; publisher.Source = source; publisher.UserName = userName; publisher.Exception = exception; publisher.AutoInform = autoInform; if (LogPublishing != null) { var subs = LogPublishing.GetInvocationList(); foreach (LogPublishingEventHandler sub in subs) { sub.Invoke(publisher); } } var result = publisher.Publish(); if (LogPublished != null) { var subs = LogPublished.GetInvocationList(); foreach (LogPublishedEventHandler sub in subs) { sub.Invoke(publisher, result); } } return(result); } catch { return(false); } }
public ActionResult ImportContent(HttpPostedFileBase file, PublishTypes publishTypes) { var view = string.Format(ViewsFolder, "Index"); if (file == null) { ModelState.AddModelError("importError", "Select a file to import"); } if (ModelState.IsValid) { try { var ic = new ImportContent { PublishType = publishTypes }; ic.Import(file); view = string.Format(ViewsFolder, "ImportReport"); IncreaseConveyorCounter(); return View(view, ic.Report); } catch (Exception ex) { ModelState.AddModelError("importError", ex.Message); } } return View(view); }
public static PositionDescriptionCollection Search(int?seriesID = null, int?gradeID = null, int?organizationCodeID = null, PublishTypes selectedPublishType = PublishTypes.All) { DbCommand commandWrapper = GetDbCommand("spr_SearchPositionDescriptionsByCriteria"); PositionDescriptionCollection searchResults = new PositionDescriptionCollection(); try { const int defaultValue = -1; SetParameter <int>(commandWrapper, "@SeriesID", seriesID, defaultValue); SetParameter <int>(commandWrapper, "@GradeID", gradeID, defaultValue); SetParameter <int>(commandWrapper, "@OrganizationCodeID", organizationCodeID, defaultValue); SetParameter <int>(commandWrapper, "@IsPublished", (short)selectedPublishType, (short)PublishTypes.All); searchResults = new PositionDescriptionCollection(ExecuteDataTable(commandWrapper)); } catch (Exception ex) { HandleException(ex); } return(searchResults); }
/// <summary> /// Creates new log. In case of failure logs error to event log. /// </summary> /// <param name="logLevel">Priority of log.</param> /// <param name="publishType">Publishing type of log.</param> /// <param name="userName">Current application user's name.</param> /// <param name="message">Loggers additional notes.</param> public static bool Log(LogLevel logLevel, PublishTypes publishType, string userName, string message) { return(LogCore(logLevel, publishType, null, userName, message, null, Settings.Log.AutoInform)); }
/// <summary> /// Creates new log. In case of failure logs error to event log. /// </summary> /// <param name="logLevel">Priority of log.</param> /// <param name="publishType">Publishing type of log.</param> /// <param name="exception">Exception of the log if caused by any type of error.</param> public static bool Log(LogLevel logLevel, PublishTypes publishType, Exception exception) { return(LogCore(logLevel, publishType, null, null, null, exception, Settings.Log.AutoInform)); }
internal static bool Log(LogLevel logLevel, PublishTypes publishType, string source, string userName, string message, Exception exception, bool autoInform) { return(LogCore(logLevel, publishType, source, userName, message, exception, autoInform)); }
/// <summary> /// Creates new log. In case of failure logs error to event log. /// </summary> /// <param name="logLevel">Priority of log.</param> /// <param name="publishType">Publishing type of log.</param> /// <param name="source">Source of log. This parameter can be page name, form name or assembly name.</param> /// <param name="userName">Current application user's name.</param> /// <param name="message">Loggers additional notes.</param> /// <param name="exception">Exception of the log if caused by any type of error.</param> public static bool Log(LogLevel logLevel, PublishTypes publishType, string source, string userName, string message, Exception exception) { return(LogCore(logLevel, publishType, source, userName, message, exception, Settings.Log.AutoInform)); }