public void EditEducacion(DEducacion Edu)
        {
            Edu.idEmpleado = Empleado.idEmpleado;
            var resp = methodEdu.Editar(Edu);

            RefreshDGEducacion();
        }
        void fillData()
        {
            if (Validate())
            {
                UForm = null;
                return;
            }

            string   nombreCarrera     = txtNombreCarrera.Text;
            string   nombreInstitucion = txtNombreInstitucion.Text;
            DateTime fechaingreso      = CbFechaIngreso.SelectedDate ?? DateTime.Now;

            if (fechaingreso == DateTime.Now)
            {
                return;
            }
            DateTime?fechaEgreso = CbFechaEgreso.SelectedDate;

            UForm = new DEducacion(0,
                                   Menu.ActUsuario.idUsuario,
                                   nombreCarrera,
                                   nombreInstitucion,
                                   fechaingreso,
                                   fechaEgreso);
        }
示例#3
0
        public string Editar(DEducacion Educacion)
        {
            try
            {
                Conexion.ConexionSql.Open();

                using SqlCommand comm = new SqlCommand(queryUpdate, Conexion.ConexionSql);
                comm.Parameters.AddWithValue("@idEmpleado", Educacion.idEmpleado);
                comm.Parameters.AddWithValue("@nombreCarrera", Educacion.nombreCarrera);
                comm.Parameters.AddWithValue("@nombreInstitucion", Educacion.nombreInstitucion);
                comm.Parameters.AddWithValue("@fechaIngreso", Educacion.fechaIngreso);
                if (Educacion.fechaEgreso != null)
                {
                    comm.Parameters.AddWithValue("@fechaEgreso", Educacion.fechaEgreso);
                }
                else
                {
                    comm.Parameters.AddWithValue("@fechaEgreso", DBNull.Value);
                }
                comm.Parameters.AddWithValue("@idEducacion", Educacion.idEducacion);

                return(comm.ExecuteNonQuery() == 1 ? "OK" : "No se actualizo el Registro de la educacion");
            }
            catch (SqlException e) { return(e.Message); }
            finally { if (Conexion.ConexionSql.State == ConnectionState.Open)
                      {
                          Conexion.ConexionSql.Close();
                      }
            }
        }
        public void EditEducacion(DEducacion Edu, int id)
        {
            ListaEducacion[id] = Edu;


            RefreshDGEducacion();
        }
        public void InsertEducacion(DEducacion Edu)
        {
            ListaEducacion.Add(Edu);


            RefreshDGEducacion();
        }
 void fillForm(DEducacion Data)
 {
     if (Data != null)
     {
         txtNombreCarrera.Text       = Data.nombreCarrera;
         txtNombreInstitucion.Text   = Data.nombreInstitucion;
         CbFechaIngreso.SelectedDate = Data.fechaIngreso;
         CbFechaEgreso.SelectedDate  = Data.fechaEgreso;
         ChBNotEnded.IsChecked       = Data.fechaEgreso == null;
     }
 }
        private void BtnEduUpdate_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("ACTUALIZANDO" + ((Button)e.Source).CommandParameter);

            DEducacion resp = ListaEducacion[(int)((Button)e.Source).CommandParameter];

            EducacionFrm frm = new EducacionFrm(this);

            frm.Type     = TypeForm.Update;
            frm.DataFill = resp;
            frm.ShowDialog();
        }
        private void BtnEduUpdate_Click(object sender, RoutedEventArgs e)
        {
            Console.WriteLine("ACTUALIZANDO" + ((Button)e.Source).CommandParameter);

            DEducacion resp = methodEdu.Encontrar((int)((Button)e.Source).CommandParameter)[0];

            EducacionFrm frm = new EducacionFrm(Empleado);

            frm.Type     = TypeForm.Update;
            frm.DataFill = resp;
            frm.ShowDialog();
            RefreshDGEducacion();
        }
        public void InsertEducacion(DEducacion Edu)
        {
            Edu.idEmpleado = Empleado.idEmpleado;
            var resp = methodEdu.Insertar(Edu);

            if (resp == "OK")
            {
                MAuditoria.Insertar(new DAuditoria(
                                        Menu.ActUsuario.idUsuario,
                                        DAuditoria.Registrar,
                                        "Se ha registrado un Educación del empleado Nº" + Empleado.idEmpleado));

                MessageBox.Show("Registro completado!", "SwissNet", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
        Border CreateRowEdu(DEducacion DED)
        {
            Border MainBord = new Border();

            MainBord.BorderBrush     = Brushes.Black;
            MainBord.BorderThickness = new Thickness(0);

            Grid Divider = new Grid();

            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            }
                );
            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            }
                );
            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            }
                );


            StackPanel SPContent = new StackPanel();

            SPContent.SetValue(Grid.ColumnProperty, 1);
            SPContent.MaxHeight = 50;

            Divider.Children.Add(SPContent);

            TextBlock NameText = new TextBlock();

            NameText.Text         = DED.nombreCarrera;
            NameText.MaxHeight    = 35;
            NameText.TextWrapping = TextWrapping.Wrap;
            NameText.TextTrimming = TextTrimming.CharacterEllipsis;
            NameText.FontWeight   = FontWeights.Bold;
            NameText.FontSize     = 12;
            NameText.Margin       = new Thickness(5, 0, 5, 0);

            SPContent.Children.Add(NameText);

            string egreso = DED.fechaEgreso == null ? "Actualidad" : DED.fechaEgreso?.Year.ToString();

            TextBlock DateText = new TextBlock();

            DateText.Text         = DED.fechaIngreso.Year + " - " + egreso;
            DateText.FontSize     = 10;
            DateText.TextWrapping = TextWrapping.Wrap;
            DateText.TextTrimming = TextTrimming.CharacterEllipsis;
            DateText.Margin       = new Thickness(5, 0, 5, 0);

            SPContent.Children.Add(DateText);

            MainBord.Child = Divider;

            return(MainBord);
        }
        Border CreateRowEdu(DEducacion DED)
        {
            Border MainBord = new Border();

            MainBord.BorderBrush     = Brushes.Black;
            MainBord.BorderThickness = new Thickness(0);

            Grid Divider = new Grid();

            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            }
                );
            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Star)
            }
                );
            Divider.ColumnDefinitions.Add(
                new ColumnDefinition()
            {
                Width = new GridLength(1, GridUnitType.Auto)
            }
                );

            Button DeleteButton = new Button();

            DeleteButton.SetValue(Grid.ColumnProperty, 0);
            DeleteButton.Background = DeleteButton.BorderBrush = Brushes.Transparent;
            DeleteButton.Margin     = new Thickness(10, 2, 10, 2);
            DeleteButton.Padding    = new Thickness(0);
            DeleteButton.Height     = 17;
            Image  delImg  = new Image();
            string packUri = @"/Img/delete.png";

            delImg.Source = new BitmapImage(new Uri(packUri, UriKind.Relative));
            RenderOptions.SetBitmapScalingMode(delImg, BitmapScalingMode.HighQuality);
            DeleteButton.Click           += new RoutedEventHandler(BtnEduDelete_Click);
            DeleteButton.CommandParameter = DED.idEducacion;
            DeleteButton.Content          = delImg;
            DeleteButton.Foreground       = Brushes.Black;

            Divider.Children.Add(DeleteButton);

            StackPanel SPContent = new StackPanel();

            SPContent.SetValue(Grid.ColumnProperty, 1);
            SPContent.MaxHeight = 50;

            Divider.Children.Add(SPContent);

            TextBlock NameText = new TextBlock();

            NameText.Text         = DED.nombreCarrera;
            NameText.MaxHeight    = 35;
            NameText.TextWrapping = TextWrapping.Wrap;
            NameText.TextTrimming = TextTrimming.CharacterEllipsis;
            NameText.FontWeight   = FontWeights.Bold;
            NameText.FontSize     = 12;
            NameText.Margin       = new Thickness(5, 0, 5, 0);

            SPContent.Children.Add(NameText);

            string egreso = DED.fechaEgreso == null ? "Actualidad" : DED.fechaEgreso?.Year.ToString();

            TextBlock DateText = new TextBlock();

            DateText.Text         = DED.fechaIngreso.Year + " - " + egreso;
            DateText.FontSize     = 10;
            DateText.TextWrapping = TextWrapping.Wrap;
            DateText.TextTrimming = TextTrimming.CharacterEllipsis;
            DateText.Margin       = new Thickness(5, 0, 5, 0);

            SPContent.Children.Add(DateText);


            Button EditButton = new Button();

            EditButton.SetValue(Grid.ColumnProperty, 3);
            EditButton.Background = EditButton.BorderBrush = Brushes.Transparent;
            EditButton.Margin     = new Thickness(10, 3, 10, 3);
            EditButton.Padding    = new Thickness(0);
            EditButton.Height     = 23;
            Image  editImg  = new Image();
            string packUri2 = @"/Img/edit.png";

            editImg.Source              = new BitmapImage(new Uri(packUri2, UriKind.Relative));
            EditButton.Click           += new RoutedEventHandler(BtnEduUpdate_Click);
            EditButton.CommandParameter = DED.idEducacion;
            EditButton.Content          = editImg;
            EditButton.Foreground       = Brushes.Black;

            Divider.Children.Add(EditButton);

            MainBord.Child = Divider;

            return(MainBord);
        }