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 gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { SelectedGridItems.Clear(); foreach (int index in gridMain.SelectedIndices) { SelectedGridItems.Add(ListSupply[index].SupplyNum); } if (IsSelectMode) { SelectedSupply = Supplies.GetSupply((long)gridMain.Rows[e.Row].Tag); ListSelectedSupplies.Clear(); //just in case for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { ListSelectedSupplies.Add(ListSupply[gridMain.SelectedIndices[i]]); } DialogResult = DialogResult.OK; return; } //Supply supplyCached=Supplies.GetSupply((long)gridMain.Rows[e.Row].Tag); FormSupplyEdit FormS = new FormSupplyEdit(); FormS.Supp = Supplies.GetSupply((long)gridMain.Rows[e.Row].Tag); //works with sorting FormS.ListSupplier = ListSupplier; FormS.ShowDialog(); if (FormS.DialogResult != DialogResult.OK) { return; } ListSupplyAll = Supplies.GetAll(); int scroll = gridMain.ScrollValue; FillGrid(); gridMain.ScrollValue = scroll; }
private void FormSupplyOrderItemEdit_Load(object sender, EventArgs e) { Supp = Supplies.GetSupply(ItemCur.SupplyNum); textSupplier.Text = Suppliers.GetName(ListSupplier, Supp.SupplierNum); textCategory.Text = DefC.GetName(DefCat.SupplyCats, Supp.Category); textCatalogNumber.Text = Supp.CatalogNumber; textDescript.Text = Supp.Descript; textQty.Text = ItemCur.Qty.ToString(); textPrice.Text = ItemCur.Price.ToString("n"); }
private void butOK_Click(object sender, EventArgs e) { if (IsSelectMode) { if (gridMain.SelectedIndices.Length < 1) { MsgBox.Show(this, "Please select a supply from the list first."); return; } ListSelectedSupplies.Clear(); //just in case for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { ListSelectedSupplies.Add(ListSupply[gridMain.SelectedIndices[i]]); } SelectedSupply = Supplies.GetSupply((long)gridMain.Rows[gridMain.SelectedIndices[0]].Tag); DialogResult = DialogResult.OK; } //saveChangesToDBHelper();//All changes should already be saved to the database DialogResult = DialogResult.OK; }