private void btnRegistrar_Click(object sender, EventArgs e) { if (ValidarDescripcion()) { if (ValidarImporte()) { if (ValidarDuplicado()) { string ClavePlatillo = txtClavePlatillo.Text; string desc = txtDescripcion.Text; double importe = Convert.ToDouble(txtImportePlatillo.Text); int tiempo = Convert.ToInt32(numUpTiempo.Value); listPlatillos.AgregaPlatillo(desc, importe, tiempo); MessageBox.Show("Platillo Agregado Correctamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); //Limpiar ErrorProvider ErrorPPlatillos.SetError(txtDescripcion, ""); ErrorPPlatillos.SetError(txtImportePlatillo, ""); DataGPlatillos.Rows.Clear(); string[] Aclave = listPlatillos.arregloClave(); string[] Adesc = listPlatillos.arregloDescripcion(); string[] Aimporte = listPlatillos.arregloImporte(); string[] Atiempo = listPlatillos.arregloTiempo(); for (int i = 0; i < Aclave.Length; i++) { DataGPlatillos.Rows.Add(Aclave[i], Adesc[i], Aimporte[i], Atiempo[i]); } //Limpiar Al Registrar txtDescripcion.Text = ""; txtImportePlatillo.Text = "0"; numUpTiempo.Value = 10; txtClavePlatillo.Text = Platillo.ObtieneClave().ToString(); txtDescripcion.Focus(); } } } }
public frmPlatillos(ListPlatillos Lpla) { InitializeComponent(); listPlatillos = Lpla; txtClavePlatillo.Text = Platillo.ObtieneClave().ToString(); }
public void AgregaPlatillo(string desc, double importe, int tiempo) { Platillo platillo = new Platillo(desc, importe, tiempo); ListPlatillo.Add(platillo); }