private void AddComponentBt_Click(object sender, EventArgs e) { int wareId = Convert.ToInt32(id); int componentWareId = Convert.ToInt32(wareSelectorUC1.WareID); decimal unitQuantity = 0; decimal secondaryUnitQuantity = 0; unitQuantity = Convert.ToDecimal(UnitQuantityNUD.Value); //if (UnitsRG.Properties.Items.Count == 1) //{ // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); //} //if (UnitsRG.Properties.Items.Count == 2) //{ // if(UnitsRG.SelectedIndex == 0) // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); // if (UnitsRG.SelectedIndex == 1) // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); //} WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager); wareComponentsLogic.Create(wareId, componentWareId, unitQuantity, secondaryUnitQuantity); manager.Save(); FillComponentWares(); }
private void AddComponentBt_Click(object sender, EventArgs e) { int wareId = Convert.ToInt32(id); int componentWareId = Convert.ToInt32(WareLUE.EditValue); decimal unitQuantity = 0; decimal secondaryUnitQuantity = 0; if(UnitQuantityTB.EditValue.ToString().Trim().Length>0) unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); //if (UnitsRG.Properties.Items.Count == 1) //{ // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); //} //if (UnitsRG.Properties.Items.Count == 2) //{ // if(UnitsRG.SelectedIndex == 0) // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); // if (UnitsRG.SelectedIndex == 1) // unitQuantity = Convert.ToDecimal(UnitQuantityTB.EditValue); //} WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager); wareComponentsLogic.Create(wareId, componentWareId, unitQuantity, secondaryUnitQuantity); manager.Save(); FillComponentWares(); }
private void DataGV_CellClick(object sender, DataGridViewCellEventArgs e) { if (DataGV.SelectedRows[0].Cells[e.ColumnIndex].OwningColumn.Name == "PricesC") { Wares.Price.PricesList form = new Wares.Price.PricesList(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); form.ShowDialog(); } if (DataGV.SelectedRows[0].Cells[e.ColumnIndex].OwningColumn.Name == "ComponentsC") { Wares.Ware.WareComponentDataSimple form = new Wares.Ware.WareComponentDataSimple("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); form.ShowDialog(); } if (DataGV.SelectedRows.Count > 0) { ComponentsTV.Nodes.Clear(); int wareId = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value); WareComponentsLogic componentsLogic = new WareComponentsLogic(manager); List <WareComponent> components = componentsLogic.GetAllRecursively(wareId, null); foreach (WareComponent component in components) { ComponentsTV.Nodes.Add(component.WareID.ToString(), component.Ware1.Name + " " + component.UnitQuantity.ToString() + component.Ware1.WareUnit.Name); } } }
private void DeleteComponentBt_Click(object sender, EventArgs e) { if (WareComponentsGV.SelectedRows.Count > 0) { int wareComponentId = Convert.ToInt32(WareComponentsGV.SelectedRows[0].Cells["WareComponentID"].Value); WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager); wareComponentsLogic.Delete(wareComponentId); manager.Save(); manager.CloseContext(); manager = new ContextManager(); FillComponentWares(); } }
private void FillComponentWares() { ContextManager manager0 = new ContextManager(); WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager0); WareComponentsGV.AutoGenerateColumns = false; List <WareComponentView> components = wareComponentsLogic.GetAllView(Convert.ToInt32(id)); WareComponentsGV.ClearSelection(); //WareComponentsGV.Rows.Clear(); WareComponentsGV.DataSource = null; WareComponentsGV.Rows.Clear(); SortableBindingList <WareComponentView> view = new SortableBindingList <WareComponentView>(components); WareComponentsGV.DataSource = view; }
private void FillComponentWares() { ContextManager manager0 = new ContextManager(); WareComponentsLogic wareComponentsLogic = new WareComponentsLogic(manager0); WareComponentsGV.AutoGenerateColumns = false; List<WareComponentView> components = wareComponentsLogic.GetAllView(Convert.ToInt32(id)); WareComponentsGV.ClearSelection(); //WareComponentsGV.Rows.Clear(); WareComponentsGV.DataSource = null; WareComponentsGV.Rows.Clear(); SortableBindingList<WareComponentView> view = new SortableBindingList<WareComponentView>(components); WareComponentsGV.DataSource = view; }
private void DataGV_CellClick(object sender, DataGridViewCellEventArgs e) { if (DataGV.SelectedRows[0].Cells[e.ColumnIndex].OwningColumn.Name == "PricesC") { Wares.Price.PricesList form = new Wares.Price.PricesList(Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); form.ShowDialog(); } if (DataGV.SelectedRows[0].Cells[e.ColumnIndex].OwningColumn.Name == "ComponentsC") { Wares.Ware.WareComponentDataSimple form = new Wares.Ware.WareComponentDataSimple("edit", Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value)); form.ShowDialog(); } if (DataGV.SelectedRows.Count > 0) { ComponentsTV.Nodes.Clear(); int wareId = Convert.ToInt32(DataGV.SelectedRows[0].Cells["ID"].Value); WareComponentsLogic componentsLogic = new WareComponentsLogic(manager); List<WareComponent> components = componentsLogic.GetAllRecursively(wareId, null); foreach (WareComponent component in components) { ComponentsTV.Nodes.Add(component.WareID.ToString(), component.Ware1.Name + " " + component.UnitQuantity.ToString() + component.Ware1.WareUnit.Name); } } }