예제 #1
0
        private void btnStock_Click(object sender, EventArgs e)
        {
            UserControl content = new ucListItem();

            Global.mainForm.pContent.Controls.Clear();
            pContent.Controls.Add(content);
        }
예제 #2
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     try
     {
         Cursor.Current = Cursors.WaitCursor;
         UserControl content = new ucListItem();
         Global.mainForm.pContent.Controls.Clear();
         Global.mainForm.pContent.Controls.Add(content);
         Cursor.Current = Cursors.Default;
     }
     catch (Exception ex)
     {
         Mail.gestionaError(ex.Message); Global.error = true;
         MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                double dPVP      = 0;
                int    dCantidad = 0;

                double.TryParse(tbPVP.Text, out dPVP);
                int.TryParse(tbCantidad.Text, out dCantidad);

                if (dPVP <= 0)
                {
                    MessageBox.Show("El PVP debe ser mayor que cero", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (dCantidad < 0)
                {
                    MessageBox.Show("La cantidad debe ser cero o mayor", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    Global.common.updateItemSQL(Global.idItem, tbRef.Text, tbDesc.Text, dPVP, dCantidad);

                    Cursor.Current = Cursors.Default;

                    MessageBox.Show("Articulo modificado correctamente", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information);

                    UserControl content = new ucListItem();
                    Global.mainForm.pContent.Controls.Clear();
                    Global.mainForm.pContent.Controls.Add(content);
                }
            }
            catch (Exception ex)
            {
                Mail.gestionaError(ex.Message); Global.error = true;
                MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #4
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            try
            {
                string texto          = validate();
                long   idItemInserted = 0;

                if (string.IsNullOrEmpty(texto))
                {
                    int idProv = 0;
                    int.TryParse(cbProv.SelectedValue.ToString(), out idProv);

                    idItemInserted = Global.common.insertItemSQL(tbRef.Text.Trim().ToUpper(), 0, tbDescription.Text.ToUpper(), Math.Round(Convert.ToDouble(tbPVP.Text), 2), Convert.ToInt32(tbQuant.Text), idProv);

                    if (idItemInserted > 0)
                    {
                        MessageBox.Show("El artículo se ha guardado correctamente", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        UserControl content = new ucListItem();
                        Global.mainForm.pContent.Controls.Clear();
                        Global.mainForm.pContent.Controls.Add(content);
                    }
                    else
                    {
                        MessageBox.Show("Error al guardar el artículo, no se ha podido guardar correctamente", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show(texto, "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                Mail.gestionaError(ex.Message); Global.error = true;
                MessageBox.Show("ERROR", "Charlotte", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }