public BL_Team() { db = new OSCContext(); access = new ManagerAccess(); _err = new _ErrorMessage(); idb = this.GetList(); }
bool OnClass(XmlNode xml) { SendTestCaseMessagesWhenAppropriate(null); var @continue = true; XmlNode?failureNode; if ((failureNode = xml.SelectSingleNode("failure")) != null) { var errorMetadata = Xunit1ExceptionUtility.ConvertToErrorMetadata(failureNode); var errorMessage = new _ErrorMessage { ExceptionParentIndices = errorMetadata.ExceptionParentIndices, ExceptionTypes = errorMetadata.ExceptionTypes, Messages = errorMetadata.Messages, StackTraces = errorMetadata.StackTraces }; @continue = messageSink.OnMessage(errorMessage); } TestClassResults.Time = decimal.Parse(xml.Attributes?["time"]?.Value ?? "0", CultureInfo.InvariantCulture); TestClassResults.Total = int.Parse(xml.Attributes?["total"]?.Value ?? "0", CultureInfo.InvariantCulture); TestClassResults.Failed = int.Parse(xml.Attributes?["failed"]?.Value ?? "0", CultureInfo.InvariantCulture); TestClassResults.Skipped = int.Parse(xml.Attributes?["skipped"]?.Value ?? "0", CultureInfo.InvariantCulture); return(@continue && TestClassResults.Continue); }
public BL_Representative() { db = new OSCContext(); access = new ManagerAccess(); _err = new _ErrorMessage(); idb = this.GetList(); }
// GET: NptTracker/Create public ActionResult Create(long?teamId) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanAdd = this._af.blAccess.CanAdd(Session["grp_id"].ToString(), module) }; if (!this.a.CanAdd) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Return if (teamId == null) { teamId = 0; } ViewBag.Teams = new SelectList(_af.blTeam.GetList(a), "TeamId", "TeamName"); ViewBag.Representatives = new SelectList(_af.blRepresentative.GetList(a).Where(t => t.TeamId == (long)teamId), "RepId", "FullName"); ViewBag.TeamNptCategories = new SelectList(_af.blTeamNptCategories.GetList((long)teamId), "CategoryDesc", "CategoryDesc"); return(View()); #endregion Return }
/// <summary> /// INTERNAL METHOD, FOR TESTING PURPOSES ONLY. DO NOT CALL. /// </summary> protected void Run( IEnumerable <Xunit1TestCase> testCases, _IMessageSink messageSink) { var results = new Xunit1RunSummary(); var environment = $"{IntPtr.Size * 8}-bit .NET {Environment.Version}"; var testCasesList = testCases.ToList(); var testAssemblyStartingMessage = new _TestAssemblyStarting { AssemblyName = testAssemblyName, AssemblyPath = assemblyFileName, AssemblyUniqueID = TestAssemblyUniqueID, ConfigFilePath = configFileName, StartTime = DateTimeOffset.Now, TestEnvironment = environment, TestFrameworkDisplayName = TestFrameworkDisplayName, }; if (messageSink.OnMessage(testAssemblyStartingMessage)) { try { if (testCasesList.Count != 0) { results = RunTestCollection(testCasesList, messageSink); } } catch (Exception ex) { var errorMetadata = Xunit1ExceptionUtility.ConvertToErrorMetadata(ex); var errorMessage = new _ErrorMessage { ExceptionParentIndices = errorMetadata.ExceptionParentIndices, ExceptionTypes = errorMetadata.ExceptionTypes, Messages = errorMetadata.Messages, StackTraces = errorMetadata.StackTraces }; messageSink.OnMessage(errorMessage); } finally { var assemblyFinished = new _TestAssemblyFinished { AssemblyUniqueID = testAssemblyStartingMessage.AssemblyUniqueID, ExecutionTime = results.Time, TestsFailed = results.Failed, TestsRun = results.Total, TestsSkipped = results.Skipped }; messageSink.OnMessage(assemblyFinished); } } }
public void ErrorMessage() { var errorMessage = new _ErrorMessage { ExceptionParentIndices = exceptionParentIndices, ExceptionTypes = exceptionTypes, Messages = messages, StackTraces = stackTraces }; var handler = TestableDefaultRunnerReporterMessageHandler.Create(); handler.OnMessage(errorMessage); AssertFailureMessages(handler.Messages, "FATAL ERROR"); }
public void ErrorMessage() { var errorMessage = new _ErrorMessage { ExceptionParentIndices = exceptionParentIndices, ExceptionTypes = exceptionTypes, Messages = messages, StackTraces = stackTraces }; var assemblyElement = new XElement("assembly"); var sink = new DelegatingXmlCreationSink(innerSink, assemblyElement); sink.OnMessage(errorMessage); AssertFailureElement(assemblyElement, "fatal", null); }
public async ValueTask ErrorMessage() { var errorMessage = new _ErrorMessage { ExceptionParentIndices = exceptionParentIndices, ExceptionTypes = exceptionTypes, Messages = messages, StackTraces = stackTraces }; var listener = Substitute.For <ITestListener>(); await using var sink = new ResultSink(listener, 42) { TestRunState = TestRunState.NoTests }; sink.OnMessage(errorMessage); AssertFailure(listener, sink.TestRunState, "Fatal Error"); }
public ActionResult DeleteConfirmed(long id) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanDelete = this._af.blAccess.CanDelete(Session["grp_id"].ToString(), module) }; if (!this.a.CanDelete) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Method OSC_ImportNPT oSC_ImportNPT = this._af.blNpt.Get(id); oSC_ImportNPT.DateUploaded = DateTime.Now; oSC_ImportNPT.UploadedBy = a.LogonUser; oSC_ImportNPT.IsActive = false; bool result = this._af.blNpt.Edit(oSC_ImportNPT); if (result == false && this._af.blNpt._err != null) { ViewBag.Error = this._af.blNpt._err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion Method #region Return ViewBag.Message = "Successfully saved!"; return(RedirectToAction("Index")); #endregion Return }
// GET: NptTracker/Delete/5 public ActionResult Delete(long?id) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanDelete = this._af.blAccess.CanDelete(Session["grp_id"].ToString(), module) }; if (!this.a.CanDelete) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Method if (id == null) { _ErrorMessage err = new _ErrorMessage() { MessageType = "Server Error - NPTTrackerController", MessageDescription = "Invalid use of null" }; ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } //get OSC_ImportNPT oSC_ImportNPT = this._af.blNpt.Get((long)id); //if bl npt error exist if (this._af.blNpt._err == null) { ViewBag.Error = this._af.blNpt._err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } //if record not exist if (oSC_ImportNPT == null) { return(View("~/Views/Shared/NotFound.cshtml")); } #endregion Method #region Return return(View(oSC_ImportNPT)); #endregion Return }
public ActionResult Edit([Bind(Include = "NPTReportId,RepId,Activity,DateOfActivity,TimeSpent,TypeOfActivity,CreatedBy,ItemType,Path,TeamId,Month,Year,DateUploaded,UploadedBy,Source,CategoryId,SubCategoryId,IsActive")] OSC_ImportNPT oSC_ImportNPT) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanEdit = this._af.blAccess.CanEdit(Session["grp_id"].ToString(), module) }; if (!this.a.CanEdit) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Method oSC_ImportNPT.Month = Convert.ToDateTime(oSC_ImportNPT.DateOfActivity).Month; oSC_ImportNPT.Year = Convert.ToDateTime(oSC_ImportNPT.DateOfActivity).Year; oSC_ImportNPT.DateUploaded = DateTime.Now; oSC_ImportNPT.UploadedBy = a.LogonUser; oSC_ImportNPT.Source = "Manual"; if (a.Role != "Admin") { oSC_ImportNPT.IsActive = true; } bool result = this._af.blNpt.Edit(oSC_ImportNPT); if (result == false && this._af.blNpt._err != null) { ViewBag.Error = this._af.blNpt._err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion Method #region Return ViewBag.Message = "Successfully saved!"; ViewBag.TeamNptCategories = new SelectList(_af.blTeamNptCategories.GetList((long)oSC_ImportNPT.TeamId), "CategoryDesc", "CategoryDesc"); OSC_ImportNPT returnObj = this._af.blNpt.Get(oSC_ImportNPT.NPTReportId); return(View(returnObj)); #endregion Return }
public ActionResult Create([Bind(Include = "NPTReportId,RepId,Activity,DateOfActivity,TimeSpent,TypeOfActivity,TeamId,IsActive")] OSC_ImportNPT oSC_ImportNPT) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanAdd = this._af.blAccess.CanAdd(Session["grp_id"].ToString(), module) }; if (!this.a.CanAdd) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Method oSC_ImportNPT.Month = Convert.ToDateTime(oSC_ImportNPT.DateOfActivity).Month; oSC_ImportNPT.Year = Convert.ToDateTime(oSC_ImportNPT.DateOfActivity).Year; oSC_ImportNPT.DateUploaded = DateTime.Now; oSC_ImportNPT.UploadedBy = a.LogonUser; oSC_ImportNPT.IsActive = true; oSC_ImportNPT.Source = "Manual"; bool result = this._af.blNpt.Create(oSC_ImportNPT); if (result == true) { ViewBag.Message = "Successfully saved!"; return(RedirectToAction("Index")); } #endregion Method #region Return ViewBag.Err = this._af.blNpt._err; return(View(oSC_ImportNPT)); #endregion Return }
// GET: NptTracker public ActionResult Index(int?page, int?pageSize, bool?filterOn, _Filter filter) { #region BTSS try { if (Session["role"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["logon_user"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else if (Session["grp_id"] == null) { return(View("~/Views/Shared/SessionTimeout.cshtml")); } else { this.a = new _Access() { LogonUser = Session["logon_user"].ToString(), Role = Session["role"].ToString(), Group = Session["grp_id"].ToString(), CanView = this._af.blAccess.CanView(Session["grp_id"].ToString(), module), CanAdd = this._af.blAccess.CanAdd(Session["grp_id"].ToString(), module), CanEdit = this._af.blAccess.CanEdit(Session["grp_id"].ToString(), module), CanDelete = this._af.blAccess.CanDelete(Session["grp_id"].ToString(), module) }; if (!this.a.CanView) { return(View("~/Views/Shared/NoAccess.cshtml")); } else { ViewBag.Access = this.a; } } } catch (Exception ex) { _ErrorMessage err = new _ErrorMessage(); err.MessageType = "Server Error - NPTTrackerController"; err.MessageDescription = ex.Message.ToString(); ViewBag.Error = err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion BTSS #region Table List <OSC_ImportNPT> npts = new List <OSC_ImportNPT>(); npts = this._af.blNpt.GetList(a); if (npts.Count == 0 && this._af.blNpt._err != null) { ViewBag.Error = this._af.blNpt._err; return(View("~/Views/Shared/SomethingWentWrong.cshtml")); } #endregion Table #region Filters if (filterOn != null && filterOn == true) { } else { string noVal = ""; ViewBag.Category = noVal; ViewBag.Team = noVal; ViewBag.Representative = noVal; ViewBag.DateOfActivity = noVal; ViewBag.TimeSpent = noVal; } #endregion Filters #region Return int?defaultPageSize = 10; if (pageSize != null) { defaultPageSize = pageSize; } return(View(npts.OrderByDescending(n => n.DateOfActivity).ToPagedList(page ?? 1, (int)defaultPageSize))); #endregion Return }
public BL_TeamNptCategories() { db = new OSCContext(); _err = new _ErrorMessage(); idb = this.GetList(); }