Beispiel #1
0
        /**
         *  Author      | Arcelia Aguirre
         *  Description | Agregar un usuario
         *  Date        | 23-02-2018
         *  Parameters  | object sender, EventArgs e
         */
        private void btn_userSave_Click(object sender, EventArgs e)
        {
            TextBox[]  component = { txt_nameUser, txt_passwordUser, txt_fatherLastnameUser };
            ComboBox[] comboBox  = { cmbbx_typeUser };
            UserCICE   userCICE  = new UserCICE();

            if (!PROPS.emptyComponent(component, (int)PROPS.COMPONENT.COMPONENT_TEXT_BOX))
            {
                return;
            }
            if (!PROPS.emptyComponent(comboBox, (int)PROPS.COMPONENT.COMPONENT_COMBO_BOX))
            {
                return;
            }
            component = new TextBox[] { txt_idUser, txt_nameUser, txt_passwordUser, txt_fatherLastnameUser, txt_motherLastnameUser };
            if (txt_idUser.Text == PROPS.EMPTY)
            {
                userCICE.save(txt_nameUser.Text, txt_passwordUser.Text, txt_fatherLastnameUser.Text, txt_motherLastnameUser.Text, Int32.Parse(cmbbx_typeUser.SelectedValue.ToString()));
            }
            else
            {
                userCICE.update(Int32.Parse(txt_idUser.Text), txt_nameUser.Text, txt_passwordUser.Text, PROPS.EMPTY, txt_fatherLastnameUser.Text, txt_motherLastnameUser.Text, Int32.Parse(cmbbx_typeUser.SelectedValue.ToString()));
            }
            PROPS.clear(component, (int)PROPS.COMPONENT.COMPONENT_TEXT_BOX);
            PROPS.clear(component, (int)PROPS.COMPONENT.COMPONENT_COMBO_BOX);
            userCICE.load_dtgdUser(ds, dtgd_user);
        }
        /**
         *  Author      | Arcelia Aguirre
         *  Date        | 09-03-2018
         *  Description | Funcion al iniciar sesion
         */
        private void Login()
        {
            DataTable dt       = new DataTable();
            UserCICE  userCICE = new UserCICE();

            /*Validación*/
            TextBox[] component = { txt_name, txt_password };
            if (!PROPS.emptyComponent(component, (int)PROPS.COMPONENT.COMPONENT_TEXT_BOX))
            {
                return;
            }

            //dt =  userCICE.login(txt_name.Text, txt_password.Text);
            //if (dt != null)
            //{
            //    if (dt.Rows.Count == 0)
            //        MessageBox.Show("Usuario o Password Incorrectos");
            //    else
            //    {
            //        frm_signIn frm_checkIn = new frm_signIn();
            //        frm_checkIn.Show();
            //    }
            //}
            /*Quitar*/
            frm_signIn frm_checkIn2 = new frm_signIn();

            frm_checkIn2.Show();
        }
Beispiel #3
0
        /**
         *  Author      | Arcelia Aguirre
         *  Description | Inicializar el form
         *  Date        | 23-02-2018
         *  Parameters  | object sender, EventArgs e
         */
        private void frm_signIn_Load(object sender, EventArgs e)
        {
            TypeUser       typeUser       = new TypeUser();
            TypeNotStudent typeNotStudent = new TypeNotStudent();
            Career         career         = new Career();
            UserCICE       userCICE       = new UserCICE();

            Student.Student student = new Student.Student();
            try
            {
                /*Combobox*/
                typeUser.load_cmbbxTypeUser(ds, cmbbx_typeUser);
                typeNotStudent.load_cmbbxReport(ds, cmbbx_report);
                typeNotStudent.load_cmbbxReport(ds, cmbbx_type);
                typeNotStudent.load_cmbbxReport(ds, cmbbx_typeRegister);
                career.load_cmbbxCarrer(ds, cmbbx_carrer);
                career.load_cmbbxCarrer(ds, cmbbox_careerStudent);
                DataTable dt = cmbbx_typeRegister.DataSource as DataTable;

                DataRow row = dt.NewRow();
                row["description_typeNotStudent"] = "Alumno";
                dt.Rows.Add(row);

                cmbbx_typeRegister.SelectedIndex = cmbbx_typeRegister.Items.Count - 1;
                /*Grid*/
                career.load_dtgdCareer(ds, dtgd_career);
                typeNotStudent.load_dtgdTypeNotStudent(ds, dtgd_typeNotStudent);
                typeUser.load_dtgdTypeUser(ds, dtgd_typeUser);
                userCICE.load_dtgdUser(ds, dtgd_user);
                student.load_dtgdStudent(ds, dtgd_student);

                /*DataBase*/
                DataBaseSettings dataBaseSettings = new DataBaseSettings();
                btn_create.Enabled = dataBaseSettings.ifExist().Rows.Count == 0 ? true : false;
                btn_drop.Enabled   = !btn_create.Enabled;
            }
            catch
            {
                Button[] component = { btn_create, btn_drop, btn_seeder, btn_delete, btn_deleteDuplicate };
                PROPS.enableButton(component);
                //PROPS.messageError("");
            }
        }
Beispiel #4
0
        /**
         *  Author      | Arcelia Aguirre
         *  Description | Datos para eliminar y modificar usuarios
         *  Date        | 28-02-2018
         *  Parameters  | object sender, DataGridViewCellEventArgs e
         */
        private void dtgd_user_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            TextBox[] component = { txt_idUser, txt_nameUser, txt_passwordUser, txt_fatherLastnameUser, txt_motherLastnameUser };
            UserCICE  userCICE  = new UserCICE();

            PROPS.clear(component, (int)PROPS.COMPONENT.COMPONENT_TEXT_BOX);
            if (this.dtgd_user.Columns[e.ColumnIndex].Name.Equals("delete_user"))
            {
                if (MessageBox.Show("¿Seguro que quieres borrar el Usuario?", "Borrar", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    userCICE.delete(Int32.Parse(dtgd_user.CurrentRow.Cells["id_user"].Value.ToString()));
                }
                userCICE.load_dtgdUser(ds, dtgd_user);
                return;
            }
            else if (this.dtgd_user.Columns[e.ColumnIndex].Name.Equals("edit_user"))
            {
                txt_idUser.Text              = dtgd_user.CurrentRow.Cells["id_user"].Value.ToString();
                txt_nameUser.Text            = dtgd_user.CurrentRow.Cells["name_user"].Value.ToString();
                cmbbx_typeUser.SelectedValue = Int32.Parse(dtgd_user.CurrentRow.Cells["id_type_user"].Value.ToString());
                txt_fatherLastnameUser.Text  = dtgd_user.CurrentRow.Cells["fatherLastName_user"].Value.ToString();
                txt_motherLastnameUser.Text  = dtgd_user.CurrentRow.Cells["motherLastName_user"].Value.ToString();
            }
        }