Exemplo n.º 1
0
        private void radGridView_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
        {
            CATALOGO_EQUIPO_HOSPITAL editedEspecialidades = e.Cell.DataContext as CATALOGO_EQUIPO_HOSPITAL;
            string propertyName = e.Cell.Column.UniqueName;

            //MessageBox.Show(string.Format("La propiedad: {0} está editada y el nuevo valor es:  {1}", propertyName, e.NewData));
            BaseDatos.GetBaseDatos().SaveChanges();
        }
        //MEtodo Guardar Equipo hospital
        public void Guardar()
        {
            if (txtNombre.Text == "")
            {
                System.Windows.MessageBox.Show("Inserta el nombre del equipo de hospital");
            }
            else
            {
                if (txtDescripcion.Text == "")
                {
                    System.Windows.MessageBox.Show("Inserta la Descripción");
                }
                else
                {
                    if (txtCosto.Text == "")
                    {
                        System.Windows.MessageBox.Show("Inserta el Costo");
                    }
                    else
                    {
                        DateTime fec = DateTime.Now;

                        CATALOGO_EQUIPO_HOSPITAL c_e_h = new CATALOGO_EQUIPO_HOSPITAL
                        {
                            NOM_EQUIPO_HOSPITAL = txtNombre.Text,
                            DESCRIPCION         = txtDescripcion.Text,
                            COSTO          = Decimal.Parse(txtCosto.Text),
                            FECHA_CREACION = fec,
                            STATUS         = "Activo"
                        };
                        BaseDatos.GetBaseDatos().CATALOGO_EQUIPO_HOSPITAL.Add(c_e_h);
                        BaseDatos.GetBaseDatos().SaveChanges();
                        System.Windows.MessageBox.Show("Registro exitoso, se ha guardado CORRECTAMENTE");

                        Limpiar();

                        this.Close();
                    }
                }
            }
        }