Пример #1
0
        } //Clave de Método: Users-GSLDM

        private void GridSearchCellClickMethod(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == GridSearch.Columns["EDITAR"].Index)
                {
                    ObjModifyUsers.NumControl = GridSearch.Rows[e.RowIndex].Cells["NUMERO DE CONTROL"].Value.ToString().Trim();
                    if (GridSearch.Rows[e.RowIndex].Cells["NOMBRES"].Value.ToString().Contains(" "))
                    {
                        ObjModifyUsers.FirstName  = GridSearch.Rows[e.RowIndex].Cells["NOMBRES"].Value.ToString().Split(' ')[0].Trim();
                        ObjModifyUsers.SecondName = GridSearch.Rows[e.RowIndex].Cells["NOMBRES"].Value.ToString().Split(' ')[1].Trim();
                    }
                    else
                    {
                        ObjModifyUsers.FirstName  = GridSearch.Rows[e.RowIndex].Cells["NOMBRES"].Value.ToString().Trim();
                        ObjModifyUsers.SecondName = string.Empty;
                    }
                    ObjModifyUsers.FirstLastName  = (string.IsNullOrEmpty(GridSearch.Rows[e.RowIndex].Cells["APELLIDO PATERNO"].Value.ToString().Trim())) ? string.Empty : GridSearch.Rows[e.RowIndex].Cells["APELLIDO PATERNO"].Value.ToString();
                    ObjModifyUsers.SecondLastName = (string.IsNullOrEmpty(GridSearch.Rows[e.RowIndex].Cells["APELLIDO MATERNO"].Value.ToString().Trim())) ? string.Empty : GridSearch.Rows[e.RowIndex].Cells["APELLIDO MATERNO"].Value.ToString();
                    ObjModifyUsers.Sex            = Convert.ToChar(GridSearch.Rows[e.RowIndex].Cells["SEXO"].Value.ToString());
                    ObjModifyUsers.Department     = GridSearch.Rows[e.RowIndex].Cells["DEPARTAMENTO O CARRERA"].Value.ToString();
                    ObjModifyUsers.Status         = Convert.ToChar(GridSearch.Rows[e.RowIndex].Cells["STATUS"].Value.ToString());
                    using (PopUpUsers ObjPopUpUsers = new PopUpUsers(ObjModifyUsers))
                    {
                        if (ObjPopUpUsers.ShowDialog() == DialogResult.OK)
                        {
                            GridSearchLoadDataMethod();
                        }
                    }
                }
            }
            catch (ArgumentOutOfRangeException)
            {
            }
        } //Clave de Método: Users-GSCCM
Пример #2
0
        } //Clave de Método: Users-SIVM

        private void ControlClickMethod(object sender, EventArgs e)
        {
            for (; Index < ArrayControl.Length; Index++)
            {
                if (ArrayControl[Index] == sender)
                {
                    break;
                }
            }
            switch (Index)
            {
            case 0:     //ButtonNewUser
            {
                PopUpUsers ObjPopUpUsers = new PopUpUsers();
                ObjPopUpUsers.Show();
                break;
            }

            case 1:     //PictureBoxInfo
            {
                break;
            }

            case 2:     //ButtonCleanSearch
            {
                GridSearch.DataSource     = ObjValidations.GridSearchMethod(TypeModules.Users, TypeSearch.Users);
                LabelTotalResults.Text    = GridSearch.Rows.Count.ToString();
                TextBoxSearch.TextTextBox = string.Empty;
                GridSearch.Columns["EDITAR"].DisplayIndex = GridSearch.Columns.Count - 1;
                break;
            }

            case 3:     //ButtonSearch
            {
                bool Flag = false;
                try
                {
                    switch (ComboTypeSearch.SelectedIndex)
                    {
                    case 0:
                    case 1:
                    case 2:
                    case 3:
                    case 4:
                    {
                        Flag = !string.IsNullOrEmpty(TextBoxSearch.TextTextBox) ? true : false;
                        break;
                    }

                    case 5:
                    case 7:
                    {
                        Flag = RadioButtonOption1.Checked || RadioButtonOption2.Checked ? true : false;
                        break;
                    }

                    case 6:
                    {
                        Flag = ComboTypeDepartment.SelectedIndex > -1 ? true : false;
                        break;
                    }
                    }
                    if (Flag)
                    {
                        GridSearch.DataSource = ObjValidations.SearchUser(TypeModules.Users,
                                                                          (byte)ComboTypeSearch.SelectedIndex,
                                                                          TextBoxSearch.TextTextBox.Trim().ToUpper(),
                                                                          RadioButtonOption1.Checked ? 'M' : 'F',
                                                                          (byte)ComboTypeDepartment.SelectedIndex,
                                                                          RadioButtonOption1.Checked ? 'A' : 'I');
                        GridSearch.Columns["EDITAR"].DisplayIndex = GridSearch.Columns.Count - 1;
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    using (Alerts ObjAlerts = new Alerts("Búsqueda Fallida", "", "Parece que ser que la búsqueda no se pudo completar.\nPor favor, revise los siguientes puntos:\n1. Es necesario que eliga un filtro de búsqueda."
                                                         + "\n2. Ingrese un texto a buscar o seleccione una opción de búsqueda..\n3. Haga clic en el botón de búsqueda (lupa).", 1, "", "", "OK", TypeIcon.Warning))
                    {
                        if (ObjAlerts.ShowDialog() == DialogResult.OK)
                        {
                            ObjAlerts.Close();
                            ObjAlerts.Dispose();
                        }
                    }
                }
                break;
            }

            default:
                throw new Exception("Excepción en Método: Users-CCM", new IndexOutOfRangeException());
            }
            Index = 0;
        } //Clave de Método: Users-CCM