public ProductionStandartForm(ProductionStandart editEntity, ProductStandartFilter filter) : this(filter) { this.editEntity = editEntity; nameTbx.Text = editEntity.operation_name; standartTbx.Text = editEntity.standart + ""; priceTbx.Text = editEntity.operation_price + ""; }
public ProductionStandartForm(ProductStandartFilter filter) { this.filter = filter; InitializeComponent(); standartTbx.KeyPress += TextBoxHandles.onlyIntNumbersKeyPress; priceTbx.KeyPress += TextBoxHandles.onlyPositiveDoubleNumbersKeyPress; }
private void departCbx_SelectedIndexChanged(object sender, EventArgs e) { if (departCbx.SelectedItem == null || productCbx.SelectedItem == null) { return; } filter = new ProductStandartFilter(((Department)departCbx.SelectedItem).id, ((Product)productCbx.SelectedItem).id); refreshDataGrid(); }
public ProductsSheetForm(ProductSheetFilter filter) : this() { this.filter = filter; for (int i = 0; i < departCbx.Items.Count; i++) { if (((Department)departCbx.Items[i]).id == filter.department_id) { departCbx.SelectedItem = departCbx.Items[i]; break; } } datePck.Value = filter.date; List <ProductsSheet> list = productSheetSet.getListSheetsFiltered(filter); for (int i = 0; i < list.Count; i++) { operations_table.Rows.Add(); for (int j = 0; j < ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["employee"])).Items.Count; j++) { if (((Employee)((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["employee"])).Items[j]).id == list[i].employee_id) { ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["employee"])).Value = ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["employee"])).Items[j]; break; } } for (int j = 0; j < ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["product"])).Items.Count; j++) { if (((Product)((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["product"])).Items[j]).id == list[i].product_id) { ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["product"])).Value = ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["product"])).Items[j]; break; } } ProductStandartFilter filterRow = new ProductStandartFilter(((Department)departCbx.SelectedItem).id, ((Product)(operations_table.Rows[i].Cells["product"].Value)).id); ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).DataSource = productStandartSet.getListStandartsFiltered(filterRow); ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).ValueMember = "thisObject"; ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).DisplayMember = "thisObjectToString"; for (int j = 0; j < ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).Items.Count; j++) { if (((ProductionStandart)((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).Items[j]).id == list[i].operation_id) { ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).Value = ((DataGridViewComboBoxCell)(operations_table.Rows[i].Cells["operation"])).Items[j]; break; } } operations_table["count", i].Value = list[i].operation_count; } }
public List <ProductionStandart> getListStandartsFiltered(ProductStandartFilter filter) { DataTable dt = ConnectionClass.getResult("SELECT id,department_id,product_id,operation_name,standart,operation_price from production_standart where department_id = " + filter.department_id + " and product_id = " + filter.product_id); List <ProductionStandart> list = new List <ProductionStandart>(); for (int i = 0; i < dt.Rows.Count; i++) { list.Add(new ProductionStandart(dt.Rows[i])); } return(list); }
private void operations_table_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (operations_table.CurrentCell.ColumnIndex == 1) { var currentcell = operations_table.CurrentCellAddress; ProductStandartFilter filter = new ProductStandartFilter(((Department)departCbx.SelectedItem).id, ((Product)(operations_table.Rows[currentcell.Y].Cells["product"].Value)).id); ((DataGridViewComboBoxCell)(operations_table.Rows[currentcell.Y].Cells["operation"])).DataSource = productStandartSet.getListStandartsFiltered(filter); ((DataGridViewComboBoxCell)(operations_table.Rows[currentcell.Y].Cells["operation"])).ValueMember = "thisObject"; ((DataGridViewComboBoxCell)(operations_table.Rows[currentcell.Y].Cells["operation"])).DisplayMember = "thisObjectToString"; } }
public ProductStandartsForm(ProductStandartFilter filter) : this() { this.filter = filter; for (int i = 0; i < departCbx.Items.Count; i++) { if (((Department)departCbx.Items[i]).id == filter.department_id) { departCbx.SelectedItem = departCbx.Items[i]; break; } } for (int i = 0; i < productCbx.Items.Count; i++) { if (((Product)productCbx.Items[i]).id == filter.product_id) { productCbx.SelectedItem = productCbx.Items[i]; break; } } refreshDataGrid(); }
public void deleteStandartsFiltered(ProductStandartFilter filter) { ConnectionClass.executeQuery("delete from production_standart where department_id = " + filter.department_id + " and product_id = " + filter.product_id); }