Example #1
0
        private void DGDatEsp_Drop(object sender, DragEventArgs e)
        {
            if (FilaPrev < 0)
            {
                return;
            }
            int index = GetDataGridItemCurrentRowIndex(e.GetPosition);

            if (index < 0)
            {
                return;
            }
            if (index == FilaPrev)
            {
                return;
            }
            if (index == DGDatEsp.Items.Count - 1)
            {
                MessageBox.Show(StrMenDrop);
                return;
            }
            ClsDatDG movedEmps = Requisito.DatosEspeci[FilaPrev];

            Requisito.DatosEspeci.RemoveAt(FilaPrev);
            Requisito.DatosEspeci.Insert(index, movedEmps);
        }
Example #2
0
 private void DGDrop(object sender, DragEventArgs e)
 {
     ctrl = (Control)sender;
     if (ctrl.Name.Equals("DGSecNor"))
     {
         if (FilaPrevN < 0)
         {
             return;
         }
         int index = GetDataGridItemCurrentRowIndex(e.GetPosition, ctrl);
         if (index < 0)
         {
             return;
         }
         if (index == FilaPrevN)
         {
             return;
         }
         if (index == DGSecNor.Items.Count - 1)
         {
             MessageBox.Show(StrMenDrop);
             return;
         }
         ClsDatDG movedEmps = Requisito.SecNormal[FilaPrevN];
         Requisito.SecNormal.RemoveAt(FilaPrevN);
         Requisito.SecNormal.Insert(index, movedEmps);
     }
     else
     {
         if (FilaPrevE < 0)
         {
             return;
         }
         int index = GetDataGridItemCurrentRowIndex(e.GetPosition, ctrl);
         if (index < 0)
         {
             return;
         }
         if (index == FilaPrevE)
         {
             return;
         }
         if (index == DGSecExc.Items.Count - 1)
         {
             MessageBox.Show(StrMenDrop);
             return;
         }
         ClsDatDG movedEmps = Requisito.SecExcepc[FilaPrevE];
         Requisito.SecExcepc.RemoveAt(FilaPrevE);
         Requisito.SecExcepc.Insert(index, movedEmps);
     }
 }
Example #3
0
 private void DGPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     ctrl = (Control)sender;
     if (ctrl.Name == "DGSecNor")
     {
         FilaPrevN = GetDataGridItemCurrentRowIndex(e.GetPosition, ctrl);
         if (FilaPrevN < 0)
         {
             return;
         }
         DGSecNor.SelectedIndex = FilaPrevN;
         ClsDatDG selectedEmp = DGSecNor.Items[FilaPrevN] as ClsDatDG;
         if (selectedEmp == null)
         {
             return;
         }
         DragDropEffects dragdropeffects = DragDropEffects.Move;
         if (DragDrop.DoDragDrop(DGSecNor, selectedEmp, dragdropeffects) != DragDropEffects.None)
         {
             DGSecNor.SelectedItem = selectedEmp;
         }
     }
     else
     {
         FilaPrevE = GetDataGridItemCurrentRowIndex(e.GetPosition, ctrl);
         if (FilaPrevE < 0)
         {
             return;
         }
         DGSecExc.SelectedIndex = FilaPrevE;
         ClsDatDG selectedEmp = DGSecExc.Items[FilaPrevE] as ClsDatDG;
         if (selectedEmp == null)
         {
             return;
         }
         DragDropEffects dragdropeffects = DragDropEffects.Move;
         if (DragDrop.DoDragDrop(DGSecExc, selectedEmp, dragdropeffects) != DragDropEffects.None)
         {
             DGSecExc.SelectedItem = selectedEmp;
         }
     }
 }
Example #4
0
        private void DGDatEsp_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            FilaPrev = GetDataGridItemCurrentRowIndex(e.GetPosition);
            if (FilaPrev < 0)
            {
                return;
            }
            DGDatEsp.SelectedIndex = FilaPrev;
            ClsDatDG selectedEmp = DGDatEsp.Items[FilaPrev] as ClsDatDG;

            if (selectedEmp == null)
            {
                return;
            }
            DragDropEffects dragdropeffects = DragDropEffects.Move;

            if (DragDrop.DoDragDrop(DGDatEsp, selectedEmp, dragdropeffects) != DragDropEffects.None)
            {
                DGDatEsp.SelectedItem = selectedEmp;
            }
        }