private void BtnModify_Click(object sender, EventArgs e) { frmStoreHouse frm = new frmStoreHouse(); frm.flag = false; AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.None; frm.TopLevel = false; frm.Dock = DockStyle.Fill; this.Controls.Add(frm); this.Tag = frm; frm.cboCity.Enabled = true; String name = dgvSearch.CurrentRow.Cells[1].Value.ToString(); AlmacenDisecWS.storehouse store = new AlmacenDisecWS.storehouse(); store = serviceDA.queryStorehouseByName(name); frm.txtId.Text = store.id_storehouse.ToString(); frm.txtNameStorehouse.Text = store.storehouse_name; frm.txtAddressStorehouse.Text = store.address; frm.txtPhone.Text = store.phone_number.ToString(); frm.txtId.Enabled = false; frm.cboCity.Text = dgvSearch.CurrentRow.Cells[3].Value.ToString(); frm.btnDelete.Enabled = true; btnModify.Enabled = true; frm.BringToFront(); frm.Show(); }
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 BtnSearch_Click_1(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtSearch.Text)) { /* * dgvSearch.AutoGenerateColumns = false; * dgvSearch.DataSource = serviceDA.queryAllStorehouse(); */ list.Clear(); int cont = 0; AlmacenDisecWS.storehouse[] a = new AlmacenDisecWS.storehouse[100]; a = serviceDA.queryAllStorehouse(); cont = a.Count(); for (int i = 0; i < cont; i++) { Storehouse s = new Storehouse(); s.id_storehouse = a[i].id_storehouse; s.phone_number = a[i].phone_number; s.storehouse_name = a[i].storehouse_name; s.city.id_city = a[i].city.id_city; s.city.name_city = a[i].city.name_city; s.address = a[i].address; s.storehouse_status = a[i].storehouse_status; list.Add(s); } dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = list; } else { String name = txtSearch.Text; //Insertar el codigo de busqueda por nombre } btnModify.Enabled = true; }
private void BtnSearchW_Click(object sender, EventArgs e) { if ((cboInventory.SelectedIndex == -1) || (cboInventory.SelectedIndex == -1)) { frmMessageBoxError fm = new frmMessageBoxError(); fm.ShowDialog(); } else { if (cboInventory.SelectedItem.ToString() == "Materiales") { //frmSearchInventoryMaterial fm = new frmSearchInventoryMaterial(); // fm.lblMaterial.Visible = false; // OpenFormPanel(fm); AlmacenDisecWS.storehouse s = new AlmacenDisecWS.storehouse(); s = (AlmacenDisecWS.storehouse)cboStore.SelectedItem; lblM.Visible = true; lblTool.Visible = false; dgvMaterial.Visible = true; dgvTool.Visible = false; dgvMaterial.DataSource = serviceDA.queryStockMaterialByStorehouse(s.id_storehouse); } else { if (cboInventory.SelectedItem.ToString() == "Herramientas") { // frmSearchInventoryTool fm = new frmSearchInventoryTool(); // fm.lblMaterial.Visible = false; // OpenFormPanel(fm); lblM.Visible = false; lblTool.Visible = true; dgvTool.Visible = true; dgvMaterial.Visible = false; // dgvTool.DataSource = query2 } } } }
private void BtnSave_Click(object sender, EventArgs e) { { if (String.IsNullOrEmpty(txtNameStorehouse.Text) || String.IsNullOrEmpty(txtPhone.Text) || cboCity.SelectedIndex == -1 || String.IsNullOrEmpty(txtAddressStorehouse.Text)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == true) { if (String.IsNullOrEmpty(txtId.Text)) { AlmacenDisecWS.storehouse store = new AlmacenDisecWS.storehouse(); frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { string name = txtNameStorehouse.Text; int phoneNumber = int.Parse(txtPhone.Text); string address = txtAddressStorehouse.Text; store.address = address; store.phone_number = phoneNumber; store.storehouse_name = name; AlmacenDisecWS.city city = new AlmacenDisecWS.city(); city = (AlmacenDisecWS.city)cboCity.SelectedItem; store.city = city; int result = serviceDA.insertStorehouse(store); } frmSearchStoreHouse fm = Owner as frmSearchStoreHouse; fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = ""; this.Close(); } else { frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral(); frm2.ShowDialog(); } } else { if (String.IsNullOrEmpty(txtNameStorehouse.Text) || String.IsNullOrEmpty(txtPhone.Text) || cboCity.SelectedIndex == -1 || String.IsNullOrEmpty(txtAddressStorehouse.Text)) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { AlmacenDisecWS.storehouse store = new AlmacenDisecWS.storehouse(); frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = int.Parse(txtId.Text); string name = txtNameStorehouse.Text; int phoneNumber = int.Parse(txtPhone.Text); string address = txtAddressStorehouse.Text; store.id_storehouse = id; store.address = address; store.phone_number = phoneNumber; store.storehouse_name = name; AlmacenDisecWS.city city = new AlmacenDisecWS.city(); city = (AlmacenDisecWS.city)cboCity.SelectedItem; store.city = city; int result = serviceDA.updateStorehouse(store); } } frmSearchStoreHouse fm = Owner as frmSearchStoreHouse; fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = ""; this.Close(); } } } }