Esempio n. 1
0
        } //Clave de Método: Moves-MLM

        private void ControlClickMethod(object sender, EventArgs e)
        {
            try
            {
                for (; Index < ArrayControl.Length; Index++)
                {
                    if (ArrayControl[Index] == sender)
                    {
                        break;
                    }
                }
                switch (Index)
                {
                case 0:     // ButtonSearch
                {
                    if (TextBoxSearch.Visible)
                    {
                        if (ObjValidations.NumControlCheck(TextBoxSearch.TextTextBox.Trim()))
                        {
                            ObjSearch.NumControl = TextBoxSearch.TextTextBox.Trim();
                        }
                        else
                        {
                            throw new FormatException();
                        }
                    }
                    else
                    {
                        ObjSearch.NumControl = string.Empty;
                    }
                    if (RadioButtonAllDepartments.Checked || (!RadioButtonAllDepartments.Checked && !RadioButtonSearchDepartment.Checked) || !GroupBoxDepartment.Visible)
                    {
                        ObjSearch.IndexDeparmentStart = 0;
                        ObjSearch.IndexDeparmentEnd   = 30;
                    }
                    else
                    {
                        ObjSearch.IndexDeparmentStart = ComboTypeDepartment.SelectedIndex;
                        ObjSearch.IndexDeparmentEnd   = ComboTypeDepartment.SelectedIndex;
                    }
                    if (RadioButtonBothSex.Checked || (!RadioButtonBothSex.Checked && !RadioButtonMan.Checked && !RadioButtonWoman.Checked) || !GroupBoxSex.Visible)
                    {
                        ObjSearch.SexStart = 'M';
                        ObjSearch.SexEnd   = 'F';
                    }
                    else if (RadioButtonMan.Checked)
                    {
                        ObjSearch.SexStart = 'M';
                        ObjSearch.SexEnd   = 'M';
                    }
                    else
                    {
                        ObjSearch.SexStart = 'F';
                        ObjSearch.SexEnd   = 'F';
                    }
                    if (PanelDate.Visible)
                    {
                        ObjSearch.DateStart = DateTimePickerStart.Value;
                        ObjSearch.DateEnd   = DateTimePickerEnd.Value;
                    }
                    else
                    {
                        DateTimePickerStart.Value = DateTime.Parse("2000-01-01");
                        ObjSearch.DateEnd         = DateTimePickerEnd.Value;
                    }
                    ObjValidations.SearchMoves(TypeModules.Moves, ObjSearch);
                    PopUpGridSearch ObjPopUpGridSearch = new PopUpGridSearch(TypeModules.Moves, ObjSearch, "Búsqueda de Movimientos");
                    ObjPopUpGridSearch.Show();
                    break;
                }

                case 1:     // ButtonSearchAll
                {
                    ObjSearch.NumControl          = "";
                    ObjSearch.IndexDeparmentStart = 0;
                    ObjSearch.IndexDeparmentEnd   = 30;
                    ObjSearch.SexStart            = 'F';
                    ObjSearch.SexEnd          = 'M';
                    DateTimePickerStart.Value = DateTime.Parse("2000-01-01");
                    ObjSearch.DateEnd         = DateTimePickerEnd.Value;
                    ObjValidations.SearchMoves(TypeModules.Moves, ObjSearch);
                    PopUpGridSearch ObjPopUpGridSearch = new PopUpGridSearch(TypeModules.Moves, ObjSearch, "Búsqueda de Movimientos");
                    ObjPopUpGridSearch.Show();
                    break;
                }

                case 2:     //ButtonCleanSearch
                {
                    RadioButtonBothSex.Checked          = false;
                    RadioButtonMan.Checked              = false;
                    RadioButtonWoman.Checked            = false;
                    RadioButtonAllDepartments.Checked   = false;
                    RadioButtonSearchDepartment.Checked = false;
                    ComboTypeDepartment.Visible         = false;
                    DateTimePickerStart.Value           = DateTime.Now.AddMonths(-1);
                    DateTimePickerEnd.Value             = DateTime.Now;
                    break;
                }

                default:
                    throw new Exception("Excepción en Método: Moves-CCM", new IndexOutOfRangeException());
                }
            }
            catch (IndexOutOfRangeException)
            {
            }
            catch (FormatException)
            {
                using (Alerts ObjAlerts = new Alerts("Número de Control Invalido", "", "El número de control ingresado no es valido\n\nVereifique el texto que ingresó.", 1, "", "", "OK", TypeIcon.Warning))
                {
                    if (ObjAlerts.ShowDialog() == DialogResult.OK)
                    {
                        ObjAlerts.Close();
                        ObjAlerts.Dispose();
                    }
                }
            }
            Index = 0;
        } //Clave de Método: Moves-CCM
Esempio n. 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