private void CreateMissingJobCstActs(DataTable recordsToInsert, string dbName, string sqlOperation = "INSERT", string activity = "") { try { recordsToInsert.Columns.Add("po_type"); bool isFirstRow = true; foreach (DataRow row in recordsToInsert.Rows) { if (InsertJobCstActsRecord(row)) { if (isFirstRow) { _serviceLog.AppendLogMessage(String.Format("\nThe following activities have been created in {0} for job {1}:", dbName, row["NewJobNumber"])); _serviceLog.AppendLogMessage("NewJobNumber\t\tActivity"); isFirstRow = false; } _serviceLog.AppendLogMessage($"{row["NewJobNumber"]}\t\t{row["activity"]}"); } } } catch (Exception ex) { _serviceLog.AppendLog(ex.ToString()); } }
private void ReconcileMissingJobCostActivityRecords() { Console.WriteLine("1 - Reconcile JobCstActs (EGM) Amounts By Job"); Console.WriteLine("2 - Reconcile JobCstActs (EGM) Amounts By Job and Activity"); Console.WriteLine("3 - Audit HomeEstimateToApproved Sapphire Workflow EGM Amounts"); string jobNumber = String.Empty; if (int.TryParse(Console.ReadLine(), out int result2)) { switch (result2) { case 1: _serviceLog.AppendLogMessage("Reconciling JobCstActs (EGM) Missing Records and update EGM Amounts By Job"); this.dataObject = "JobCstActs"; ReconcileJobCstActRecordsAndEGMAmounts(); break; case 2: _serviceLog.AppendLogMessage("Validate JobCstActs (EGM) Amounts by Job and Activity"); this.dataObject = "JobCstActs"; ReconcileJobCstActByJobAndActivity(); break; case 3: _serviceLog.AppendLogMessage("Audit HomeEstimateToApproved Sapphire Workflow EGM Amounts"); this.dataObject = "JobCstActs"; AuditSapphireWorkflow(Model.Enums.Workflow.HomeEstimateStatusToApproved); break; default: _consoleLogger.Info("Please select a valid option."); ReconcileMissingJobCostActivityRecords(); break; } } else { _consoleLogger.Info("Please select a valid option."); ReconcileMissingJobCostActivityRecords(); } }