Exemplo n.º 1
0
        private void radGridView_CellEditEnded(object sender, Telerik.Windows.Controls.GridViewCellEditEndedEventArgs e)
        {
            CATALOGO_CIRUGIAS editedCirugia = e.Cell.DataContext as CATALOGO_CIRUGIAS;
            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();
        }
Exemplo n.º 2
0
        private void guardar()
        {
            if (txtNombre.Text == "")
            {
                System.Windows.MessageBox.Show("Ingrese el nombre de la cirugía");
            }
            else
            {
                if (txtDescripcion.Text == "")
                {
                    System.Windows.MessageBox.Show("Ingrese una Descripción");
                }
                else
                {
                    if (txtCosto.Text == "")
                    {
                        System.Windows.MessageBox.Show("Ingrese el costo de la cirugía");
                    }
                    else
                    {
                        DateTime fec = DateTime.Now;

                        CATALOGO_CIRUGIAS cciru = new CATALOGO_CIRUGIAS
                        {
                            NOMBRE_CIRUGIA = txtNombre.Text,
                            DESCRIPCION    = txtDescripcion.Text,
                            COSTO          = Decimal.Parse(txtCosto.Text),
                            FECHA_CREACION = fec,
                            ESTATUS        = "Activo"
                        };

                        BaseDatos.GetBaseDatos().CATALOGO_CIRUGIAS.Add(cciru);
                        BaseDatos.GetBaseDatos().SaveChanges();
                        System.Windows.MessageBox.Show("Registro exitoso, se ha guardado correctamente");

                        txtNombre.Text      = String.Empty;
                        txtDescripcion.Text = String.Empty;
                        txtCosto.Text       = String.Empty;
                    }
                }
            }
        }