private void UpsertMonitorMonitorCommandLimits() { try { for (int item = 0; item < rptCommandLimits.Items.Count; item++) { var monitorLimit = new MonitorCommandLimit(); var repeaterItem = rptCommandLimits.Items[item]; var command = repeaterItem.FindControl("lblType") as Label; if (command == null) { return; } monitorLimit.Type = command.Text; var warningLimit = repeaterItem.FindControl("txtWarningLimit") as TextBox; if (warningLimit == null) { return; } monitorLimit.WarningLimit = warningLimit.Text == string.Empty ? (int?)null : Convert.ToInt32(warningLimit.Text.Trim()); TextBox errorLimit = repeaterItem.FindControl("txtErrorLimit") as TextBox; if (errorLimit == null) { return; } monitorLimit.ErrorLimit = errorLimit.Text == string.Empty ? (int?)null : Convert.ToInt32(errorLimit.Text.Trim()); if ( (monitorLimit.WarningLimit == null) && (monitorLimit.ErrorLimit == null)) { continue; } monitorDb.UpsertMonitorCommandLimit(monitorLimit); } LoadValues(); } catch (Exception ex) { throw new Exception($"Exception: {ex.Message}"); } }