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(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtSearch.Text)) { list.Clear(); listDetails.Clear(); int cont = 0; AlmacenDisecWS.tool[] a = new AlmacenDisecWS.tool[200]; a = serviceDA.queryAllTool(); cont = a.Count(); for (int i = 0; i < cont; i++) { Tool s = new Tool(); s.id_item = a[i].id_item; s.name_item = a[i].name_item; s.price = a[i].price; s.brand.brand_name = a[i].brand.brand_name; list.Add(s); } dgvSearch.AutoGenerateColumns = false; dgvSearch.DataSource = list; btnNew.Enabled = true; btnAddTool.Enabled = true; /* * if (s.tool_details != null) * { * cont = s.tool_details.Count(); * for (int i = 0; i < cont; i++) * { * AlmacenDisecWS.toolDetail t = new AlmacenDisecWS.toolDetail(); * t.code_tool = s.tool_details[i].code_tool; * t.serie_tool = s.tool_details[i].serie_tool; * t.detail_tool = s.tool_details[i].detail_tool; * t.tool_state = s.tool_details[i].tool_state; * listDetails.Add(t); * } * * dgvSearch.AutoGenerateColumns = false; * dgvSearch.DataSource = listDetails; * btnModify.Enabled = true; * }*/ /* * a = serviceDA.queryAllTool(); * cont = a.Count(); * for (int i = 0; i < cont; i++) * { * Tool s = new Tool(); * s.id_tool = a[i].id_tool; * s.name_item = a[i].name_item; * s.price = a[i].price; * s.brand = a[i].brand; * s.tool_details = a[i].tool_details; * if (s.tool_details != null) * { * int b = s.tool_details.Length; * for (int j = 0; j < b; j++) * { * AlmacenDisecWS.toolDetail t = new AlmacenDisecWS.toolDetail(); * t.code_tool = s.tool_details[j].code_tool; * t.serie_tool = s.tool_details[j].serie_tool; * t.detail_tool = s.tool_details[j].detail_tool; * t.tool_state = s.tool_details[j].tool_state; * listDetails.Add(t); * } * } * * list.Add(s); * } * dgvSearch.AutoGenerateColumns = false; * dgvSearch.DataSource = listDetails; */ } else { } }