public bool OnModifyAfter <T>(IEntityRequestContext context, T before, T after) where T : class, IEntityIdentity { var info = EntityInfoManager.GetInfo(before); AuditManager.LogModify(context.Who, IdentityManager.GetClientMachine(context.Who), info.Module, before._key, null, null, before, after, context.TransactionUID); return(true); }
public ActionResult Create([Bind(Include = "JobCardAppID,DateCreated,DateStarted,DateEnded,JCTypeID,UserID,JobCardCriteria,CriteriaData,Status,TimeIn,TimeOut,WorkMin,Remarks,OtherValue,SupervisorID,StartTime,EndTime,EmpID,Justification")] Att_JobCardApp att_jobcardapp) { if (att_jobcardapp.EmpID == null) { ViewBag.error = "required field!"; } else { if (ModelState.IsValid) { if (att_jobcardapp.DateEnded != null) { att_jobcardapp.DateCreated = DateTime.Now; att_jobcardapp.StatusID = "Approved"; att_jobcardapp.StartTime = null; att_jobcardapp.EndTime = null; db.Att_JobCardApp.Add(att_jobcardapp); db.SaveChanges(); } else { att_jobcardapp.DateCreated = DateTime.Now; att_jobcardapp.StatusID = "Approved"; db.Att_JobCardApp.Add(att_jobcardapp); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Job_Cards), Convert.ToInt16(AuditManager.AuditOperation.Add), DateTime.Now, (int)att_jobcardapp.JobCardAppID); } } ViewBag.JCTypeID = new SelectList(db.Att_JobCard, "JCID", "JCName", att_jobcardapp.JCTypeID); return(RedirectToAction("Index")); } return(View(att_jobcardapp)); }
public bool OnRemoveAfter <T>(IEntityRequestContext context, T entity) where T : class, IEntityIdentity { var info = EntityInfoManager.GetInfo(entity); AuditManager.LogRemove(context.Who, IdentityManager.GetClientMachine(context.Who), info.Module, entity._key, null, null, entity, context.TransactionUID); return(true); }
public ActionResult Cancel(int?id) { Att_JobCardApp job = new Att_JobCardApp(); job = db.Att_JobCardApp.First(aa => aa.JobCardAppID == id); job.StatusID = "Rejected"; job.ApprovedDate = DateTime.Now; db.SaveChanges(); if (job.StatusID == "Rejected") { var EName = db.EmpViews.First(aa => aa.EmployeeID == job.EmpID).FullName; string Toadd = "*****@*****.**"; string subject = "Job Card Approval/Rejection" + EName; string body = "Dear Sir/Madam, <br/> job card request was Rejected < br /> Date : " + job.DateCreated + "+ < br /> , kindly review it. <br/> Employee Name: " + EName + "<br/> Employee No: " + job.EmpID + "<br/> Date Time: " + job.DateCreated.Value.ToShortDateString() + "<br/> Please Click on below link to procced further <a href='http://192.168.0.21/wms'>http://192.168.0.21/ESSP</a>"; EmailManager.SendEmail(Toadd, subject, body); } ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Job_Cards), Convert.ToInt16(AuditManager.AuditOperation.Reject), DateTime.Now, (int)id); int RecordID = job.JobCardAppID; // Below Code is for Notification ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; int TypeID = Convert.ToInt16(Utilities.NotificationType.Job_Card); string TypeName = Utilities.NotificationType.Job_Card.ToString().Replace("_", " "); int EmployeeID = LoggedInUser.EmpID ?? 0; Utilities.DeleteNotification(job.JobCardAppID, Convert.ToInt16(Utilities.NotificationType.Pending_Job_Card)); Utilities.InsertEMPNotification(TypeID, TypeName, EmployeeID, id ?? 0, job.EmpID ?? 0, BaseURL + "Attendance/JobCard/Index"); return(RedirectToAction("Index")); }
/// <inheritdoc /> public override int SaveChanges() { var auditManager = new AuditManager(this); auditManager.CreateAuditRecords("Test", DateTime.UtcNow); return(base.SaveChanges()); }
/// <summary> /// Initializes a new instance of the <see cref="DbContextBase"/> class. /// </summary> /// <param name="eventDispatcher">The event dispatcher.</param> /// <param name="currentUser">The current user.</param> /// <param name="options">The options for this context.</param> public DbContextBase(IEventDispatcher eventDispatcher, ICurrentUser currentUser, DbContextOptions options) : base(options) { EventDispatcher = Guard.ArgumentNotNull(eventDispatcher, nameof(eventDispatcher)); CurrentUser = Guard.ArgumentNotNull(currentUser, nameof(currentUser)); AuditManager = new AuditManager(this); }
public ActionResult Edit([Bind(Include = "GrdID,GradeName,OGradeID,NormalOTAmount,RestOTAmount,GZOTAmount")] HR_Grade hr_grade) { if (ModelState.IsValid) { ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; using (var ctx = new HRMEntities()) { HR_Grade OldGrade = ctx.HR_Grade.First(aa => aa.GrdID == hr_grade.GrdID); HR_GradeHistory GradeHistory = new HR_GradeHistory(); GradeHistory.CDateTime = DateTime.Now; GradeHistory.GradeName = OldGrade.GradeName; GradeHistory.GrdID = OldGrade.GrdID; GradeHistory.GZOTAmount = OldGrade.GZOTAmount; GradeHistory.IP = AuditManager.GetIPAddress(); GradeHistory.NormalOTAmount = OldGrade.NormalOTAmount; GradeHistory.OGradeID = OldGrade.OGradeID; GradeHistory.OGradeID = OldGrade.OGradeID; GradeHistory.RestOTAmount = OldGrade.RestOTAmount; GradeHistory.UserID = loggedUser.UserID; ctx.HR_GradeHistory.Add(GradeHistory); ctx.SaveChanges(); hr_grade.OGradeID = OldGrade.OGradeID; } db.Entry(hr_grade).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Grade), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)hr_grade.GrdID); return(RedirectToAction("Index")); } return(View(hr_grade)); }
public CoreContext() : base("name=SmartMFBERPDB") { System.Data.Entity.Database.SetInitializer <CoreContext>(null); _auditManager = new AuditManager(); }
public ActionResult Edit([Bind(Include = "DeptID,DepartmentName,DivsionID,Status")] HR_Department hr_department) { if (hr_department.DepartmentName == null || hr_department.DepartmentName == "") { ViewBag.error = "Empty Feild"; } else { try { if (ModelState.IsValid) { db.Entry(hr_department).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Department), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)hr_department.DeptID); return(RedirectToAction("Index")); } } catch (Exception) { throw; } } //ViewBag.DivsionID = new SelectList(db.HR_Division, "DivID", "DivisionName", hr_department.DivsionID); return(View(hr_department)); }
public CoreContext() : base(GetDataConnection()) { System.Data.Entity.Database.SetInitializer <CoreContext>(null); _auditManager = new AuditManager(GetDataConnection()); }
public ActionResult ValidateUserLogin(string loginId, string password) { var selectedUser = _db.Users.FirstOrDefault(a => a.UserName == loginId && a.Password == password); if (selectedUser != null) { Session["CurrentUser"] = selectedUser; //return View("~/Areas/Inventory/Views/Asset/Assets.cshtml"); //return Redirect("http://localhost:22223/"); // return RedirectToAction("index", "Home"); return(Json(Url.Action("Index", "Cms"))); } AuditManager.AuditOperation("Incorrect User Id or Password", true); return(Json(false, JsonRequestBehavior.AllowGet)); //else //{ // dynamic myDynamic = new System.Dynamic.ExpandoObject(); // myDynamic.response = false; // myDynamic.msg = "Please Validate user id and password"; // // return myDynamic; // return Json(myDynamic, JsonRequestBehavior.AllowGet); //} }
public void TestDecorateActionInvocationFacet() { var config = new Mock <IAuditConfiguration>(); var auditor = new Mock <IAuditor>(); config.Setup(c => c.DefaultAuditor).Returns(auditor.Object.GetType()); config.Setup(c => c.NamespaceAuditors).Returns(new Dictionary <string, Type> { { "", auditor.Object.GetType() } }); var manager = new AuditManager(config.Object, mockLogger); var testSpec = new Mock <ISpecification>(); var testHolder = new Mock <ISpecification>(); var identifier = new Mock <IIdentifier>(); var testFacet = new Mock <IActionInvocationFacet>(); testHolder.Setup(h => h.Identifier).Returns(identifier.Object); testSpec.Setup(s => s.Identifier).Returns(identifier.Object); testFacet.Setup(n => n.FacetType).Returns(typeof(IActionInvocationFacet)); testFacet.Setup(n => n.Specification).Returns(testSpec.Object); var facet = manager.Decorate(testFacet.Object, testHolder.Object); Assert.IsInstanceOfType(facet, typeof(AuditActionInvocationFacet)); }
/// <summary> /// Initializes a new instance of the <see cref="DbContextBase"/> class. /// </summary> /// <param name="eventDispatcher">The event dispatcher.</param> /// <param name="options">The options for this context.</param> public DbContextBase(IEventDispatcher eventDispatcher, DbContextOptions options) : base(options) { Guard.ArgumentNotNull(eventDispatcher, nameof(eventDispatcher)); AuditManager = new AuditManager(this); EventDispatcher = eventDispatcher; }
public ActionResult Rejected(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } VMS_SVisitor vms_svisitor = db.VMS_SVisitor.Find(id); if (vms_svisitor != null) { vms_svisitor.Status = "Rejected"; db.SaveChanges(); if (vms_svisitor.Status == "Rejected") { var EName = db.EmpViews.First(aa => aa.EmployeeID == vms_svisitor.EmpID).FullName; string Toadd = "*****@*****.**"; string subject = "Pending Visitor's Vehicle Access for Employee" + EName; string body = "Dear Concerned, <br/> your request is Rejected. <br/> Employee Name: " + EName + "<br/> Visitor Name: " + vms_svisitor.VisitorName + "<br/> Vehicle No: " + vms_svisitor.VehicleNo + "<br/> Date Time: " + vms_svisitor.Arrival_Date.Value.ToShortDateString() + vms_svisitor.ArrivalTime + "<br/> Please Click on below link to procced further <a href='http://192.168.0.21/wms'>http://192.168.0.21/ESSP</a>"; EmailManager.SendEmail(Toadd, subject, body); } ViewUserEmp LoggedInUser = Session["LoggedUser"] as ViewUserEmp; int TypeID = Convert.ToInt16(Utilities.NotificationType.PendingVisitorEntry); string TypeName = Utilities.NotificationType.PendingVisitorEntry.ToString().Replace("_", " "); int EmployeeID = LoggedInUser.EmpID ?? 0; Utilities.DeleteNotification(vms_svisitor.ID, Convert.ToInt16(Utilities.NotificationType.PendingVisitorEntry)); Utilities.InsertEMPNotification(TypeID, TypeName, EmployeeID, id ?? 0, vms_svisitor.EmpID ?? 0, BaseURL + "Attendance/ScheduleVisitor/Index"); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Visitor_Entry), Convert.ToInt16(AuditManager.AuditOperation.Reject), DateTime.Now, (int)id); return(RedirectToAction("ListOfPendingVisitor")); } return(RedirectToAction("ListOfPendingVisitor")); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _uiCtx = SynchronizationContext.Current; // get the solution not building and not debugging cookie Guid guid = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; MonitorSelection.GetCmdUIContextCookie(ref guid, out _solutionNotBuildingAndNotDebuggingContextCookie); AuditManager.Initialize(); // Add our command handlers for menu (commands must exist in the .vsct file) AddMenuCommandHandlers(); bool isSolutionLoaded = await IsSolutionLoadedAsync(); if (isSolutionLoaded) { AuditManager.QueueAuditSolutionPackages(); } // Listen for subsequent solution events SolutionEvents.OnAfterOpenSolution += HandleOpenSolution; }
public ActionResult Create([Bind(Include = "RdrID,RdrName,ReaderDutyCode,IpAdd,IpPort,RdrTypeID,Status,LocID")] Att_Reader att_reader) { //att_shift.GZDays = (bool)ValueProvider.GetValue("GZDays").ConvertTo(typeof(bool)); ViewBag.Location = new SelectList(db.HR_Location, "LocID", "LocationName"); ViewBag.DutyCode = new SelectList(db.Att_ReaderDutyCode, "RdrDuty", "DutyName"); ViewBag.ReaderType = new SelectList(db.Att_ReaderType, "RdrTypeID", "RdrTypeName"); try { if (string.IsNullOrEmpty(att_reader.IpAdd)) { ModelState.AddModelError("IpAdd", "Ip Address is required!"); } else { att_reader.ClearRecords = true; if (ModelState.IsValid) { db.Att_Reader.Add(att_reader); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Device), Convert.ToInt16(AuditManager.AuditOperation.Add), DateTime.Now, (int)att_reader.RdrID); return(RedirectToAction("Index")); } return(View(att_reader)); } } catch (Exception) { throw; } return(View()); }
public async Task GetAll_ReturnsRepositoryData() { var repo = new Mock <IRepository <AuditRecord> >(); var repoData = new[] { new AuditRecord { Id = "a" }, new AuditRecord { Id = "b" }, new AuditRecord { Id = "c" }, }; repo.Setup(x => x.GetAll(It.IsAny <Pagination <AuditRecord> >())).ReturnsAsync(repoData); var aConfig = new AuditSettings(); var ecrs = new[] { new EntityConfigRecord { Type = typeof(AuditRecord), EventKeys = new EventKeyRecord("c", "r", "u", "d") } }; var logger = new Mock <ILogger <AuditManager> >(); var aSrv = new AuditManager(repo.Object, aConfig, ecrs, null, logger.Object); var srvRes = await aSrv.GetAll(new AuditPagination()); srvRes.Result.ShouldBe(ServiceResult.Ok); srvRes.Payload.Data.ShouldBe(repoData); }
//public class Audit //{ // public string HostName { get; set; } // public string IpAddress { get; set; } // public string PcName { get; set; } // public string Browser { get; set; } //} //private AuditLog GetAuditLog(HttpRequestBase request) //{ // AuditLog audit = new AuditLog(); // string PCName = Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName; //// var userAgent = Request.Headers["User-Agent"]; // if (Request.UserAgent != null) // { // string strUserAgent = Request.UserAgent.ToString().ToLower(); // string browser = Request.Browser.Browser; // audit.Browser = browser; // } // string ip = Request.UserHostAddress; // audit.IpAddress = ip; // audit.PcName = PCName; // return audit; //} public ActionResult SendMessae(Message aObj) { // AuditManager.AuditOperation(); AuditManager.AuditOperation("Send Message"); // var xx = Request.ServerVariables["REMOTE_ADDR"]; //var audit = GetAuditLog(Request); var audit = AuditManager.GetAuditLog(); // string PCName2 = Dns.GetHostEntry(Request.ServerVariables["REMOTE_ADDR"]).HostName; if (_aManager.CheckTodaysQuotaForMessage(audit)) { String returnMessage = "Sorry! Your per day message sending limit are over"; if (audit != null) { returnMessage += ", for your IP" + audit.IpAddress + " and PC Name" + audit.PcName; } return(Json(new { success = false, Message = returnMessage }, JsonRequestBehavior.AllowGet)); } aObj.Ip = audit.IpAddress; aObj.PcName = audit.PcName;// + "--" + PCName2; aObj.Browser = audit.Browser; var aData = _aManager.SendMessae(aObj); return(Json(aData, JsonRequestBehavior.AllowGet)); }
protected void lnkFileName_Click(object sender, EventArgs e) { string documentId = Request["id"]; //check for id in URL if (!string.IsNullOrEmpty(documentId)) { Article article = DocoManager.GetArticle(documentId); AuditManager.Audit(Page.User.Identity.Name, article.Id, AuditRecord.AuditAction.Viewed); article = DocoManager.GetArticle(documentId); SetTrafficLight(article); string navigateUrl = string.Format( CultureInfo.InvariantCulture, Resource.NewObjectPath, "Files", article.Category.Id); if (!string.IsNullOrEmpty(article.FileName)) { navigateUrl = string.Format( CultureInfo.InvariantCulture, Resource.DocoFilesLoc + Resource.FileOpen, UrlEncoding.Encode(Path.Combine(navigateUrl, article.FileName))); navigateUrl = navigateUrl.Insert(navigateUrl.IndexOf("&"), "&aid=" + article.Id); // go to that url Page.Response.Redirect(navigateUrl); } } }
public ActionResult Edit([Bind(Include = "HolidayID,HolidayDate,HolidayName")] Att_Holiday att_holiday) { if (att_holiday.HolidayDate == null) { ViewBag.date = "required field!"; } else { if (att_holiday.HolidayName == null || att_holiday.HolidayName == "") { ViewBag.name = "required field!"; } else { if (ModelState.IsValid) { db.Entry(att_holiday).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Holiday), Convert.ToInt16(AuditManager.AuditOperation.Edit), DateTime.Now, (int)att_holiday.HolidayID); return(RedirectToAction("Index")); } } } return(View(att_holiday)); }
private bool SubmitAuditLog(int ID, int TypeID, short OperationID, int UserID) { try { if (TypeID == Convert.ToInt16(Utilities.NotificationType.Pre_Job_History)) { AuditManager.SaveAuditLog(UserID, Convert.ToInt16(AuditManager.AuditForm.Pre_Job_History), OperationID, DateTime.Now, ID); } else if (TypeID == Convert.ToInt16(Utilities.NotificationType.Appreciation)) { AuditManager.SaveAuditLog(UserID, Convert.ToInt16(AuditManager.AuditForm.Pre_Job_History), OperationID, DateTime.Now, ID); } else if (TypeID == Convert.ToInt16(Utilities.NotificationType.Warning)) { AuditManager.SaveAuditLog(UserID, Convert.ToInt16(AuditManager.AuditForm.Pre_Job_History), OperationID, DateTime.Now, ID); } else if (TypeID == Convert.ToInt16(Utilities.NotificationType.Training)) { AuditManager.SaveAuditLog(UserID, Convert.ToInt16(AuditManager.AuditForm.Pre_Job_History), OperationID, DateTime.Now, ID); } return(true); } catch (Exception) { throw; return(false); } }
protected void btnAcknowledge_Click(object sender, EventArgs e) { BusiBlocks.DocoBlock.Article latestArticle = BusiBlocks.DocoBlock.DocoManager.GetArticleByName(ArticleName, false); AuditManager.Audit(Page.User.Identity.Name, latestArticle.Id + latestArticle.Version.ToString(), AuditRecord.AuditAction.Acknowledged); Response.Redirect(hidReferrer.Value); }
public void TestCreateOk() { IAuditConfiguration config = new AuditConfiguration <IAuditor>(); config.AddNamespaceAuditor <IAuditor>("namespace"); // ReSharper disable once UnusedVariable var sink = new AuditManager(config, mockLogger); }
private void auditManagerFormNavAction(object sender, object data) { NavBox auditManagerNavBox = (NavBox)sender; AuditManager auditManagerForm = (AuditManager)data; NavBox.NavAction action = auditManagerNavBox.Action; if (action == NavBox.NavAction.BACKANDSUBMIT) { DesktopSession.HistorySession.Back(); action = NavBox.NavAction.SUBMIT; } switch (action) { case NavBox.NavAction.SUBMIT: //Default happy path next state this.parentForm = auditManagerForm; if (auditManagerNavBox.IsCustom) { auditManagerForm.Hide(); if (auditManagerNavBox.CustomDetail.Equals("DOWNLOAD")) { this.nextState = InventoryAuditFlowState.DownloadToTrakker; } else if (auditManagerNavBox.CustomDetail.Equals("UPLOAD")) { this.nextState = InventoryAuditFlowState.UploadFromTrakker; } else if (auditManagerNavBox.CustomDetail.Equals("PROCESSMISSING")) { this.nextState = InventoryAuditFlowState.ProcessMissing; } else if (auditManagerNavBox.CustomDetail.Equals("PROCESSUNEXPECTED")) { this.nextState = InventoryAuditFlowState.ProcessUnexpected; } else if (auditManagerNavBox.CustomDetail.Equals("COUNTCACC")) { this.nextState = InventoryAuditFlowState.CountCACC; } } else { auditManagerForm.Hide(); this.nextState = InventoryAuditFlowState.InventorySummary; } break; case NavBox.NavAction.CANCEL: this.nextState = InventoryAuditFlowState.CancelFlow; break; default: throw new ApplicationException("" + action.ToString() + " is not a valid state for InitiateAudit"); } this.executeNextState(); }
/// <summary> /// Creates the audit records. /// </summary> protected virtual void CreateAuditRecords() { if (CurrentUser == null || AuditManager == null) { return; } AuditManager.CreateAuditRecords(CurrentUser.UserId, DateTime.UtcNow); }
private string GetUserStatus(Item item, string groupId) { bool viewed = false; bool acknowledged = false; IList <VersionItem> publishedVersions = VersionManager.GetPublishedVersions(groupId); int currentVersPubMajPart = Int32.Parse(publishedVersions.First <VersionItem>(x => x.ItemId.Equals(item.Id)).VersionNumber.Split('.').First()); //for a minor -> minor change if (publishedVersions.First <VersionItem>(x => x.ItemId.Equals(item.Id)).EditSeverity.Equals("minor")) { foreach (VersionItem version in publishedVersions) { int temp = Int32.Parse(version.VersionNumber.Split('.').First()); if (temp == currentVersPubMajPart) { //reset traffic light if ack required else check audit table(reset if no record exists) if (!item.RequiresAck) { if (AuditManager.GetAuditItems(Page.User.Identity.Name, version.ItemId, AuditRecord.AuditAction.Viewed).Count > 0) { viewed = true; break; } } else { if (AuditManager.GetAuditItems(Page.User.Identity.Name, item.Id, AuditRecord.AuditAction.Acknowledged).Count > 0) { acknowledged = true; } } } } } else { if (!item.RequiresAck) { if (AuditManager.GetAuditItems(Page.User.Identity.Name, item.Id, AuditRecord.AuditAction.Viewed).Count > 0) { viewed = true; } } else { //the scenario for traffic lights when its a major publish and acknowledgement is not required is not covered here since we are not capturing that in Audit table. if (AuditManager.GetAuditItems(Page.User.Identity.Name, item.Id, AuditRecord.AuditAction.Acknowledged).Count > 0) { acknowledged = true; } } } return(GetImageUrl(item.RequiresAck, (acknowledged || viewed))); }
public void RemoveMentionsAbout_does_not_do_anything_if_no_mentions_found() { var manager = new AuditManager(10); var file = new FileContent("Audit_1.txt", new[] { "1;Sasha Grey;2016-06-09T08:37:00" }); IReadOnlyList <FileAction> actions = manager.RemoveMentionsAbout("Németh Dávid", new[] { file }); Assert.Equal(0, actions.Count); }
public ActionResult DeleteConfirmed(byte id) { Att_Holiday att_holiday = db.Att_Holiday.Find(id); db.Att_Holiday.Remove(att_holiday); db.SaveChanges(); ViewUserEmp loggedUser = Session["LoggedUser"] as ViewUserEmp; AuditManager.SaveAuditLog(loggedUser.UserID, Convert.ToInt16(AuditManager.AuditForm.Holiday), Convert.ToInt16(AuditManager.AuditOperation.Delete), DateTime.Now, (int)att_holiday.HolidayID); return(RedirectToAction("Index")); }
public bool OnRemoveBefore <T>(IEntityRequestContext context, T entity) where T : class, IEntityIdentity { var info = EntityInfoManager.GetInfo(entity); if (!AuthorizationHelper.CanRemove(context.Who, info)) { AuditManager.LogAccess(context.Who, IdentityManager.GetClientMachine(context.Who), info.Module, entity._key, null, null, entity, context.TransactionUID); throw new UnauthorizedAccessException(); } return(true); }
public bool OnGetPagedBefore <T>(IEntityRequestContext context) where T : class, IEntityIdentity { var info = EntityInfoManager.GetInfo(typeof(T)); if (!AuthorizationHelper.CanView(context.Who, info)) { AuditManager.LogChange <T>(context.Who, info.Module, info.Entity, null, null, null, "ACC", null, null, context.TransactionUID); throw new UnauthorizedAccessException(); } return(true); }
public static void CreateWS(AuditManager.Model.WsCreate wsCreate) { //IM.Mgr.WsUtility.CreateWS(wsCreate) //using (new TransactionScope( // TransactionScopeOption.Required, // new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted })) //{ using (var db = new ActiveDbContext()) { var p = wsCreate.PartnerId.ToUserIdFromDnsName(); var m = wsCreate.ManagerId.ToUserIdFromDnsName(); var c4 = db.CUSTOM4.Where(x => x.CUSTOM_ALIAS.Equals(p)).FirstOrDefault(); if (c4 == null) { var p_db = WsUsrMgmt.SearchUsr(p, Model.UsrSearchBy.Email, true); if (p_db != null && p_db.Count > 0) { var p_2_In = p_db.FirstOrDefault(); var p_In = db.CUSTOM4.Add(new CUSTOM4 { CUSTOM_ALIAS = p_2_In.Name, C_DESCRIPT = p_2_In.FullName, EDITWHEN = DateTime.Now, ENABLED = "Y", IS_HIPAA = "N" }); db.SaveChanges(); } else { throw new Exception(string.Format("Failure creating workspace: Partner => {0} not defined in [DOCUSERS] table.", p)); } } var c6 = db.CUSTOM6.Where(x => x.CUSTOM_ALIAS.Equals(m)).FirstOrDefault(); if (c6 == null) { var m_db = WsUsrMgmt.SearchUsr(m, Model.UsrSearchBy.Email, true); if (m_db != null && m_db.Count > 0) { var m_2_In = m_db.FirstOrDefault(); var m_In = db.CUSTOM6.Add(new CUSTOM6 { CUSTOM_ALIAS = m_2_In.Name, C_DESCRIPT = m_2_In.FullName, EDITWHEN = DateTime.Now, ENABLED = "Y", IS_HIPAA = "N" }); db.SaveChanges(); } else { throw new Exception(string.Format("Failure creating workspace: Manager => {0} not defined in [DOCUSERS] table.", m)); } } } //} //var cur_Eng = AuditManager.Rep.Workspace.GetEngByEngNum(wsCreate.EngagementNumber, Model.WsLoadType.None, true); //if (cur_Eng == null // || cur_Eng.Count == 0) //{ // IM.Mgr.WsUtility.CreateWS(wsCreate); // AuditManager.Rep.WsOperation.UpdateWsProfile(wsCreate.EngagementNumber, wsCreate.WsProfile_TP, Model.UpdateProfileFrom.CreateWs); // return; //} //else //{ // throw new Exception(string.Format("Workspace => {0} already exists.", wsCreate.EngagementNumber)); //} IM.Mgr.WsUtility.CreateWS(wsCreate); //AuditManager.Rep.WsOperation.UpdateWsProfile(wsCreate.EngagementNumber, wsCreate.WsProfile_TP, Model.UpdateProfileFrom.CreateWs); return; }