示例#1
0
        private void botonAceptar_Click(object sender, EventArgs e)
        {
            if (this.txt_tipo.Text == "")
            {
                MessageBox.Show("No se ingresó ningún dato", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txt_tipo.Focus();
            }
            else
            {
                if (tipoService.GetByName(this.txt_tipo.Text).Count == 0)
                {
                    string nombre = this.txt_tipo.Text;

                    TipoClasificacionNavio tipo = new TipoClasificacionNavio(nombre);

                    tipoService.CreateTipoNavio(tipo);

                    MessageBox.Show("Se creó el tipo " + nombre + " Exitosamente."
                                    , "Mensaje"
                                    , MessageBoxButtons.OK
                                    , MessageBoxIcon.Exclamation);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("El Tipo ya existe", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
示例#2
0
        private void botonConsultar_Click(object sender, EventArgs e)
        {
            TipoClasificacionNavioService tipoService = new TipoClasificacionNavioService();
            DataTable tabla = new DataTable();
            List <TipoClasificacionNavio> tiposNavios = new List <TipoClasificacionNavio>();

            if (txt_tipoNavio.Text == "" &&
                chk_todos.Checked == false)
            {
                MessageBox.Show("No se cargó ningún dato", "importante", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                txt_tipoNavio.Focus();
            }

            if (txt_tipoNavio.Text != "" &&
                chk_todos.Checked == false)
            {
                tiposNavios = tipoService.GetByName(txt_tipoNavio.Text);
                if (tiposNavios.Count == 0)
                {
                    MessageBox.Show("No se encontró ningún tipo de clasificacion con ese nombre.");
                }
            }

            if (chk_todos.Checked == true)
            {
                tiposNavios = tipoService.GetAll();
            }
            cargar_grilla(tiposNavios);
        }