private void btnSaveEmployee_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient(); currentEmployee.dni = txtEmployeeDNI.Text; currentEmployee.name = txtEmployeeName.Text; currentEmployee.lastName = txtEmployeeFirstLastName.Text; currentEmployee.secondLastName = txtEmployeeSecondLastName.Text; currentEmployee.phone = txtEmployeePhone.Text; currentEmployee.email = txtEmployeeEmail.Text; currentEmployee.birthdate = (DateTime)dtpEmployeeBorn.Value.Date; currentEmployee.contractStarDate = (DateTime)dtpEmployeeStartDate.Value.Date; currentEmployee.contractEndDate = (DateTime)dtpEmployeeEndDate.Value.Date; //emp.area = cbArea.Text currentEmployee.role = cbRole.Text; int salio = serviceDA.updateEmployee(currentEmployee); Cursor.Current = Cursors.Arrow; if (salio == 1) { MessageBox.Show("El empleado se modificó satisfactoriamente."); } else { MessageBox.Show("Hubo un error :("); } this.Close(); } }
private void btnSearch_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient(); cliente = (serviceDA.queryByIdCustomer(txtDniRuc.Text)); Cursor.Current = Cursors.Arrow; if (cliente.id != null) { ModificarClienteForm modClient = new ModificarClienteForm(); modClient.currentCustomer = new customer(); serviceDA = new DBControllerWSClient(); modClient.currentCustomer = cliente; modClient.SetParent(this); modClient.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("Cliente no encontrado"); } } }
private void btnSaveChanges_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { serviceDA = new DBControllerWSClient(); currentSupplier.RUC = txtRuc.Text; currentSupplier.name = txtNombre.Text; currentSupplier.address = txtDireccion.Text; currentSupplier.bankData = txtCuenta.Text; currentSupplier.contactPhone = txtTelefono.Text; currentSupplier.contactEmail = txtEmail.Text; currentSupplier.contactPerson = txtPersonaContacto.Text; currentSupplier.supplierCode = txtCodProv.Text; currentSupplier.termOfSale = txtTerminoVenta.Text; currentSupplier.state = cbActive.Checked ? 1 : 0; serviceDA.updateSupplier(currentSupplier); MessageBox.Show("El proveedor se modificó satisfactoriamente"); this.Close(); } }
private void btnSearchEmployee_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { Cursor.Current = Cursors.WaitCursor; //dgvEmployee.Rows.Clear(); serviceDAA = new DBControllerWSClient(); empleado = (serviceDAA.queryEmployeeByDNI(txtDNI.Text)); Cursor.Current = Cursors.Arrow; if (empleado.idEmployee != null) { ModifyEmployeeForm modifyEmployeeForm = new ModifyEmployeeForm(); modifyEmployeeForm.currentEmployee = new employee(); //employee e1 = new employee(); serviceDAA = new DBControllerWSClient(); //e1 = serviceDAA.queryEmployeeByDNI(dgvEmployee.Rows[i].Cells[0].Value.ToString()); modifyEmployeeForm.currentEmployee = empleado; modifyEmployeeForm.SetParent(this); modifyEmployeeForm.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("Empleado no encontrado"); } //dgvEmployee.Rows.Add(new String[] { //empleado.dni,empleado.name,empleado.lastName,empleado.phone,empleado.email,empleado.role }); } }
private void btnDelClient_Click(object sender, EventArgs e) { int i = dgvClients.CurrentCell.RowIndex; if (i >= 0) { DialogResult dialog = MessageBox.Show("¿Está seguro de eliminar a este cliente?", "Aviso", MessageBoxButtons.YesNo); if (dialog == DialogResult.Yes) { serviceDA = new DBControllerWSClient(); //serviceDA.deleteCustomer(customers[i]); MessageBox.Show("El cliente seleccionado fue eliminado satisfactoriamente"); updateDataGridView(); } else { //no eliminas ps sanaso } } else { MessageBox.Show("Seleccione el cliente a eliminar"); } //Con base de datos, actualiza el grid }
private void btnSaveUser_Click(object sender, EventArgs e) { if (filledValues()) { serviceDA = new DBControllerWSClient(); user u = new user(); u.creationDate = DateTime.Now; u.expirationDate = (DateTime)dtpUserExpirationDate.Value.Date; u.user1 = txtUserName.Text; u.password = txtUserPassword.Text; u.state = 1; u.employee = emplo; if (emplo.role == "Vendedor") { u.userType = 3; } else if (emplo.role == "Supervisor") { u.userType = 2; } else { u.userType = 1; } serviceDA.insertUser(u); MessageBox.Show("El usuario se agregó satisfactoriamente"); this.Close(); } }
private void btnSearch_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; serviceDAA = new DBControllerWSClient(); p = serviceDAA.queryProductBySKUCode(txtProduct.Text); if (p.name != null) { UpdateProductForm updateForm1 = new UpdateProductForm(); updateForm1.currentProduct = new product(); updateForm1.currentProduct = p; updateForm1.SetParent(this); updateForm1.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("No existe el producto con ese elemento SKU"); updateDataGridView(); } } catch { MessageBox.Show("No existe producto con ese elemento SKU no es correcta"); } }
private void btnSave_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { product p = new product(); p.brand = brands[cboBrand.SelectedIndex]; p.family = families[cboFamily.SelectedIndex]; p.discount = discounts[cboDiscount.SelectedIndex]; p.SKUcode = txtSKUCode.Text; p.name = txtName.Text; p.productDescription = txtDescription.Text; p.productCareDescription = txtCareDescription.Text; p.state = 1; p.salePrice = float.Parse(txtSalePrice.Text); p.purchasePrice = float.Parse(txtPurchasePrice.Text); p.igv = float.Parse(txtIGV.Text); p.stock = int.Parse(txtStock.Text); serviceDA = new DBControllerWSClient(); Cursor.Current = Cursors.WaitCursor; serviceDA.insertProduct(p); Cursor.Current = Cursors.Arrow; MessageBox.Show("El producto se guardó satisfactoriamente"); this.Close(); } }
private void btnSaveClient_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { //getCustomerData customer c = new customer(); c.id = txtClienteID.Text; c.descriptionCustomer = txtDesc.Text; c.address = txtAddress.Text; c.occupation = txtOccupation.Text; c.email = txtEmail.Text; c.phone = txtPhone.Text; c.kindOfCustomer = cbTipoCliente.Text; c.state = 1; serviceDA = new DBControllerWSClient(); Cursor.Current = Cursors.WaitCursor; serviceDA.insertCustomer(c); Cursor.Current = Cursors.Arrow; MessageBox.Show("El cliente se agregó satisfactoriamente"); this.Close(); } }
private void btnSearch_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; serviceDAA = new DBControllerWSClient(); usuario = serviceDAA.queryUserByUserName(txtUsername.Text); if (usuario.password != null) { ModifyUserForm updateForm1 = new ModifyUserForm(users[1]); updateForm1.currentUser = new user(); updateForm1.currentUser = usuario; updateForm1.SetParent(this); updateForm1.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("No existe el usuario con ese username"); } } catch { MessageBox.Show("Ocurrió un problema"); updateDataGridView(); } }
private void btnSaveChanges_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { supplier s = new supplier(); s.RUC = txtRuc.Text; s.name = txtNombre.Text; s.address = txtDireccion.Text; s.bankData = txtCuenta.Text; s.contactEmail = txtEmail.Text; s.contactPerson = txtPersonaContacto.Text; s.supplierCode = txtCodProv.Text; s.state = 1; serviceDA = new DBControllerWSClient(); Cursor.Current = Cursors.WaitCursor; serviceDA.insertSupplier(s); Cursor.Current = Cursors.Arrow; MessageBox.Show("El proveedor se agregó satisfactoriamente"); this.Close(); } }
private void BtnSave_Click_1(object sender, EventArgs e) { if (!filledValues()) { } else { serviceDA = new DBControllerWSClient(); currentProduct.SKUcode = txtSKUCode.Text; currentProduct.name = txtName.Text; currentProduct.productDescription = txtDescription.Text; currentProduct.brand = brands[cboBrand.SelectedIndex]; currentProduct.family = families[cboFamily.SelectedIndex]; currentProduct.discount = discounts[cboDiscount.SelectedIndex]; currentProduct.productCareDescription = txtCareDescription.Text; currentProduct.salePrice = float.Parse(txtSalePrice.Text); currentProduct.purchasePrice = float.Parse(txtPurchasePrice.Text); currentProduct.igv = float.Parse(txtIGV.Text); currentProduct.stock = int.Parse(txtStock.Text); if (cbActive.Checked == true) { currentProduct.state = 1; } else { currentProduct.state = 0; } serviceDA.updateProduct(currentProduct); MessageBox.Show("El producto se modificó satisfactoriamente"); this.Close(); } }
private void BtnSearch_Click(object sender, EventArgs e) { if (txtProductName.Text == "") { MessageBox.Show("Complete la información"); } else { Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient(); String skucodee = txtProductName.Text; int idAlmacenn = int.Parse(txtWarehouseId.Text); detalleProducto = (serviceDA.queryWarehousedetailBySKUandWarehouseID(skucodee, idAlmacenn)); producto = serviceDA.queryProductBySKUCode(skucodee); if (producto.name != null) { dgvProducts.Rows.Clear(); dgvProducts.Rows.Add(new String[] { "" + producto.SKUcode, producto.name, "" + producto.salePrice, "" + detalleProducto.quantity }); } else { MessageBox.Show("Ingrese un código SKU válido"); } Cursor.Current = Cursors.Arrow; } }
private void MainWindow_Load_1(object sender, EventArgs e) { serviceDA = new View.MateWSLocal.DBControllerWSClient(); employee emp = new employee(); emp = serviceDA.queryEmployeeByUsername(currentUser.user1); lblNameUser.Text = emp.name + " " + emp.lastName + " " + emp.secondLastName; }
private void btnSearchEmployee_Click(object sender, EventArgs e) { if (!filledValues()) { MessageBox.Show("Complete la información"); } else { Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient(); compra = (serviceDA.queryPurchaseBySerialCode(txtSerialCode.Text)); Cursor.Current = Cursors.Arrow; if (compra.serialCode != null) { dgvPurchases.Rows.Clear(); dgvPurchases.Rows.Add(new String[] { "" + compra.serialCode, "" + compra.totalPurchase, "" + compra.supplier.name, "" + compra.creationDate }); } else { MessageBox.Show("Compra no encontrada"); } } /* * if (!filledValues()) * { * //MessageBox.Show("Complete la información"); * } * else * { * Cursor.Current = Cursors.WaitCursor; * serviceDA = new DBControllerWSClient(); * sale sale = (serviceDA.querySaleBySerialCode(txtSerialCode.Text)); * Cursor.Current = Cursors.Arrow; * if (sale.totalSale != null) * { * ModificarClienteForm modClient = new ModificarClienteForm(); * modClient.currentCustomer = new customer(); * serviceDA = new DBControllerWSClient(); * modClient.currentCustomer = cliente; * modClient.SetParent(this); * modClient.ShowDialog(); * updateDataGridView(); * * * } * else * { * MessageBox.Show("Cliente no encontrado"); * } * * }*/ }
private void AddEmployeeForm_Load(object sender, EventArgs e) { serviceDA = new DBControllerWSClient(); areas = new BindingList <area>(serviceDA.queryAllArea()); for (int i = 0; i < areas.Count; i++) { cbArea.Items.Add(areas[i].description); } }
public AddSupplierForm() { InitializeComponent(); serviceDA = new DBControllerWSClient(); BindingList <supplier> supp = new BindingList <supplier>(serviceDA.queryAllSupplier()); int lastSupCode = supp[supp.Count() - 1].id; String newSupCode = "SU" + (int.Parse(lastSupCode.ToString()) + 1).ToString("000"); txtCodProv.Text = newSupCode; cbActive.Checked = true; }
private void BtnSearchEmployee_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient(); venta = (serviceDA.querySaleBySerialCode(txtSerialCode.Text)); Cursor.Current = Cursors.Arrow; if (venta.serialCode != null) { RefundForm modClient = new RefundForm(); modClient.CurrentSale = new sale(); serviceDA = new DBControllerWSClient(); modClient.CurrentSale = venta; modClient.SetParent(this); modClient.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("Cliente no encontrado"); } /* * * if (!filledValues()) * { * //MessageBox.Show("Complete la información"); * } * else * { * Cursor.Current = Cursors.WaitCursor; * serviceDA = new DBControllerWSClient(); * sale sale = (serviceDA.querySaleBySerialCode(txtSerialCode.Text)); * Cursor.Current = Cursors.Arrow; * if (sale.totalSale != null) * { * RefundForm refForm = new RefundForm(); * refForm.CurrentSale = new sale(); * serviceDA = new DBControllerWSClient(); * refForm.CurrentSale = sale; * refForm.SetParent(this); * refForm.ShowDialog(); * updateDataGridView(); * } * else * { * MessageBox.Show("Cliente no encontrado"); * } * * }*/ }
void updateDataGridView() { Cursor.Current = Cursors.WaitCursor; dgvUser.Rows.Clear(); serviceDA = new DBControllerWSClient(); users = new BindingList <user> (serviceDA.queryAllUser()); for (int i = 0; i < users.Count; i++) { dgvUser.Rows.Add(new String[] { users[i].user1, users[i].expirationDate.ToString() }); } Cursor.Current = Cursors.Arrow; }
private void updateDataGridView() { Cursor.Current = Cursors.WaitCursor; dgvSales.Rows.Clear(); serviceDA = new DBControllerWSClient(); sales = new BindingList <sale>(serviceDA.queryAllSale()); for (int i = 0; i < sales.Count; i++) { dgvSales.Rows.Add(new String[] { "" + sales[i].serialCode, "" + sales[i].totalSale, "" + sales[i].customer.descriptionCustomer, "" + sales[i].creationDate }); } Cursor.Current = Cursors.Arrow; }
private void updateDataGridView() { Cursor.Current = Cursors.WaitCursor; dgvClients.Rows.Clear(); serviceDA = new DBControllerWSClient(); customers = new BindingList <customer>(serviceDA.queryAllCustomer()); for (int i = 0; i < customers.Count; i++) { dgvClients.Rows.Add(new String[] { "" + customers[i].id, customers[i].descriptionCustomer, customers[i].email, customers[i].phone, "" + customers[i].kindOfCustomer }); } Cursor.Current = Cursors.Arrow; }
private void updateDataGridView() { Cursor.Current = Cursors.WaitCursor; dgvPurchases.Rows.Clear(); serviceDA = new DBControllerWSClient(); purchases = new BindingList <purchase>(serviceDA.queryAllPurchase()); for (int i = 0; i < purchases.Count; i++) { dgvPurchases.Rows.Add(new String[] { "" + purchases[i].serialCode, "" + purchases[i].totalPurchase, "" + purchases[i].supplier.name, "" + purchases[i].creationDate }); } Cursor.Current = Cursors.Arrow; }
private void SaveButton_Click(object sender, EventArgs e) { if (!filledValues()) { //MessageBox.Show("Complete la información"); } else { //serviceDA = new DBControllerWSClient(); purchase p = new purchase(); p.state = 1; p.serialCode = txtSerialCode.Text; p.totalPurchase = float.Parse(txtTotal.Text); //para el supplier supplier c = new supplier(); serviceDA = new DBControllerWSClient(); c = serviceDA.querySupplierByCode(txtIdProv.Text); p.supplier = c; //para los purchase lanes purchaseLane[] salelanes; salelanes = new purchaseLane[dgvPurchaseDetails.RowCount - 1]; for (int i = 0; i < dgvPurchaseDetails.RowCount - 1; i++) { purchaseLane purchaselane = new purchaseLane(); purchaselane.subtotal = float.Parse(dgvPurchaseDetails.Rows[i].Cells[4].Value.ToString()); purchaselane.quantity = int.Parse(dgvPurchaseDetails.Rows[i].Cells[3].Value.ToString()); //purchaselane.purchase = p; product pr = new product(); pr = serviceDA.queryProductBySKUCode(dgvPurchaseDetails.Rows[i].Cells[0].Value.ToString()); purchaselane.product = pr; salelanes[i] = purchaselane; } p.currency = "Soles"; p.purchaseLanes = salelanes; //Cursor.Current = Cursors.WaitCursor; int salio = serviceDA.insertPurchase(p); if (salio == 1) { MessageBox.Show("Se ingresó la compra correctamente"); } else { MessageBox.Show("¡Hubo un problema!"); } //Cursor.Current = Cursors.Arrow; this.Close(); } }
private void updateDataGridView() { Cursor.Current = Cursors.WaitCursor; dgvEmployee.Rows.Clear(); serviceDA = new DBControllerWSClient(); employees = new BindingList <employee>(serviceDA.queryAllEmployee()); for (int i = 0; i < employees.Count; i++) { dgvEmployee.Rows.Add(new String[] { "" + employees[i].dni, employees[i].name, employees[i].lastName, employees[i].phone, employees[i].email, employees[i].role }); } Cursor.Current = Cursors.Arrow; }
private void PurchaseForm_Load(object sender, EventArgs e) { txtIdProv.Text = "Ingrese ID Proovedor"; txtIdProv.ForeColor = Color.Gray; serviceDA = new View.MateWSLocal.DBControllerWSClient(); employee emp = new employee(); emp = serviceDA.queryEmployeeByUsername(currentUser.user1); userLabelContent.Text = emp.name + " " + emp.lastName + " " + emp.secondLastName; purchases = new BindingList <purchase>(serviceDA.queryAllPurchase()); String ultimoSerialCode = purchases[purchases.Count() - 1].serialCode; String nuevoSerialCode = "C" + (int.Parse(ultimoSerialCode.Substring(1)) + 1).ToString("000000"); txtSerialCode.Text = nuevoSerialCode; }
private void BtnSaveClient_Click(object sender, EventArgs e) { serviceDA = new DBControllerWSClient(); currentCustomer.id = txtClienteID.Text; currentCustomer.descriptionCustomer = txtDesc.Text; currentCustomer.address = txtAddress.Text; currentCustomer.occupation = txtOccupation.Text; currentCustomer.email = txtEmail.Text; currentCustomer.phone = txtPhone.Text; currentCustomer.kindOfCustomer = cbTipoCliente.Text; currentCustomer.state = cbActive.Checked? 1: 0; serviceDA.updateCustomer(currentCustomer); MessageBox.Show("El cliente se modificó satisfactoriamente"); this.Close(); }
private void btnOK_Click(object sender, EventArgs e) { MainWindow menu = new MainWindow(); if (filledValues()) { //user u = new user(serviceDA.validateUser()); Cursor.Current = Cursors.WaitCursor; serviceDA = new DBControllerWSClient();//Error 00:14 user u = serviceDA.validateUser(txtUsername.Text, txtPassword.Text); Cursor.Current = Cursors.Arrow; if (u.password != null) { if (txtUsername.Text == u.user1) { if (u.userType == 1) { menu.darPermiso(MainWindow.Permiso.Gerente); } else if (u.userType == 2) { menu.darPermiso(MainWindow.Permiso.Supervisor); } else if (u.userType == 3) { menu.darPermiso(MainWindow.Permiso.Vendedor); } menu.currentUser = u; menu.Show(); this.Hide(); } else { MessageBox.Show("Usuario o contraseña incorrectos"); } } else { writePassword.Visible = true; writeUser.Visible = true; MessageBox.Show("Usuario o contraseña incorrectos"); return; } } }
private void btnSaveChanges_Click(object sender, EventArgs e) { serviceDA = new DBControllerWSClient(); currentLocal.description = txtDesc.Text; currentLocal.address = txtDir.Text; if (cbActive.Checked == true) { currentLocal.state = 1; } else { currentLocal.state = 0; } serviceDA.updatePremises(currentLocal); MessageBox.Show("El local se modificó satisfactoriamente"); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { int result; serviceDAA = new DBControllerWSClient(); currentFamily.idFamily = txtFamilyCode.Text; currentFamily.name = txtName.Text; currentFamily.description = txtDescription.Text; currentFamily.state = cbActive.Checked ? 1 : 0; result = serviceDAA.updateFamily(currentFamily); if (result == 1) { MessageBox.Show("La familia se modificó satisfactoriamente"); } else { MessageBox.Show("Hubo un error al modificar la familia"); } this.Close(); }
private void btnEditClient_Click(object sender, EventArgs e) { int i = dgvClients.CurrentCell.RowIndex; if (i >= 0) { ModificarClienteForm modClient = new ModificarClienteForm(); modClient.currentCustomer = new customer(); customer e1 = new customer(); serviceDA = new DBControllerWSClient(); e1 = serviceDA.queryByIdCustomer(dgvClients.Rows[i].Cells[0].Value.ToString()); modClient.currentCustomer = e1; modClient.ShowDialog(); updateDataGridView(); } else { MessageBox.Show("Seleccione un cliente"); } }