Beispiel #1
0
        public AddUpdateCustomers(TypeWindow type)
        {
            InitializeComponent();
            workCustomer = new WorkCustomer();

            switch (type)
            {
            case TypeWindow.addCustomer:
                btnAdd.Visibility = Visibility.Visible;
                txtDni.Visibility = Visibility.Visible;

                btnUpdate.Visibility    = Visibility.Collapsed;
                cmbCustomers.Visibility = Visibility.Collapsed;
                break;

            case TypeWindow.updateCustomer:
                ListBoxCustomers();
                btnAdd.Visibility = Visibility.Collapsed;
                txtDni.Visibility = Visibility.Collapsed;

                btnUpdate.Visibility    = Visibility.Visible;
                cmbCustomers.Visibility = Visibility.Visible;

                tittle.Text = "Actualizar datos del cliente";
                break;
            }
        }
 public PrinterTicketView(BaseClass.Ticket ticket)
 {
     InitializeComponent();
     wcustomer   = new WorkCustomer();
     wprojection = new WorkProjection();
     userDto     = UserDto.Instance;
 }
Beispiel #3
0
 private void btnDeleteCustomers_Click(object sender, EventArgs e)
 {
     if (grdCostumers.SelectedRows.Count > 0)
     {
         var result = MessageBox.Show("¿Desea eliminar el cliente?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.Yes)
         {
             idCustomer = grdCostumers.CurrentRow.Cells["Id"].Value.ToString();
             try
             {
                 WorkCustomer.deleteCustomer(idCustomer);
                 MessageBox.Show("Se elimino correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 loadCostumers();
             }
             catch
             {
                 MessageBox.Show("El cliente tiene compras actualemente ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     else
     {
         MessageBox.Show("Seleccione una fila!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Beispiel #4
0
        private void setCmbCustomer()
        {
            DataRowCollection dataUser = WorkCustomer.getAllCustomers().Rows;

            foreach (DataRow row in dataUser)
            {
                cmbClientes.Items.Add(row[3].ToString());
            }
        }
Beispiel #5
0
        private void InitializeObjects()
        {
            wcustomer  = new WorkCustomer();
            wticket    = new WorkTicket();
            projection = new Projection();
            wseat      = new WorkSeat();
            seats      = new List <Seat>();

            cmbCustomer.ItemsSource = wcustomer.GetAll();
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (validateField())
            {
                if (isEdit == false)
                {
                    var result = MessageBox.Show("¿Desea registrar al cliente?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        customer.DNI      = txtDni.Text;
                        customer.Name     = txtNombre.Text;
                        customer.LastName = txtApellido.Text;
                        customer.Address  = txtDireccion.Text;
                        customer.Phone    = txtTelefono.Text;
                        WorkCustomer.addCustomer(customer);


                        MessageBox.Show("DNI: " + customer.DNI + "   Apellido: " + customer.LastName + "  Nombre: " + customer.Name + "  Direccion: " + customer.Address + "  Telefono: " + customer.Phone, "Datos del Cliente Cargados", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
                //update
                if (isEdit == true)
                {
                    var result = MessageBox.Show("¿Desea guardar los cambios?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        customer.Id       = Convert.ToInt32(idCustomer);
                        customer.DNI      = txtDni.Text;
                        customer.Name     = txtNombre.Text;
                        customer.LastName = txtApellido.Text;
                        customer.Address  = txtDireccion.Text;
                        customer.Phone    = txtTelefono.Text;

                        WorkCustomer.updateCustomer(customer);
                        MessageBox.Show("Se actualizo correctamente", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        isEdit = false;
                    }
                }

                customerForm.loadCostumers();
                customerForm.Show();
                cleanFields();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Campos en Blancos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #7
0
 private void btnSearchCostumers_Click(object sender, EventArgs e)
 {
     if (txtSearchCustomers.Text != "")
     {
         grdCostumers.DataSource = WorkCustomer.searchCustomer(txtSearchCustomers.Text);
     }
     else
     {
         if (txtSearchCustomers.Text == "")
         {
             loadCostumers();
         }
     }
 }
Beispiel #8
0
 public void loadCostumers()
 {
     grdCostumers.DataSource = WorkCustomer.getAllCustomers();
 }
Beispiel #9
0
 private void OrderLasName_Click(object sender, EventArgs e)
 {
     grdCostumers.DataSource = WorkCustomer.getAllCustomersOrderLastName();
 }
Beispiel #10
0
 public AddUpdateCustomers()
 {
     InitializeComponent();
     workCustomer = new WorkCustomer();
 }