private void BtnDataG_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtPrice.Text) || cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 || cboFamily.SelectedIndex == -1 || cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == 1) { /* * btnDataG.Enabled = true; * txtName.Enabled = false; * txtPrice.Enabled = false; * * cboCategory.Enabled = false; * cboFamily.Enabled = false; * cboBrand.Enabled = false; * * cboSupplier.Enabled = false; * cboMoney.Enabled = false; */ AlmacenDisecWS.category c = (AlmacenDisecWS.category)cboCategory.SelectedValue; AlmacenDisecWS.family f = (AlmacenDisecWS.family)cboFamily.SelectedValue; AlmacenDisecWS.brand b = (AlmacenDisecWS.brand)cboBrand.SelectedValue; AlmacenDisecWS.supplier sup = (AlmacenDisecWS.supplier)cboSupplier.SelectedValue; AlmacenDisecWS.storehouse store = (AlmacenDisecWS.storehouse)cboStorehouse.SelectedValue; string name = txtName.Text; double price = double.Parse(txtPrice.Text); AlmacenDisecWS.tool t = new AlmacenDisecWS.tool(); t.brand.brand_id = b.brand_id; t.name_item = name; t.price = price; t.family.id_family = f.id_family; t.suppliers.id_supplier = sup.id_supplier; t.stock.storehouse.id_storehouse = store.id_storehouse; int a = 0; if (cboMoney.Text == "SOLES") { a = 1; } else { a = 2; } string waytopay = cboWayofPay.Text; int result = serviceDA.insertTool(t, a, waytopay); } else { frmMessageBoxNew frm = new frmMessageBoxNew(); frm.ShowDialog(); } } }
private void BtnDataG_Click(object sender, EventArgs e) { btnDataG.Enabled = false; if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtMinQuantity.Text) || String.IsNullOrEmpty(txtPrice.Text) || cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 || cboFamily.SelectedIndex == -1 || cboUnit.SelectedIndex == -1 || cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == 1) { flag = 2; btnDataG.Enabled = false; txtName.Enabled = false; txtMinQuantity.Enabled = false; txtPrice.Enabled = false; cboCategory.Enabled = false; cboFamily.Enabled = false; cboBrand.Enabled = false; cboUnit.Enabled = false; cboSupplier.Enabled = false; cboMoney.Enabled = false; //Si quieren guardar los datos generales antes aqui va el codigo } else { frmMessageBoxNew frm = new frmMessageBoxNew(); frm.ShowDialog(); } } }
private void BtnSave_Click(object sender, EventArgs e) { { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtMinQuantity.Text) || String.IsNullOrEmpty(txtSerie.Text) || String.IsNullOrEmpty(txtPrice.Text) || cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 || cboFamily.SelectedIndex == -1 || cboUnit.SelectedIndex == -1 || cboStatus.SelectedIndex == -1 || cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == 2) { if (String.IsNullOrEmpty(txtCode.Text)) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; //Category cat = new category(name,1); //Se llama al insert frmMessageBoxAdd frm2 = new frmMessageBoxAdd(); if (frm2.ShowDialog() == DialogResult.OK) { int id_c = 0; AlmacenDisecWS.materialDetail detail = new AlmacenDisecWS.materialDetail(); AlmacenDisecWS.material m = new AlmacenDisecWS.material(); AlmacenDisecWS.category c = new AlmacenDisecWS.category(); detail.measure = (AlmacenDisecWS.measureUnit)cboUnit.SelectedItem; detail.serie_material = txtSerie.Text; m.min_quantity = Int32.Parse(txtMinQuantity.Text); m.brand = (AlmacenDisecWS.brand)cboUnit.SelectedItem; m.family = (AlmacenDisecWS.family)cboFamily.SelectedItem; c = (AlmacenDisecWS.category)cboCategory.SelectedItem; /// m.supplier = (AlmacenDisecWS.supplier)cbosupplier.SelectedItem m.price = Double.Parse(txtPrice.Text); m.name_item = txtName.Text; // m.material_details. = detail; if (cboMoney.SelectedItem.ToString() == "SOLES") { id_c = 1; } else { if (cboMoney.SelectedItem.ToString() == "DOLARES") { id_c = 2; } } m.family.category.category_id = c.category_id; m.family.category.category_name = c.category_name; // int result = serviceDA.insertMaterial(m,id_c) ; txtCode.Clear(); txtSerie.Clear(); cboStatus.SelectedIndex = -1; } else { reiniciar(); } } } } else { if (flag == 0) { if (String.IsNullOrEmpty(txtCode.Text)) { frmMessageBoxNew frm2 = new frmMessageBoxNew(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { // int id = Int32.Parse(txtId.Text); String name = txtName.Text; // Category cat = (Category)cboCategory.SelectedIndex; //Category cat = new category(name,0); //Se llama al update reiniciar(); } } } else { if (flag == 1) { frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral(); frm2.ShowDialog(); } } } } } }
private void BtnSave_Click(object sender, EventArgs e) { { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtSerie.Text) || String.IsNullOrEmpty(txtPrice.Text) || cboBrand.SelectedIndex == -1 || cboCategory.SelectedIndex == -1 || cboFamily.SelectedIndex == -1 || cboSupplier.SelectedIndex == -1 || cboMoney.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == 2) { if (String.IsNullOrEmpty(txtCode.Text)) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; //Category cat = new category(name,1); //Se llama al insert frmMessageBoxAdd frm2 = new frmMessageBoxAdd(); if (frm2.ShowDialog() == DialogResult.OK) { txtCode.Clear(); txtSerie.Clear(); //cboStatus.SelectedIndex = -1; } else { reiniciar(); } } } } else { if (flag == 0) { if (String.IsNullOrEmpty(txtCode.Text)) { frmMessageBoxNew frm2 = new frmMessageBoxNew(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { // int id = Int32.Parse(txtId.Text); String name = txtName.Text; // Category cat = (Category)cboCategory.SelectedIndex; //Category cat = new category(name,0); //Se llama al update reiniciar(); } } } else { if (flag == 1) { frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral(); frm2.ShowDialog(); } } } } } }