protected void btnAdd_Click(object sender, EventArgs e) { List <t_LanguageTranslate> list = languageBL.FindAll(x => x.Language == language && x.Noted.Contains("/Supervisor/Site/Config.aspx")).ToList(); var lb_installation_point_update_confirm = list.Where(x => x.ControlId.Contains("lb_installation_point_update_confirm")).FirstOrDefault(); ntf.VisibleOnPageLoad = true; bool invalid = IsInvalidInput(); if (invalid) { return; } var dbSite = _siteBL.GetSite(cboSites.Text); var site = GetSite(); var loggerConfiguration = GetLoggerConfiguration(); var dbLoggerConfiguration = _loggerConfigurationBL.GetLoggerConfiguration(txtLoggerID.Text); if (dbSite == null) { if (dbLoggerConfiguration == null) { _loggerConfigurationBL.InsertLoggerConfiguration(loggerConfiguration); //site.t_Logger_Configurations = loggerConfiguration; } else { loggerConfiguration.ForwardFlow = dbLoggerConfiguration.ForwardFlow; loggerConfiguration.Pressure1 = dbLoggerConfiguration.Pressure1; loggerConfiguration.Pressure2 = dbLoggerConfiguration.Pressure2; loggerConfiguration.ReverseFlow = dbLoggerConfiguration.ReverseFlow; _loggerConfigurationBL.UpdateLoggerConfiguration(loggerConfiguration, dbLoggerConfiguration); } _siteBL.InsertSite(site); ReBind(); //ntf.Text = "Đã thêm mới điểm lắp đặt."; ntf.Text = lb_installation_point_update_confirm.Contents; } else { if (dbLoggerConfiguration == null) { _loggerConfigurationBL.InsertLoggerConfiguration(loggerConfiguration); } else { loggerConfiguration.ForwardFlow = dbLoggerConfiguration.ForwardFlow; loggerConfiguration.Pressure1 = dbLoggerConfiguration.Pressure1; loggerConfiguration.Pressure2 = dbLoggerConfiguration.Pressure2; loggerConfiguration.ReverseFlow = dbLoggerConfiguration.ReverseFlow; _loggerConfigurationBL.UpdateLoggerConfiguration(loggerConfiguration, dbLoggerConfiguration); } _siteBL.UpdateSite(site, dbSite); ntf.Text = "Data saved."; } }