private void butOK_Click(object sender, EventArgs e) { if (textDateAgreement.errorProvider1.GetError(textDateAgreement) != "" || textDateFirstPay.errorProvider1.GetError(textDateFirstPay) != "") { MsgBox.Show(this, "Please enter valid dates."); return; } if (textMonthlyPayment.errorProvider1.GetError(textMonthlyPayment) != "") { MsgBox.Show(this, "Please enter a valid monthly payment."); return; } if (textAPR.errorProvider1.GetError(textAPR) != "") { MsgBox.Show(this, "Please enter a valid annual percentage rate (APR)."); return; } InstallmentPlanCur.DateAgreement = PIn.Date(textDateAgreement.Text); InstallmentPlanCur.DateFirstPayment = PIn.Date(textDateFirstPay.Text); InstallmentPlanCur.MonthlyPayment = PIn.Double(textMonthlyPayment.Text); InstallmentPlanCur.APR = PIn.Float(textAPR.Text); InstallmentPlanCur.Note = PIn.String(textNote.Text); if (IsNew) { InstallmentPlans.Insert(InstallmentPlanCur); } else { InstallmentPlans.Update(InstallmentPlanCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } Supp.Category = DefC.Short[(int)DefCat.SupplyCats][comboCategory.SelectedIndex].DefNum; Supp.CatalogNumber = textCatalogNumber.Text; Supp.Descript = textDescript.Text; Supp.LevelDesired = PIn.Float(textLevelDesired.Text); Supp.Price = PIn.Double(textPrice.Text); Supp.IsHidden = checkIsHidden.Checked; if (Supp.Category != categoryInitialVal) { Supp.ItemOrder = int.MaxValue; //changed categories, new or existing, move to bottom of new category. } if (Supp.IsNew) { Supp = Supplies.GetSupply(Supplies.Insert(Supp, Supp.ItemOrder)); //insert Supp and update with PK and item order from DB. } else { Supplies.Update(SuppOriginal, Supp); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } Supp.Category = _listSupplyCatDefs[comboCategory.SelectedIndex].DefNum; Supp.CatalogNumber = textCatalogNumber.Text; Supp.Descript = textDescript.Text; Supp.LevelDesired = PIn.Float(textLevelDesired.Text); Supp.LevelOnHand = PIn.Float(textLevelOnHand.Text); Supp.Price = PIn.Double(textPrice.Text); Supp.IsHidden = checkIsHidden.Checked; if (Supp.Category != categoryInitialVal) { Supp.ItemOrder = int.MaxValue; //changed categories, new or existing, move to bottom of new category. } //No longer saving changes from this form. DialogResult = DialogResult.OK; }
private void pictDraw_MouseMove(object sender, MouseEventArgs e) { if (!mouseIsDown) { return; } if (checkErase.Checked) { //look for any lines that intersect the "eraser". //since the line segments are so short, it's sufficient to check end points. //Point point; string[] xy; string[] pointStr; float x; float y; float dist; //the distance between the point being tested and the center of the eraser circle. float radius = 8f; //by trial and error to achieve best feel. PointF eraserPt = new PointF(e.X + pictDraw.Left + 8.49f, e.Y + pictDraw.Top + 8.49f); foreach (SheetField field in SheetCur.SheetFields) { if (field.FieldType != SheetFieldType.Drawing) { continue; } pointStr = field.FieldValue.Split(';'); for (int p = 0; p < pointStr.Length; p++) { xy = pointStr[p].Split(','); if (xy.Length == 2) { x = PIn.Float(xy[0]); y = PIn.Float(xy[1]); dist = (float)Math.Sqrt(Math.Pow(Math.Abs(x - eraserPt.X), 2) + Math.Pow(Math.Abs(y - eraserPt.Y), 2)); if (dist <= radius) //testing circle intersection here { SheetCur.SheetFields.Remove(field); drawingsAltered = true; RefreshPanel(); return;; } } } } return; } PointList.Add(new Point(e.X, e.Y)); //RefreshPanel(); //just add the last line segment instead of redrawing the whole thing. Graphics g = Graphics.FromImage(pictDraw.Image); g.SmoothingMode = SmoothingMode.HighQuality; Pen pen = new Pen(Brushes.Black, 2f); int i = PointList.Count - 1; g.DrawLine(pen, PointList[i - 1].X, PointList[i - 1].Y, PointList[i].X, PointList[i].Y); pictDraw.Invalidate(); g.Dispose(); }
///<summary>This ONLY runs when first opening the program. Gets run early in the sequence. Returns false if the program should exit.</summary> public static bool CheckMySqlVersion() { if (DataConnection.DBtype != DatabaseType.MySql) { return(true); } string thisVersion = MiscData.GetMySqlVersion(); float floatVersion = PIn.Float(thisVersion.Substring(0, 3)); if (floatVersion < 5.0f) { //We will force users to upgrade to 5.0, but not yet to 5.5 MessageBox.Show(Lan.g("Prefs", "Your version of MySQL won't work with this program") + ": " + thisVersion + ". " + Lan.g("Prefs", "You should upgrade to MySQL 5.0 using the installer on our website.")); Application.Exit(); return(false); } if (!PrefC.ContainsKey("MySqlVersion")) //db has not yet been updated to store this pref //We're going to skip this. We will recommend that people first upgrade OD, then MySQL, so this won't be an issue. { } else if (Prefs.UpdateString(PrefName.MySqlVersion, floatVersion.ToString("f1"))) { if (!MsgBox.Show("Prefs", MsgBoxButtons.OKCancel, "Tables will now be optimized. This will take a minute or two.")) { Application.Exit(); return(false); } DatabaseMaintenance.RepairAndOptimize(); } if (PrefC.ContainsKey("DatabaseConvertedForMySql41")) { return(true); //already converted } if (!MsgBox.Show("Prefs", true, "Your database will now be converted for use with MySQL 4.1.")) { Application.Exit(); return(false); } //ClassConvertDatabase CCD=new ClassConvertDatabase(); try { MiscData.MakeABackup(); } catch (Exception e) { if (e.Message != "") { MessageBox.Show(e.Message); } MsgBox.Show("Prefs", "Backup failed. Your database has not been altered."); Application.Exit(); return(false); //but this should never happen } MessageBox.Show("Backup performed"); Prefs.ConvertToMySqlVersion41(); MessageBox.Show("converted"); //Refresh(); return(true); }
private void butOK_Click(object sender, EventArgs e) { //if(textEhrKey.Text=="") { // MessageBox.Show("Key must not be blank"); // return; //} try{ float fte = float.Parse(textFullTimeEquiv.Text); if (fte <= 0) { MessageBox.Show("FTE must be greater than 0."); return; } if (fte > 1) { MessageBox.Show("FTE must be 1 or less."); return; } } catch { //not allowed to be blank. Usually 1. MessageBox.Show("Invalid FTE."); return; } if (textEhrKey.Text != "") { bool provKeyIsValid = false; #if EHRTEST provKeyIsValid = ((FormEHR)FormOpenDental.FormEHR).ProvKeyIsValid(textLName.Text, textFName.Text, checkHasReportAccess.Checked, textEhrKey.Text); #else Type type = FormOpenDental.AssemblyEHR.GetType("EHR.FormEHR"); //namespace.class object[] args = new object[] { textLName.Text, textFName.Text, checkHasReportAccess.Checked, textEhrKey.Text }; provKeyIsValid = (bool)type.InvokeMember("ProvKeyIsValid", System.Reflection.BindingFlags.InvokeMethod, null, FormOpenDental.FormEHR, args); #endif if (!provKeyIsValid) { MessageBox.Show("Invalid provider key"); return; } } KeyCur.LName = textLName.Text; KeyCur.FName = textFName.Text; KeyCur.HasReportAccess = checkHasReportAccess.Checked; KeyCur.ProvKey = textEhrKey.Text; KeyCur.FullTimeEquiv = PIn.Float(textFullTimeEquiv.Text); KeyCur.Notes = textNotes.Text; if (KeyCur.IsNew) { EhrProvKeys.Insert(KeyCur); } else { EhrProvKeys.Update(KeyCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { //if(textEhrKey.Text=="") { // MessageBox.Show("Key must not be blank"); // return; //} try{ float fte = float.Parse(textFullTimeEquiv.Text); if (fte <= 0) { MessageBox.Show("FTE must be greater than 0."); return; } if (fte > 1) { MessageBox.Show("FTE must be 1 or less."); return; } } catch { //not allowed to be blank. Usually 1. MessageBox.Show("Invalid FTE."); return; } if (textEhrKey.Text != "") { if (!FormEHR.ProvKeyIsValid(textLName.Text, textFName.Text, checkHasReportAccess.Checked, textEhrKey.Text)) { MessageBox.Show("Invalid provider key"); return; } } KeyCur.LName = textLName.Text; KeyCur.FName = textFName.Text; KeyCur.HasReportAccess = checkHasReportAccess.Checked; KeyCur.ProvKey = textEhrKey.Text; KeyCur.FullTimeEquiv = PIn.Float(textFullTimeEquiv.Text); KeyCur.Notes = textNotes.Text; if (KeyCur.IsNew) { EhrProvKeys.Insert(KeyCur); } else { EhrProvKeys.Update(KeyCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date."); return; } if (_provStudent == null) { MsgBox.Show(this, "Please attach a student to this evaluation."); return; } if (!String.IsNullOrWhiteSpace(textGradeNumberOverride.Text)) { //Overrides are not saved to the database. They are found by comparing calculated grades to grades found in the database. //If they are identical or blank then they have not been overwritten. //This will need to be taken into account when reporting since it is possible to override one grade column but not the other. i.e. A->B but number stays at 4. float parsed = 0; if (!float.TryParse(textGradeNumberOverride.Text, out parsed)) { MsgBox.Show(this, "The override for Overall Grade Number is not a valid number. Please input a valid number to save the evaluation."); return; } _evalCur.OverallGradeNumber = parsed; } for (int i = 0; i < _listEvalCrits.Count; i++) { _listEvalCrits[i].Notes = gridCriterion.ListGridRows[i].Cells[4].Text; //Cell 4 is the notes column EvaluationCriterions.Update(_listEvalCrits[i]); } _evalCur.DateEval = DateTime.Parse(textDate.Text); _evalCur.StudentNum = _provStudent.ProvNum; _evalCur.OverallGradeShowing = textGradeShowing.Text; _evalCur.OverallGradeNumber = PIn.Float(textGradeNumber.Text); if (!String.IsNullOrWhiteSpace(textGradeShowingOverride.Text)) { _evalCur.OverallGradeShowing = textGradeShowingOverride.Text; } Evaluations.Update(_evalCur); DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } Supp.Category = DefC.Short[(int)DefCat.SupplyCats][comboCategory.SelectedIndex].DefNum; Supp.CatalogNumber = textCatalogNumber.Text; Supp.Descript = textDescript.Text; Supp.LevelDesired = PIn.Float(textLevelDesired.Text); Supp.Price = PIn.Double(textPrice.Text); Supp.IsHidden = checkIsHidden.Checked; if (Supp.IsHidden != isHiddenInitialVal) { if (Supp.IsHidden) { Supp.ItemOrder = 0; } else { Supp.ItemOrder = Supplies.GetLastItemOrder(Supp.SupplierNum, Supp.Category) + 1; } } if (Supp.IsNew) { Supplies.Insert(Supp); } else { Supplies.Update(Supp); } if (Supp.IsHidden != isHiddenInitialVal || Supp.Category != categoryInitialVal) { List <Supply> listSupply = Supplies.CreateObjects(false, Supp.SupplierNum, ""); Supplies.CleanupItemOrders(listSupply); } DialogResult = DialogResult.OK; }
///<summary>This runs when first opening the program. If MySql is not at 5.5 or higher, it reminds the user, but does not force them to upgrade.</summary> public static void MySqlVersion55Remind() { if (DataConnection.DBtype != DatabaseType.MySql) { return; } string thisVersion = MiscData.GetMySqlVersion(); float floatVersion = PIn.Float(thisVersion.Substring(0, 3)); //doing it this way will be needed later to handle two digit version numbers. //We may then combine them into a single float, remembering to left pad single digit minor versions. //int majVer=int.Parse(thisVersion.Split(',','.')[0]); //int minVer=int.Parse(thisVersion.Split(',','.')[1]); //if((majVer<5 || (majVer=5 && minVer<5)) && !Programs.IsEnabled(ProgramName.eClinicalWorks)){//Do not show msg if MySQL version is 5.5 or greater or eCW is enabled if (floatVersion < 5.5f && !Programs.IsEnabled(ProgramName.eClinicalWorks)) //Do not show msg if MySQL version is 5.5 or greater or eCW is enabled { MsgBox.Show("Prefs", "You should upgrade to MySQL 5.5 using the installer posted on our website. It's not urgent, but until you upgrade, you are likely to get a few errors each day which will require restarting the MySQL service."); } }
private void butOK_Click(object sender, EventArgs e) { if (textLevelDesired.errorProvider1.GetError(textLevelDesired) != "" || textPrice.errorProvider1.GetError(textPrice) != "" || textOrderQty.errorProvider1.GetError(textOrderQty) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textDescript.Text == "") { MsgBox.Show(this, "Please enter a description."); return; } SupplyCur.Category = comboCategory.GetSelectedDefNum(); SupplyCur.CatalogNumber = textCatalogNumber.Text; SupplyCur.Descript = textDescript.Text; SupplyCur.LevelDesired = PIn.Float(textLevelDesired.Text); SupplyCur.OrderQty = PIn.Int(textOrderQty.Text); SupplyCur.Price = PIn.Double(textPrice.Text); //the logic below handles some of the basics. This is supplemented in some cases by the automatic order fixing. if (!SupplyCur.IsHidden && checkIsHidden.Checked) //hiding { SupplyCur.ItemOrder = 0; //not perfect. Hidden get intermingled with the first item. } if (SupplyCur.IsHidden && !checkIsHidden.Checked) //unhiding { SupplyCur.ItemOrder = 0; //keeps it at top of list } SupplyCur.IsHidden = checkIsHidden.Checked; if (SupplyCur.IsNew) { SupplyCur.SupplyNum = Supplies.Insert(SupplyCur); } else { Supplies.Update(SupplyCur); } DialogResult = DialogResult.OK; }
private void textHeight_KeyUp(object sender, KeyEventArgs e) { if (!checkRatio.Checked) { return; } if (pictureBox.Image == null) { return; } float h; try{ h = PIn.Float(textHeight.Text); } catch { return; } float imgWtoH = ((float)pictureBox.Image.Width) / ((float)pictureBox.Image.Height); int newW = (int)(h * imgWtoH); textWidth.Text = newW.ToString(); }
private void butOK_Click(object sender, EventArgs e) { if (textDateExpiration.errorProvider1.GetError(textDateExpiration) != "") { MessageBox.Show(Lan.g(this, "Please fix data entry errors first.")); return; } VaccineCompletionStatus vaccineCompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex; if (comboVaccine.SelectedIndex == -1 && vaccineCompletionStatus != VaccineCompletionStatus.NotAdministered) { //When the vaccine is not administered, the CVX code is automatically assumed to be 998 and there is no manufacturer. Therefore, no vaccine def is needed. MessageBox.Show(this, "Please select a vaccine."); return; } if (vaccineCompletionStatus == VaccineCompletionStatus.NotAdministered) { if (textNote.Text == "") { MessageBox.Show(this, "Please enter documentation in the note."); return; } VaccinePatCur.VaccineDefNum = 0; //Written for clarity } else { VaccinePatCur.VaccineDefNum = _listVaccineDefs[comboVaccine.SelectedIndex].VaccineDefNum; } try { VaccinePatCur.DateTimeStart = PIn.DateT(textDateTimeStart.Text); VaccinePatCur.DateTimeEnd = PIn.DateT(textDateTimeStop.Text); } catch { MessageBox.Show(this, "Please enter start and end times in format DD/MM/YYYY HH:mm AM/PM"); } if (textAmount.Text == "") { VaccinePatCur.AdministeredAmt = 0; } else { try { VaccinePatCur.AdministeredAmt = PIn.Float(textAmount.Text); } catch { MessageBox.Show(this, "Please enter a valid amount."); } } if (comboUnits.SelectedIndex == 0) //'none' { VaccinePatCur.DrugUnitNum = 0; } else { VaccinePatCur.DrugUnitNum = _listDrugUnits[comboUnits.SelectedIndex - 1].DrugUnitNum; } VaccinePatCur.LotNumber = textLotNum.Text; VaccinePatCur.DateExpire = PIn.Date(textDateExpiration.Text); VaccinePatCur.RefusalReason = (VaccineRefusalReason)listRefusalReason.SelectedIndex; VaccinePatCur.CompletionStatus = (VaccineCompletionStatus)listCompletionStatus.SelectedIndex; VaccinePatCur.Note = textNote.Text; VaccinePatCur.FilledCity = textFilledCity.Text; VaccinePatCur.FilledST = textFilledSt.Text; //VaccinePatCur.UserNum;//Was set when loading and cannot be edited by the user. VaccinePatCur.ProvNumOrdering = _provNumSelectedOrdering; VaccinePatCur.ProvNumAdminister = _provNumSelectedAdministering; VaccinePatCur.AdministrationRoute = (VaccineAdministrationRoute)comboAdministrationRoute.SelectedIndex; VaccinePatCur.AdministrationSite = (VaccineAdministrationSite)comboAdministrationSite.SelectedIndex; VaccinePatCur.AdministrationNoteCode = (VaccineAdministrationNote)listAdministrationNote.SelectedIndex; VaccinePatCur.ActionCode = (VaccineAction)listAction.SelectedIndex; if (IsNew) { VaccinePats.Insert(VaccinePatCur); } else { VaccinePats.Update(VaccinePatCur); } //We must delete then update/insert the observations after we insert the vaccinepat record, in case the vaccinepat is new. VaccineObses.DeleteForVaccinePat(VaccinePatCur.VaccinePatNum); for (int i = 0; i < _listVaccineObservations.Count; i++) { VaccineObs vaccineObs = _listVaccineObservations[i]; vaccineObs.VaccinePatNum = VaccinePatCur.VaccinePatNum; VaccineObses.Insert(vaccineObs); } //Update the vaccine observation group ids, now that the vaccine observation records have been inserted. for (int i = 0; i < _listVaccineObservations.Count; i++) { VaccineObs vaccineObs = _listVaccineObservations[i]; vaccineObs.VaccineObsNumGroup = _listVaccineObservationGroups[i].VaccineObsNum; VaccineObses.Update(vaccineObs); } DialogResult = DialogResult.OK; }
private void comboFontSize_SelectionChangeCommitted(object sender, EventArgs e) { if (_textFocused.ReadOnly) { return; } try { _textFocused.SelectionFont = new Font((string)comboFontType.SelectedItem, PIn.Float(comboFontSize.SelectedItem.ToString()), _textFocused.SelectionFont.Style); UpdateSelectedFontStyles(_textFocused); _textFocused.Focus(); } catch { } }
private void comboFontSize_SelectionChangeCommitted(object sender, EventArgs e) { try { textDescription.SelectionFont = new Font((string)comboFontType.SelectedItem, PIn.Float(comboFontSize.SelectedItem.ToString()), textDescription.SelectionFont.Style); UpdateSelectedFontStyles(); textDescription.Focus(); } catch { } }