private void FillGrid() { AnesthMedSuppliers.RefreshCache(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); textAlign = HorizontalAlignment.Center; ODGridColumn col = new ODGridColumn(Lan.g(this, "SupplierName"), 200, textAlign); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Phone"), 100, textAlign); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "Fax"), 100, textAlign); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "City"), 140, textAlign); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "State"), 160, textAlign); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g(this, "WebSite"), 140, textAlign); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < AnesthMedSupplierC.Listt.Count; i++) { row = new ODGridRow(); row.Cells.Add(AnesthMedSupplierC.Listt[i].SupplierName); row.Cells.Add(AnesthMedSupplierC.Listt[i].Phone); row.Cells.Add(AnesthMedSupplierC.Listt[i].Fax); row.Cells.Add(AnesthMedSupplierC.Listt[i].City); row.Cells.Add(AnesthMedSupplierC.Listt[i].State); row.Cells.Add(AnesthMedSupplierC.Listt[i].WebSite); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { FormAnesthMedSuppliersEdit FormME = new FormAnesthMedSuppliersEdit(); FormME.SupplCur = AnesthMedSupplierC.Listt[e.Row]; FormME.ShowDialog(); AnesthMedSuppliers.RefreshCache(); FillGrid(); }
private void butOK_Click(object sender, EventArgs e) { /* (textSupplierName.Text == "") * { * MessageBox.Show(Lan.g(this, "Supplier name cannot be blank.")); * return; * } * if (CultureInfo.CurrentCulture.Name == "en-US") * { * if (textPhone.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textPhone.Text) == "") * { * MessageBox.Show(Lan.g(this, "Phone number must be in a 10-digit format.")); * return; * } * if (textFax.Text != "" && TelephoneNumbers.FormatNumbersExactTen(textFax.Text) == "") * { * MessageBox.Show(Lan.g(this, "Fax number must be in a 10-digit format.")); * return; * } * }*/ SupplCur.SupplierName = textSupplierName.Text; SupplCur.Phone = textPhone.Text; SupplCur.PhoneExt = textPhoneExt.Text; SupplCur.Fax = textFax.Text; SupplCur.Addr1 = textAddr1.Text; SupplCur.Addr2 = textAddr2.Text; SupplCur.City = textCity.Text; SupplCur.State = textState.Text; SupplCur.Zip = textZip.Text; SupplCur.Contact = textContact.Text; SupplCur.WebSite = textWebSite.Text; SupplCur.Notes = richTextNotes.Text; AnesthMedSuppliers.WriteObject(SupplCur); /*try * { * AnesthMedSuppliers.WriteObject(SupplCur); * } * catch (Exception ex) * { * MessageBox.Show(ex.Message); * return; * }*/ DialogResult = DialogResult.OK; }
private void butClose_Click(object sender, EventArgs e) { if (comboAnesthMedName.SelectedIndex == -1 || textQty.Text == "" || comboSupplierName.SelectedIndex == -1 || textInvoiceNum.Text == "") { MessageBox.Show(Lan.g(this, "All fields are mandatory.")); return; } else { Regex regex = new Regex("^\\d{1,6}?$"); if (!(regex.IsMatch(textQty.Text)) && textQty.Text != "") { MessageBox.Show(Lan.g(this, "The Quantity field should be a 1-6 digit integer.")); textQty.Focus(); return; } else { if (comboAnesthMedName.SelectedIndex != 0 && comboSupplierName.SelectedIndex != 0) { if (textInvoiceNum.Text.Trim() == "") { MessageBox.Show(Lan.g(this, "Invoice # does not accept spaces.")); textInvoiceNum.Focus(); } } } //the current QtyOnHand of a scheduled anesthetic medication double qtyOnHand = Convert.ToDouble(AnesthMeds.GetQtyOnHand(comboAnesthMedName.SelectedItem.ToString())); //records transaction into tableanesthmedsintake which tracks intake of scheduled anesthetic medications into inventory int supplierIDNum = AnesthMedSuppliers.GetSupplierIDNum(comboSupplierName.SelectedIndex); AnesthMeds.InsertMed_Intake(comboAnesthMedName.SelectedItem.ToString(), Convert.ToInt32(textQty.Text), supplierIDNum.ToString(), textInvoiceNum.Text); //updates QtyOnHand in tableanesthmedsinventory when a new order of scheduled anesthetic medications is received into inventory AnesthMeds.UpdateAMedInvAdj(comboAnesthMedName.SelectedItem.ToString(), Convert.ToDouble(textQty.Text), qtyOnHand); DialogResult = DialogResult.OK; Close(); } }