Example #1
0
        private void Btn_Aceptar_Click(object sender, EventArgs e)
        {
            try
            {
                Datos.Obra_social OS = new Datos.Obra_social();

                OS.Id_Obra_Social            = (int)id_Obra_SocialNumericUpDown.Value;
                OS.Descripcion_Obra_Social   = descripcion_Obra_SocialTextBox.Text;
                OS.Observaciones_Obra_Social = observaciones_Obra_SocialTextBox.Text;

                if (id_Obra_SocialNumericUpDown.Value == 0)
                {
                    Datos.Obra_social.Add(OS);
                    MessageBox.Show("Se ha agregado un nuevo registro.");
                }
                else
                {
                    Datos.Obra_social.Set(OS);
                    MessageBox.Show("Se ha modificado correctamente el registro.");
                }
                Close();
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }
Example #2
0
        public FrmObrasSocialesABM(string IdObraSocial)
        {
            InitializeComponent();
            try
            {
                //Busco el una unica fila por su id
                Datos.Obra_social OS = Datos.Obra_social.GetObra_social(IdObraSocial, "").ListaObra_social[0];

                id_Obra_SocialNumericUpDown.Value     = OS.Id_Obra_Social;
                descripcion_Obra_SocialTextBox.Text   = OS.Descripcion_Obra_Social;
                observaciones_Obra_SocialTextBox.Text = OS.Observaciones_Obra_Social;
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }
Example #3
0
        private void Buscar()
        {
            try
            {
                //Borro todo las filas y columnas anteriores
                DG_Datos.Columns.Clear();
                DG_Datos.Rows.Clear();

                //Busco la lista de datos
                Datos.Obra_social OS = Datos.Obra_social.GetObra_social(Txt_Id.Text, Txt_ObraSocial.Text);

                //Agrego las columnas de la regilla de datos.
                DG_Datos.Columns.Add("Clm_Descripcion", "DescripciĆ³n");
                DG_Datos.Columns.Add("Clm_Observaciones", "Observaciones");

                DG_Datos.Font = new Font(Config.NombreFont, Config.TamaƱoFont);
                DG_Datos.Columns["Clm_Descripcion"].AutoSizeMode   = DataGridViewAutoSizeColumnMode.AllCells;
                DG_Datos.Columns["Clm_Observaciones"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;

                //Agrego las filas
                foreach (Datos.Obra_social ItemObra_social in OS.ListaObra_social)
                {
                    DG_Datos.Rows.Add();
                    DG_Datos.Rows[DG_Datos.Rows.Count - 1].Tag = ItemObra_social.Id_Obra_Social;

                    DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Descripcion"].Value   = ItemObra_social.Descripcion_Obra_Social;
                    DG_Datos.Rows[DG_Datos.Rows.Count - 1].Cells["Clm_Observaciones"].Value = ItemObra_social.Observaciones_Obra_Social;
                }

                Txt_CantidadRegistros.Text = OS.ListaObra_social.Count.ToString();

                if (NumeroFilaUltimaSeleccion != 0 && DG_Datos.Rows.Count > NumeroFilaUltimaSeleccion)
                {
                    DG_Datos.Rows[NumeroFilaUltimaSeleccion].Selected = true;
                }
            }
            catch (Exception Error)
            {
                MessageBox.Show(Error.Message);
            }
        }