//MEtodo Guardar un nuevo Cuarto
        public void Guardar()
        {
            if (txtNombre.Text == "")
            {
                System.Windows.MessageBox.Show("Inserta el nombre de la especialidad");
            }
            else
            {
                if (txtDescripcion.Text == "")
                {
                    System.Windows.MessageBox.Show("Inserta la Descripcion");
                }
                else
                {
                    DateTime fec = DateTime.Now;

                    CATALOGO_ESPECIALIDADES cespe = new CATALOGO_ESPECIALIDADES
                    {
                        NOMBRE_ESPECIALIDAD = txtNombre.Text,
                        DESCRIPCION         = txtDescripcion.Text,
                        FECHA_CREACION      = fec
                    };
                    BaseDatos.GetBaseDatos().CATALOGO_ESPECIALIDADES.Add(cespe);
                    BaseDatos.GetBaseDatos().SaveChanges();
                    System.Windows.MessageBox.Show("Se ha guardado CORRECTAMENTE");

                    txtNombre.Text      = String.Empty;
                    txtDescripcion.Text = String.Empty;
                }
            }
        }
        //MEtodo Guardar un nuevo Cuarto
        public void Guardar()
        {
            if (txtNombre.Text == "")
            {
                System.Windows.MessageBox.Show("Inserta el nombre de la especialidad");
            }
            else
            {
                if (txtDescripcion.Text == "")
                {
                    System.Windows.MessageBox.Show("Inserta la Descripción");
                }
                else
                {
                    DateTime fec = DateTime.Now;

                    CATALOGO_ESPECIALIDADES cespe = new CATALOGO_ESPECIALIDADES
                    {
                        NOMBRE_ESPECIALIDAD = txtNombre.Text,
                        DESCRIPCION         = txtDescripcion.Text,
                        FECHA_CREACION      = fec,
                        STATUS = "Activo"
                    };
                    BaseDatos.GetBaseDatos().CATALOGO_ESPECIALIDADES.Add(cespe);
                    BaseDatos.GetBaseDatos().SaveChanges();
                    System.Windows.MessageBox.Show("Registro exitoso se ha guardado correctamente");

                    txtNombre.Text      = String.Empty;
                    txtDescripcion.Text = String.Empty;
                }
            }
        }
Exemplo n.º 3
0
        public NuevaEspecialidadMedico(CATALOGO_ESPECIALIDADES especialidad, bool save)
        {
            InitializeComponent();
            idespci             = especialidad.ID_CATALOGO_ESPECIALIDAD;
            txtNombre.Text      = especialidad.NOMBRE_ESPECIALIDAD;
            txtDescripcion.Text = especialidad.DESCRIPCION;

            btnGuardar.Visibility = Visibility.Hidden;
            btnEditar.Visibility  = Visibility.Visible;
        }