private void butOK_Click(object sender,EventArgs e) { AdjustNumCur = new AnesthMedsInventoryAdj(); if(textAnesthMedName.Text==""){ MsgBox.Show(this,"Please enter a name."); return; } //write inventory data to anesthetic meds inventory db Med.AnesthMedName=textAnesthMedName.Text; Med.AnesthHowSupplied=textAnesthHowSupplied.Text; Med.DEASchedule = comboDEASchedule.Text; if (Med.IsNew != true) { Med.QtyOnHand = textQtyOnHand.Text; } if (Med.QtyOnHand == null){ Med.QtyOnHand = "0"; } if (Med.DEASchedule == null){ Med.DEASchedule = ""; } //write adjustment data to anesthetic meds inventory adjustment db Userod curUser = Security.CurUser; AdjustNumCur.AnestheticMedNum = Convert.ToInt32(Med.AnestheticMedNum); if (textQtyAdj.Text != "") { Regex regex = new Regex("^-\\d{1,6}?$|^\\d{1,6}?$"); if (!(regex.IsMatch(textQtyAdj.Text)) && textQtyAdj.Text != "") { MessageBox.Show("The Quantity field should be a 1-6 digit integer."); textQtyAdj.Focus(); return; } else AdjustNumCur.QtyAdj = Convert.ToDouble(textQtyAdj.Text); } AdjustNumCur.UserNum = Convert.ToInt32(curUser.UserNum); if (textNotes.Text != "") { AdjustNumCur.Notes = textNotes.Text; } AdjustNumCur.TimeStamp = DateTime.Now; AnesthMedInvAdjs.Insert(AdjustNumCur); //write inventory adjustment back to table anesthmedsinventory double newQty = Convert.ToDouble(Med.QtyOnHand) + Convert.ToDouble(AdjustNumCur.QtyAdj); Med.QtyOnHand = newQty.ToString(); AnesthMeds.WriteObject(Med); DialogResult=DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { AdjustNumCur = new AnesthMedsInventoryAdj(); if (textAnesthMedName.Text == "") { MsgBox.Show(this, "Please enter a name."); return; } //write inventory data to anesthetic meds inventory db Med.AnesthMedName = textAnesthMedName.Text; Med.AnesthHowSupplied = textAnesthHowSupplied.Text; Med.DEASchedule = comboDEASchedule.Text; if (Med.IsNew != true) { Med.QtyOnHand = textQtyOnHand.Text; } if (Med.QtyOnHand == null) { Med.QtyOnHand = "0"; } if (Med.DEASchedule == null) { Med.DEASchedule = ""; } //write adjustment data to anesthetic meds inventory adjustment db Userod curUser = Security.CurUser; AdjustNumCur.AnestheticMedNum = Convert.ToInt32(Med.AnestheticMedNum); if (textQtyAdj.Text != "") { Regex regex = new Regex("^-\\d{1,6}?$|^\\d{1,6}?$"); if (!(regex.IsMatch(textQtyAdj.Text)) && textQtyAdj.Text != "") { MessageBox.Show("The Quantity field should be a 1-6 digit integer."); textQtyAdj.Focus(); return; } else { AdjustNumCur.QtyAdj = Convert.ToDouble(textQtyAdj.Text); } } AdjustNumCur.UserNum = Convert.ToInt32(curUser.UserNum); if (textNotes.Text != "") { AdjustNumCur.Notes = textNotes.Text; } AdjustNumCur.TimeStamp = DateTime.Now; AnesthMedInvAdjs.Insert(AdjustNumCur); //write inventory adjustment back to table anesthmedsinventory double newQty = Convert.ToDouble(Med.QtyOnHand) + Convert.ToDouble(AdjustNumCur.QtyAdj); Med.QtyOnHand = newQty.ToString(); AnesthMeds.WriteObject(Med); DialogResult = DialogResult.OK; }