public async Task <IActionResult> Edit(int id, [Bind("ResolutionLogId,DateTime,UpdaterId,ResolutionDetails,SurveyId,Status,ApplicationUserId")] ResolutionLog resolutionLog) { if (id != resolutionLog.ResolutionLogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(resolutionLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResolutionLogExists(resolutionLog.ResolutionLogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "Password", resolutionLog.ApplicationUserId); ViewData["SurveyId"] = new SelectList(_context.Surveys, "SurveyId", "SurveyId", resolutionLog.SurveyId); return(View(resolutionLog)); }
public async Task <IActionResult> Edit(int id, [Bind("ResolutionLogId,DateTime,ResolutionDetails,SurveyId,Status,UserId,OutletId")] ResolutionLog resolutionLog) { if (id != resolutionLog.ResolutionLogId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(resolutionLog); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ResolutionLogExists(resolutionLog.ResolutionLogId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(resolutionLog)); }
public async Task <IActionResult> Create([Bind("ResolutionLogId,DateTime,ResolutionDetails,SurveyId,Status,UserId,OutletId")] ResolutionLog resolutionLog) { if (ModelState.IsValid) { _context.Add(resolutionLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(resolutionLog)); }
public async Task <IActionResult> Create([Bind("ResolutionLogId,DateTime,UpdaterId,ResolutionDetails,SurveyId,Status,ApplicationUserId")] ResolutionLog resolutionLog) { if (ModelState.IsValid) { _context.Add(resolutionLog); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUsers, "Id", "FullName", resolutionLog.ApplicationUserId); ViewData["SurveyId"] = new SelectList(_context.Surveys, "SurveyId", "SurveyId", resolutionLog.SurveyId); return(View(resolutionLog)); }
protected void PrepareDocumentUnitLog(FascicleDocumentUnit entity, FascicleLog fascicleLog) { if (entity.DocumentUnit.Environment == (int)DSWEnvironmentType.Protocol) { Protocol protocol = _unitOfWork.Repository <Protocol>().GetByUniqueId(entity.DocumentUnit.UniqueId).SingleOrDefault(); ProtocolLog protocolLog = new ProtocolLog() { Year = entity.DocumentUnit.Year, Number = entity.DocumentUnit.Number, LogDate = fascicleLog.RegistrationDate.DateTime, LogType = "FS", Program = "Private.WebAPI", LogDescription = fascicleLog.LogDescription, RegistrationUser = fascicleLog.RegistrationUser, SystemComputer = fascicleLog.SystemComputer, Entity = protocol, }; protocolLog.Hash = HashGenerator.GenerateHash(string.Concat(protocolLog.RegistrationUser, "|", protocolLog.Year, "|", protocolLog.Number, "|", protocolLog.LogType, "|", protocolLog.LogDescription, "|", protocolLog.UniqueId, "|", protocolLog.Entity.UniqueId, "|", protocolLog.LogDate.ToString("yyyyMMddHHmmss"))); _unitOfWork.Repository <ProtocolLog>().Insert(protocolLog); } if (entity.DocumentUnit.Environment == (int)DSWEnvironmentType.Resolution) { Resolution resolution = _unitOfWork.Repository <Resolution>().GetByUniqueId(entity.DocumentUnit.UniqueId).SingleOrDefault(); ResolutionLog resolutionLog = new ResolutionLog() { LogDate = fascicleLog.RegistrationDate.DateTime, LogType = "FS", Program = "Private.WebAPI", LogDescription = fascicleLog.LogDescription, RegistrationUser = fascicleLog.RegistrationUser, SystemComputer = fascicleLog.SystemComputer, Entity = resolution, }; resolutionLog.Hash = HashGenerator.GenerateHash(string.Concat(resolutionLog.RegistrationUser, "|", resolutionLog.LogType, "|", resolutionLog.LogDescription, "|", resolutionLog.UniqueId, "|", resolutionLog.Entity.UniqueId, "|", resolutionLog.LogDate.ToString("yyyyMMddHHmmss"))); _unitOfWork.Repository <ResolutionLog>().Insert(resolutionLog); } if (entity.DocumentUnit.Environment == (int)DSWEnvironmentType.DocumentSeries) { DocumentSeriesItem documentSeriesItem = _unitOfWork.Repository <DocumentSeriesItem>().GetByUniqueId(entity.DocumentUnit.UniqueId).SingleOrDefault(); DocumentSeriesItemLog documentSeriesItemLog = new DocumentSeriesItemLog() { LogDate = fascicleLog.RegistrationDate.DateTime, LogType = "FS", Program = "Private.WebAPI", LogDescription = fascicleLog.LogDescription, RegistrationUser = fascicleLog.RegistrationUser, SystemComputer = fascicleLog.SystemComputer, Entity = documentSeriesItem, }; documentSeriesItemLog.Hash = HashGenerator.GenerateHash(string.Concat(documentSeriesItemLog.RegistrationUser, "|", documentSeriesItemLog.LogType, "|", documentSeriesItemLog.LogDescription, "|", documentSeriesItemLog.UniqueId, "|", documentSeriesItemLog.Entity.UniqueId, "|", documentSeriesItemLog.LogDate.ToString("yyyyMMddHHmmss"))); _unitOfWork.Repository <DocumentSeriesItemLog>().Insert(documentSeriesItemLog); } if (entity.DocumentUnit.Environment >= 100) { UDSRepository uDSRepository = _unitOfWork.Repository <UDSRepository>().GetByIdDocumentUnit(entity.DocumentUnit.UniqueId); UDSLog log = new UDSLog() { LogType = UDSLogType.Delete, LogDescription = fascicleLog.LogDescription, SystemComputer = string.IsNullOrEmpty(fascicleLog.SystemComputer) ? Environment.MachineName : fascicleLog.SystemComputer, Entity = uDSRepository, RegistrationDate = fascicleLog.RegistrationDate.DateTime, RegistrationUser = fascicleLog.RegistrationUser, IdUDS = entity.DocumentUnit.UniqueId, Environment = entity.DocumentUnit.Environment, }; log.Hash = HashGenerator.GenerateHash(string.Concat(log.RegistrationUser, "|", log.LogType, "|", log.LogDescription, "|", log.UniqueId, "|", log.IdUDS, "|", log.RegistrationDate.ToString("yyyyMMddHHmmss"))); _unitOfWork.Repository <UDSLog>().Insert(log); } }