public ProcessBaseVm(AdminLevel a, ProcessDetails s, ICalcIndicators c) { r = new ProcessRepository(); this.model = r.GetById(s.Id); adminLevel = a; calc = c; }
public void Delete(ProcessDetails Process, int userId) { OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString); using (connection) { connection.Open(); try { OleDbCommand command = new OleDbCommand(@"UPDATE processes SET IsDeleted=@IsDeleted, UpdatedById=@UpdatedById, UpdatedAt=@UpdatedAt WHERE ID=@id", connection); command.Parameters.Add(new OleDbParameter("@IsDeleted", true)); command.Parameters.Add(new OleDbParameter("@UpdatedById", userId)); command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@UpdatedAt", DateTime.Now)); command.Parameters.Add(new OleDbParameter("@id", Process.Id)); command.ExecuteNonQuery(); } catch (Exception) { throw; } } }
public IView GetProcess(ProcessDetails details) { return new DataEntryEdit(new ProcessBaseVm(adminLevel, details, new CalcProcess())); }
public void Delete(ProcessDetails details, int userId) { processes.Delete(details, userId); }
private ProcessBase SplitProcesses(List<ProcessBase> toMerge, ProcessDetails details, AdminLevel dest, double multiplier, int redistrictId, OleDbCommand command, OleDbConnection connection) { var process = processRepo.GetById(details.Id); var newForm = Util.DeepClone(process); if (newForm.AdminLevelId != dest.Id) { newForm.Id = 0; newForm.IsRedistricted = true; newForm.AdminLevelId = dest.Id; } newForm.IndicatorValues = RedistributeIndicators(process.IndicatorValues, multiplier); if (toMerge == null) { processRepo.Save(command, connection, newForm, userId); demoRepo.InsertRedistrictForm(command, connection, userId, redistrictId, process.Id, newForm.Id, IndicatorEntityType.Process); } else toMerge.Add(newForm); return newForm; }