private void textEdit1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13 && AddMaterialBtn.Enabled && !String.IsNullOrEmpty(BarCodeEdit.Text)) { var BarCodeText = BarCodeEdit.Text.Split('+'); string kod = BarCodeText[0]; var item = _db.Materials.Where(w => w.BarCode == kod).Select(s => s.MatId).FirstOrDefault(); using (var frm = new frmOutMatList(_db, OutDateEdit.DateTime, wb.OnDate, item, wb.KaId.Value)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var mat_row = frm.bandedGridView1.GetFocusedRow() as GetPosOutView; if (mat_row != null) { using (var df = new frmWBReturnDetIn(_db, null, wb, (int?)WHComboBox.EditValue, OutDateEdit.DateTime) { pos_out_list = frm.pos_out_list, outPosId = mat_row.PosId }) { if (df.ShowDialog() == System.Windows.Forms.DialogResult.OK) { RefreshDet(); } } } } } BarCodeEdit.Text = ""; } }
private void simpleButton2_Click(object sender, EventArgs e) { var row = (GetPosOutView)MatComboBox.GetSelectedDataRow(); int matId = row != null ? row.MatId : 0; using (var frm = new frmOutMatList(_db, _start_date, _wb.OnDate, matId, _wb.KaId.Value)) { if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { pos_out_list = frm.pos_out_list; MatComboBox.Properties.DataSource = frm.pos_out_list; if (pos_out_list != null) { var mat_row = frm.bandedGridView1.GetFocusedRow() as GetPosOutView; MatComboBox.EditValue = mat_row.PosId; } } } }