public ActionResult BusinessRiskInsert(BusinessRisk businessRisk, int companyId, int userId) { var res = businessRisk.Insert(userId); if (res.Success) { //// string differences = businessRisk.Differences(BusinessRisk.Empty); //// ActionResult logRes = ActivityLog.BusinessRisk(Convert.ToInt64(res.MessageError), userId, companyId, DepartmentLogActions.Create, differences); this.Session["Company"] = new Company(companyId); } return(res); }
public ActionResult BusinessRiskUpdate(BusinessRisk newBusinessRisk, int companyId, int userId) { var res = newBusinessRisk.Update(userId); if (res.Success) { if (newBusinessRisk.FinalDate.HasValue && newBusinessRisk.FinalAction == 3) { var newBusinessRiskEvaluated = new BusinessRisk { Description = newBusinessRisk.Description, Code = newBusinessRisk.Code, DateStart = newBusinessRisk.FinalDate.Value, Notes = newBusinessRisk.Notes, ItemDescription = newBusinessRisk.ItemDescription, Causes = newBusinessRisk.Causes, FinalSeverity = 0, FinalProbability = 0, FinalResult = 0, FinalDate = null, StartProbability = newBusinessRisk.FinalProbability, StartSeverity = newBusinessRisk.FinalSeverity, StartResult = newBusinessRisk.FinalResult, StartAction = 3, Active = true, CompanyId = newBusinessRisk.CompanyId, PreviousBusinessRiskId = newBusinessRisk.Id, Result = Convert.ToInt32(newBusinessRisk.FinalResult), Process = newBusinessRisk.Process, ProcessId = newBusinessRisk.Process.Id, Rules = newBusinessRisk.Rules }; res = newBusinessRiskEvaluated.Insert(userId); var newUser = ApplicationUser.GetById(userId, companyId); var newAction = new IncidentAction { IncidentId = 0, BusinessRiskId = newBusinessRiskEvaluated.Id, Description = newBusinessRisk.Description, WhatHappened = newBusinessRisk.ItemDescription, WhatHappenedBy = newUser.Employee, WhatHappenedOn = newBusinessRisk.FinalDate, Causes = newBusinessRiskEvaluated.Causes, CausesBy = newUser.Employee, CausesOn = newBusinessRisk.FinalDate, CompanyId = newBusinessRiskEvaluated.CompanyId, ReporterType = 1, Origin = 4, ActionType = 3 }; newAction.Insert(userId); } this.Session["Company"] = new Company(companyId); } return(res); }