private bool SystemConfigSave() { var result = true; var message = SettingChecking(); try { if (string.IsNullOrEmpty(message)) { var config = new Models.Entity.SystemConfig(); config.Code = (int)Enums.Entity.SystemConfigType.COMPort; config.Value = comboBoxCOMPort.SelectedValue.ToString(); SystemConfigService.SaveSystemConfig(config); config.Code = (int)Enums.Entity.SystemConfigType.科別代碼; config.Value = comboBoxClinic.SelectedValue.ToString(); SystemConfigService.SaveSystemConfig(config); config.Code = (int)Enums.Entity.SystemConfigType.醫師代碼; config.Value = comboBoxClinic.SelectedValue.ToString(); SystemConfigService.SaveSystemConfig(config); return(result); } else { result = false; var caption = "警告"; var button = MessageBoxButtons.OK; var icon = MessageBoxIcon.Error; Dialog(message, caption, button, icon); return(result); } } catch (Exception ex) { log.Error(ex.ToString()); result = false; return(result); } }