Exemplo n.º 1
0
        private void DataGridViewEmployee_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int rowIndex   = e.RowIndex;
            int employeeId = int.Parse(DataGridViewEmployee.Rows[rowIndex].Cells[0].Value.ToString());
            EmployeeDataLogic employeeDataLogic = new EmployeeDataLogic();
            bool result = employeeDataLogic.GetEmployeeInfo(employeeId, out EmployeeName, out UserName, out Email, out IsActive, out SystemGenerate, out RoleId, out PasswordSalt, out IsApproved, out CreateDate, out IsLockedOut, out Contact, out Password);

            if (result == true)
            {
                EmployeeAddForm employeeAddForm = new EmployeeAddForm()
                {
                    MdiParent = this.Parent.FindForm()
                };
                projectAddForm.projectName        = projectName;
                projectAddForm.projectDescription = projectDescription;
                projectAddForm.isActive           = isActive;
                projectAddForm.isSystemGenerated  = isSystemGenerated;
                projectAddForm.projectId          = projectId;
                this.Hide();
                projectAddForm.Show();
            }
            else
            {
                MessageBox.Show("No Valid Information Found!", "Error!");
            }
        }
        private void buttonSav_Click(object sender, EventArgs e)
        {
            EmployeeDataLogic employeeDataLogic = new EmployeeDataLogic();

            EmployeeName = textBoxName.Text.Trim();
            Contact      = textBoxCont.Text.Trim();
            Email        = textBoxGmail.Text.Trim();
            RoleId       = textBoxID.Text.Trim();
            UserName     = textBoxUsernam.Text.Trim();
            Password     = textBoxPass.Text.Trim();
            PasswordSalt = textBoxPassSalt.Text.Trim();
            CreateDate   = textBoxCreateDate.Text.Trim();
            string isactive = comboBoxActive.SelectedValue.ToString();

            IsActive = isactive == "0" ? false : true;
            string approval = comboBoxApprove.SelectedValue.ToString();

            IsApproved = approval == "0" ? false : true;
            string isLockedOut = comboBoxLocked.SelectedValue.ToString();

            IsLockedOut = isLockedOut == "0" ? false : true;
            bool result = employeeDataLogic.AddEmployee(EmployeeName, Contact, Email, RoleId, IsActive, UserName, Password, PasswordSalt, CreateDate, IsApproved, IsLockedOut, SystemGenerate);

            if (result == true)
            {
                MessageBox.Show("Success!");
                EmployeeListForm employeeListForm = new EmployeeListForm();
                this.Hide();
                employeeListForm.Show();
            }
            else
            {
                MessageBox.Show("Error!");
            }
        }
Exemplo n.º 3
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            EmployeeDataLogic employeeDataLogic = new EmployeeDataLogic();

            Employeename = textBoxFullName.Text.Trim();
            Contact      = textBoxContact.Text.Trim();
            Email        = textBoxEmail.Text.Trim();
            RoleId       = textBoxRollId.Text.Trim();
            UserName     = textBoxUserName.Text.Trim();
            Password     = textBoxPassword.Text.Trim();
            PasswordSalt = textBoxPasswordSalt.Text.Trim();
            CreateDate   = textBoxDate.Text.Trim();
            string isactive = comboBoxIsActive.SelectedValue.ToString();

            IsActive = isactive == "0" ? false : true;
            string isapproved = comboBoxApproved.SelectedValue.ToString();

            IsApproved = isapproved == "0" ? false : true;
            string islockedout = comboBoxLockedOut.SelectedValue.ToString();

            IsLockedout = islockedout == "0" ? false : true;
            bool result = employeeDataLogic.UpdateEmployee(employeeId, Employeename, Contact, Email, RoleId, IsActive, UserName, Password, PasswordSalt, CreateDate, IsApproved, IsLockedout, IsSystemGenerated);

            if (result == true)
            {
                MessageBox.Show("Success!");
                Employeelistform employeeListForm = new Employeelistform();
                this.Hide();
                employeeListForm.Show();
            }
            else
            {
                MessageBox.Show("Error!");
            }
        }
Exemplo n.º 4
0
        private void EmployeeListForm_Load(object sender, EventArgs e)
        {
            EmployeeDataLogic employeeDataLogic = new EmployeeDataLogic();
            DataTable         dataTable         = new DataTable();

            dataTable = employeeDataLogic.GetEmployeeList();
            DataGridViewEmployee.DataSource = dataTable;
            this.ControlBox = false;
        }