示例#1
0
        private void agregarPaisButton_Click(object sender, EventArgs e)
        {
            PaisesAEForm frm = new PaisesAEForm();

            frm.Text = "Agregar País...";
            DialogResult dr = frm.ShowDialog(this);

            if (dr == DialogResult.OK)
            {
                try
                {
                    ServicioPais servicioPais = new ServicioPais();
                    Pais         pais         = frm.GetPais();
                    if (!servicioPais.Existe(pais))
                    {
                        servicioPais.Agregar(pais);
                        Helper.CargarDatosComboPaises(ref paisesComboBox);
                    }
                    else
                    {
                        MessageBox.Show("País repetido", "Error",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Error",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
示例#2
0
        public static void CargarDatosComboPaises(ref ComboBox combo)
        {
            ServicioPais servicio    = new ServicioPais();
            var          lista       = servicio.GetLista();
            Pais         defaultPais = new Pais {
                PaisId = 0, Nombre = "<Seleccione País>"
            };

            lista.Insert(0, defaultPais);
            combo.DataSource    = lista;
            combo.DisplayMember = "Nombre";
            combo.ValueMember   = "PaisId";
            combo.SelectedIndex = 0;
        }
示例#3
0
        public static void CargarDatosComboPais(ref ComboBox comboPais)
        {
            ServicioPais servicio    = new ServicioPais();
            var          lista       = servicio.GetLista();
            Pais         paisDefault = new Pais();

            paisDefault.PaisId = 0;
            paisDefault.Nombre = "<Seleccionar Pais>";
            lista.Insert(0, paisDefault);
            comboPais.DataSource    = lista;
            comboPais.DisplayMember = "Nombre";
            comboPais.ValueMember   = "PaisId";
            comboPais.SelectedIndex = 0;
        }
示例#4
0
 private void PaisesForm_Load(object sender, EventArgs e)
 {
     this.Dock = DockStyle.Fill;
     try
     {
         servicio = new ServicioPais();
         lista    = servicio.GetLista();
         MostrarDatosEnGrilla();
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Error",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
示例#5
0
        private void PaisForm_Load_1(object sender, EventArgs e)
        {
            try
            {
                servicio = new ServicioPais();
                lista = servicio.GetPais();
                MostraDatosEnGrilla();
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message, "Error",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
            }
        }
示例#6
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ServicioPais servicioPais = new ServicioPais();

            ComboBoxPais.DataSource = null;
            List <Pais> lista         = servicioPais.GetLista();
            var         defaultMedida = new Pais {
                PaisID = 0, pais = "[Seleccione]"
            };

            lista.Insert(0, defaultMedida);
            ComboBoxPais.DataSource    = lista;
            ComboBoxPais.DisplayMember = "pais";
            ComboBoxPais.ValueMember   = "PaisID";
            ComboBoxPais.SelectedIndex = 0;
            if (provincia != null)
            {
                ComboBoxPais.SelectedValue = provincia.Pais.PaisID;
                textBoxProvincia.Text      = provincia.provincia;
                _esEdicion = true;
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            ServicioPais servicioPais = new ServicioPais();
            var          listaPais    = servicioPais.GetPais();
            var          defaultPais  = new Pais
            {
                PaisId     = 0,
                NombrePais = "<Seleccione Pais>"
            };

            listaPais.Insert(0, defaultPais);
            PaisMetroComboBox.DataSource    = listaPais;
            PaisMetroComboBox.DisplayMember = "NombrePais";
            PaisMetroComboBox.ValueMember   = "PaisId";
            PaisMetroComboBox.SelectedIndex = 0;


            if (editorial != null)
            {
                EditorialMetroTextBox.Text      = editorial.NombreEditorial;
                PaisMetroComboBox.SelectedValue = editorial.Pais.PaisId;
            }
        }
示例#8
0
 private void Iniciar()
 {
     _servicio = new ServicioPais();
     _lista    = _servicio.GetLista();
     MostrarEnGrilla();
 }