private void SaveProgram() { SaveClinicCurProgramPropertiesToDict(); _progCur.Enabled = checkEnabled.Checked; _progCur.Path = textPath.Text; _progCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); ToolButItems.DeleteAllForProgram(_progCur.ProgramNum); //Then add one toolButItem for each highlighted row in listbox ToolButItem toolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { toolButItemCur = new ToolButItem() { ProgramNum = _progCur.ProgramNum, ButtonText = textButtonText.Text, ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i] }; ToolButItems.Insert(toolButItemCur); } if (_pathOverrideOld != textOverride.Text) //If there was no previous override _pathOverrideOld will be empty string. { _hasProgramPropertyChanged = true; ProgramProperties.InsertOrUpdateLocalOverridePath(_progCur.ProgramNum, textOverride.Text); } UpdateProgramProperty(_patNumOrChartNum, POut.Bool(radioChart.Checked)); //Will need to be enhanced if another radio button ever gets added. UpdateProgramProperty(_infoFilePath, textInfoFile.Text); UpsertProgramPropertiesForClinics(); Programs.Update(_progCur); }
private void butOK_Click(object sender, System.EventArgs e) { if (checkEnabled.Checked && textPluginDllName.Text != "") { string dllPath = ODFileUtils.CombinePaths(Application.StartupPath, textPluginDllName.Text); if (dllPath.Contains("[VersionMajMin]")) { Version vers = new Version(Application.ProductVersion); dllPath = dllPath.Replace("[VersionMajMin]", ""); //now stripped clean } if (!File.Exists(dllPath)) { MessageBox.Show(Lan.g(this, "Dll file not found:") + " " + dllPath); return; } } if (textPluginDllName.Text != "" && textPath.Text != "") { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "If both a path and a plug-in are specified, the path will be ignored. Continue anyway?")) { return; } } ProgramCur.ProgName = textProgName.Text; ProgramCur.ProgDesc = textProgDesc.Text; ProgramCur.Enabled = checkEnabled.Checked; ProgramCur.Path = textPath.Text; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(ProgramCur.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } ProgramCur.CommandLine = textCommandLine.Text; ProgramCur.PluginDllName = textPluginDllName.Text; ProgramCur.Note = textNote.Text; ProgramCur.ButtonImage = POut.Bitmap((Bitmap)pictureBox.Image, System.Drawing.Imaging.ImageFormat.Png); if (IsNew) { Programs.Insert(ProgramCur); } else { Programs.Update(ProgramCur); } ToolButItems.DeleteAllForProgram(ProgramCur.ProgramNum); //then add one toolButItem for each highlighted row in listbox ToolButItem ToolButItemCur; for (int i = 0; i < listToolBars.SelectedIndices.Count; i++) { ToolButItemCur = new ToolButItem(); ToolButItemCur.ProgramNum = ProgramCur.ProgramNum; ToolButItemCur.ButtonText = textButtonText.Text; ToolButItemCur.ToolBar = (ToolBarsAvail)listToolBars.SelectedIndices[i]; ToolButItems.Insert(ToolButItemCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, System.EventArgs e) { if (prog == null) { MsgBox.Show(this, "X-Charge entry is missing from the database."); //should never happen return; } if (textOverride.Text != "") { if (!File.Exists(textOverride.Text)) { MsgBox.Show(this, "Local override path is not valid."); return; } } else if (!File.Exists(textPath.Text)) { MsgBox.Show(this, "Path is not valid."); return; } if (comboPaymentType.SelectedIndex == -1) { MsgBox.Show(this, "Please select a payment type first."); return; } prog.Enabled = checkEnabled.Checked; prog.Path = textPath.Text; if (pathOverrideOld != textOverride.Text) { ProgramProperties.InsertOrUpdateLocalOverridePath(prog.ProgramNum, textOverride.Text); ProgramProperties.RefreshCache(); } Programs.Update(prog); string paymentType = DefC.Short[(int)DefCat.PaymentTypes][comboPaymentType.SelectedIndex].DefNum.ToString(); ProgramProperties.SetProperty(prog.ProgramNum, "PaymentType", paymentType); ProgramProperties.SetProperty(prog.ProgramNum, "Username", textUser.Text); ProgramProperties.SetProperty(prog.ProgramNum, "Password", textPassword.Text); DataValid.SetInvalid(InvalidType.Programs); DialogResult = DialogResult.OK; }