private void BtnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtA.Text)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == true) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; String abrev = txtA.Text; AlmacenDisecWS.measureUnit mU = new AlmacenDisecWS.measureUnit(); mU.abbrevation_measure_unit = abrev; mU.description = name; serviceDA.insertMeasure_unit(mU); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllMeasurement_Unit(); reiniciar(); btnModify.Enabled = true; operation = true; } } else { if (String.IsNullOrEmpty(txtId.Text)) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = Int32.Parse(txtId.Text); String name = txtName.Text; String abrev = txtA.Text; AlmacenDisecWS.measureUnit mU = new AlmacenDisecWS.measureUnit(); mU.abbrevation_measure_unit = abrev; mU.description = name; mU.id_measure_unit = id; serviceDA.updateMeasure_unit(mU); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllMeasurement_Unit(); reiniciar(); operation = true; btnModify.Enabled = true; } } } } }
private void BtnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == true) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; AlmacenDisecWS.category c = new AlmacenDisecWS.category(); c.category_name = name; serviceDA.insertCategory(c); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllCategory(); reiniciar(); btnModify.Enabled = true; operation = true; } } else { if (String.IsNullOrEmpty(txtId.Text)) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = Int32.Parse(txtId.Text); String name = txtName.Text; AlmacenDisecWS.category c = new AlmacenDisecWS.category(); c.category_name = name; c.category_id = id; serviceDA.updateCategory(c); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllCategory(); reiniciar(); operation = true; btnModify.Enabled = true; } } } } }
private void btnSave_Click(object sender, EventArgs e) { { if (flag == true) { if (String.IsNullOrEmpty(txtCost.Text) || String.IsNullOrEmpty(txtP.Text) || cboDestino.SelectedIndex == -1 || cboDriver.SelectedIndex == -1 || cboOrigen.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (String.IsNullOrEmpty(txtId.Text)) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { // String name = txtName.Text; //Category cat = new category(name,1); //Se llama al insert reiniciar(); } } else { frmMessageBoxDataGeneral frm2 = new frmMessageBoxDataGeneral(); frm2.ShowDialog(); } } } else { if ((String.IsNullOrEmpty(txtId.Text))) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); 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(); } } } } }
private void BtnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == true) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; AlmacenDisecWS.brand b = new AlmacenDisecWS.brand(); b.brand_name = name; int result = serviceDA.insertBrand(b); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllBrand(); reiniciar(); btnModify.Enabled = true; operation = true; } } else { if (String.IsNullOrEmpty(txtId.Text) || nombreTextoAnterior == null) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = Int32.Parse(txtId.Text); String name = txtName.Text; AlmacenDisecWS.brand b = serviceDA.queryBrandByName(nombreTextoAnterior); b.brand_name = name; int result = serviceDA.updateBrand(b); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllBrand(); reiniciar(); operation = true; btnModify.Enabled = true; } } } } }
private void BtnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text)) { frmMessageBoxAlert3 frm = new frmMessageBoxAlert3(); frm.ShowDialog(); } else { if (flag == true) { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; //Category cat = new category(name,1); //Se llama al insert reiniciar(); } } else { if (String.IsNullOrEmpty(txtId.Text)) { frmMessageBoxAlert4 frm2 = new frmMessageBoxAlert4(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = Int32.Parse(txtId.Text); String name = txtName.Text; //Category cat = new category(name,0); //Se llama al update reiniciar(); } } } } }
private void btnSave_Click(object sender, EventArgs e) { if (flag == true) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtLastName1.Text) || String.IsNullOrEmpty(txtLastName2.Text) || String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtDNI.Text) || String.IsNullOrEmpty(txtSalary.Text) || String.IsNullOrEmpty(txtPassword.Text) || cboPrivilege.SelectedIndex == -1 || (rbWoman.Checked == false && rbMan.Checked == false)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { AlmacenDisecWS.employee emp = new AlmacenDisecWS.employee(); frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { string name = txtName.Text; string apP = txtLastName1.Text; string apM = txtLastName2.Text; string DNI = txtDNI.Text; string email = txtEmail.Text; string pass = txtPassword.Text; Double sueldo = Double.Parse(txtSalary.Text); emp.employee_name = name; emp.last_name = apP; emp.second_last_name = apM; emp.dni = DNI; emp.email_employee = email; emp.salary = sueldo; emp.password = pass; int a = 0; if (cboPrivilege.SelectedValue.ToString() == "MANAGER") { a = 1; } else if (cboPrivilege.SelectedValue.ToString() == "STOREKEEPER") { a = 2; } else { a = 3; } if (rbMan.Checked == true) { emp.gender = "M"; } else { emp.gender = "F"; } int result = serviceDA.insertEmployee(emp, a); } frmSearchUser fm = Owner as frmSearchUser; fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = serviceDA.queryAllEmployee(); this.Close(); } } else { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtLastName1.Text) || String.IsNullOrEmpty(txtLastName2.Text) || String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtDNI.Text) || String.IsNullOrEmpty(txtSalary.Text) || (rbWoman.Checked == false && rbMan.Checked == false)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { AlmacenDisecWS.employee emp = new AlmacenDisecWS.employee(); frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { string name = txtName.Text; string apP = txtLastName1.Text; string apM = txtLastName2.Text; string DNI = txtDNI.Text; string email = txtEmail.Text; Double sueldo = Double.Parse(txtSalary.Text); emp.employee_id = Int32.Parse(lblId.Text); emp.employee_name = name; emp.last_name = apP; emp.second_last_name = apM; emp.dni = DNI; emp.salary = sueldo; emp.email_employee = email; if (rbMan.Checked == true) { emp.gender = "M"; } else { emp.gender = "F"; } int result = serviceDA.updateEmployee(emp); } } frmSearchUser fm = Owner as frmSearchUser; fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = serviceDA.queryAllEmployee(); this.Close(); } }
private void BtnSave_Click(object sender, EventArgs e) { if (flag == true) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtRuc.Text) || String.IsNullOrEmpty(txtAddress.Text) || String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtPhone.Text) || cboCountry.SelectedIndex == -1 || cboCity.SelectedIndex == -1) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { AlmacenDisecWS.supplier s = new AlmacenDisecWS.supplier(); AlmacenDisecWS.city ci = new AlmacenDisecWS.city(); AlmacenDisecWS.country co = new AlmacenDisecWS.country(); s.email = txtEmail.Text; s.ruc = txtRuc.Text; s.adress = txtAddress.Text; s.phone_number = Int32.Parse(txtPhone.Text); s.supplier_name = txtName.Text; s.city = (AlmacenDisecWS.city)cboCity.SelectedItem; s.city.country = (AlmacenDisecWS.country)cboCountry.SelectedItem; int result = serviceDA.insertSupplier(s); reiniciar(); frmSearchSupplier fm = Owner as frmSearchSupplier; fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = ""; this.Close(); } } } else { if (String.IsNullOrEmpty(txtCode.Text) || String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtRuc.Text) || String.IsNullOrEmpty(txtAddress.Text) || String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtPhone.Text)) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { AlmacenDisecWS.supplier s = new AlmacenDisecWS.supplier(); //falta que le quiten el pais al actualizar s.id_supplier = Int32.Parse(txtCode.Text); s.email = txtEmail.Text; s.ruc = txtRuc.Text; s.adress = txtAddress.Text; s.phone_number = Int32.Parse(txtPhone.Text); s.supplier_name = txtName.Text; int result = serviceDA.updateSupplier(s); reiniciar(); frmSearchSupplier fm = Owner as frmSearchSupplier; fm.txtSearch.Clear(); fm.dgvSearch.AutoGenerateColumns = false; fm.dgvSearch.DataSource = ""; this.Close(); } } } }
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)) { frmMessageBoxFillNull frm = new frmMessageBoxFillNull(); frm.ShowDialog(); } else { if (flag == true) { if ((cboCategory.SelectedIndex == -1) || (cboType.SelectedIndex == -1)) { frmMessageBoxCategory frm = new frmMessageBoxCategory(); frm.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { String name = txtName.Text; AlmacenDisecWS.category c = (AlmacenDisecWS.category)cboCategory.SelectedItem; AlmacenDisecWS.family f = new AlmacenDisecWS.family(); f.name_family = name; f.category = c; btnModify.Enabled = true; operation = true; dgvSearch.AutoGenerateColumns = false; int a = 0; string a1 = cboType.SelectedItem.ToString(); if (cboType.SelectedItem.ToString() == "MATERIAL") { a = 1; } else if (cboType.SelectedItem.ToString() == "HERRAMIENTA") { a = 2; } int result = serviceDA.insertFamily(f, a); dgvSearch.DataSource = serviceDA.queryAllFamily(c.category_id); cmbSearch.Text = cboCategory.Text; reiniciar(); } } } else { if (String.IsNullOrEmpty(txtId.Text) || String.IsNullOrEmpty(cboCategory.Text)) { frmMessageBoxFillNull frm2 = new frmMessageBoxFillNull(); frm2.ShowDialog(); } else { frmMessageBoxSave frm = new frmMessageBoxSave(); if (frm.ShowDialog() == DialogResult.OK) { int id = Int32.Parse(txtId.Text); String name = txtName.Text; AlmacenDisecWS.category c = (AlmacenDisecWS.category)cboCategory.SelectedItem; AlmacenDisecWS.family f = new AlmacenDisecWS.family(); f.id_family = id; f.name_family = name; f.category = c; int result = serviceDA.updateFamily(f); dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = serviceDA.queryAllFamily(c.category_id); cmbSearch.Text = cboCategory.Text; reiniciar(); operation = true; btnModify.Enabled = true; } } } } }
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(); } } } } } }
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(); } } } }