private void DeleteSB_Click(object sender, EventArgs e) { WareUnitsLogic units = new WareUnitsLogic(manager); units.Delete(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); manager.Save(); Fill(); }
private void Fill() { WareUnitsLogic units = new WareUnitsLogic(manager); DataGV.AutoGenerateColumns = false; DataGV.DataSource = units.GetAll(); DataGV.Update(); }
private void FillUnits() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; WareUnitsLogic units = new WareUnitsLogic(manager); List <ItemIntValue> items2 = new List <ItemIntValue>(); items2.Clear(); items2.Add(none); foreach (var a in units.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items2.Add(i); } UnitsCB.DataSource = items2; UnitsCB.ValueMember = "ID"; UnitsCB.DisplayMember = "Name"; UnitsCB.Update(); if (UnitsCB.Items.Count > 1) { UnitsCB.SelectedIndex = 1; } }
//public string WareName //{ // get // { // string result = null; // if (NameTB.Text.Length > 0) // { // result = NameTB.Text; // } // return result; // } //} public void Fill() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; List <ItemIntValue> items0 = new List <ItemIntValue>(); WareCategoriesLogic categories = new WareCategoriesLogic(manager); items0.Clear(); //items0.Add(none); foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items0.Add(i); } CategoriesCB.DataSource = items0; CategoriesCB.ValueMember = "ID"; CategoriesCB.DisplayMember = "Name"; CategoriesCB.Update(); WareManufacturersLogic manufacturers = new WareManufacturersLogic(manager); List <ItemIntValue> items1 = new List <ItemIntValue>(); items1.Clear(); items1.Add(none); foreach (var a in manufacturers.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items1.Add(i); } //ManufacturersCB.DataSource = manufacturers.GetAll(); ManufacturersCB.DataSource = items1; ManufacturersCB.ValueMember = "ID"; ManufacturersCB.DisplayMember = "Name"; ManufacturersCB.Update(); WareUnitsLogic units = new WareUnitsLogic(manager); List <ItemIntValue> items2 = new List <ItemIntValue>(); items2.Clear(); items2.Add(none); foreach (var a in units.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items2.Add(i); } UnitsCB.DataSource = items2; UnitsCB.ValueMember = "ID"; UnitsCB.DisplayMember = "Name"; UnitsCB.Update(); }
private void Fill() { WareUnitsLogic units = new WareUnitsLogic(manager); if (mode == "edit") { WareUnit unit = units.Get(Convert.ToInt32(id)); if (unit != null) { NameTB.Text = unit.Name; } } }
private void SaveBt_Click(object sender, EventArgs e) { WareUnitsLogic units = new WareUnitsLogic(manager); if (mode == "new") { units.Create(NameTB.Text); } if (mode == "edit") { units.Update(Convert.ToInt32(id), NameTB.Text); } manager.Save(); this.Close(); }
private void Fill() { WareUnitsLogic units = new WareUnitsLogic(manager); WaresLogic wares = new WaresLogic(manager); StaffStructureObjectsLogic objects = new StaffStructureObjectsLogic(manager); if (DocumentDetail != null) { WareLUE.EditValue = DocumentDetail.WareID; UnitQuantityTB.EditValue = DocumentDetail.UnitQuantity; SecondaryUnitQuantityTB.EditValue = DocumentDetail.SecondaryUnitQuantity; SalePriceForUnitTB.EditValue = DocumentDetail.PriceForUnit; DiscountForUnitTB.EditValue = DocumentDetail.DiscountForUnit; EndSalePriceForUnitTB.Text = Convert.ToDecimal(DocumentDetail.EndPriceForUnit).ToString("n2"); SalePriceTB.Text = Convert.ToDecimal(DocumentDetail.EndPrice).ToString("n2"); } }
//public string WareName //{ // get // { // string result = null; // if (NameTB.Text.Length > 0) // { // result = NameTB.Text; // } // return result; // } //} public void Fill() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; List<ItemIntValue> items0 = new List<ItemIntValue>(); WareCategoriesLogic categories = new WareCategoriesLogic(manager); items0.Clear(); //items0.Add(none); foreach (var a in categories.GetCategoriesHierarchy().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items0.Add(i); } CategoriesCB.DataSource = items0; CategoriesCB.ValueMember = "ID"; CategoriesCB.DisplayMember = "Name"; CategoriesCB.Update(); WareManufacturersLogic manufacturers = new WareManufacturersLogic(manager); List<ItemIntValue> items1 = new List<ItemIntValue>(); items1.Clear(); items1.Add(none); foreach (var a in manufacturers.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items1.Add(i); } //ManufacturersCB.DataSource = manufacturers.GetAll(); ManufacturersCB.DataSource = items1; ManufacturersCB.ValueMember = "ID"; ManufacturersCB.DisplayMember = "Name"; ManufacturersCB.Update(); WareUnitsLogic units = new WareUnitsLogic(manager); List<ItemIntValue> items2 = new List<ItemIntValue>(); items2.Clear(); items2.Add(none); foreach (var a in units.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items2.Add(i); } UnitsCB.DataSource = items2; UnitsCB.ValueMember = "ID"; UnitsCB.DisplayMember = "Name"; UnitsCB.Update(); }
private void FillUnits() { ItemIntValue none = new ItemIntValue(); none.ID = -1; none.Name = " - не вибрано - "; WareUnitsLogic units = new WareUnitsLogic(manager); List<ItemIntValue> items2 = new List<ItemIntValue>(); items2.Clear(); items2.Add(none); foreach (var a in units.GetAll().OrderBy(a => a.Name)) { ItemIntValue i = new ItemIntValue(); i.ID = a.ID; i.Name = a.Name; items2.Add(i); } UnitsCB.DataSource = items2; UnitsCB.ValueMember = "ID"; UnitsCB.DisplayMember = "Name"; UnitsCB.Update(); if(UnitsCB.Items.Count > 1) UnitsCB.SelectedIndex = 1; }