//this method provides the navigation to project dashboard by selecting a project from the datagrid view private void projectDataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { //if employee has a manager access level only then allow to navigate to project dashboard if (access.ToUpper() == Employee.Manager()) { //get the rowindex of the current selected cell int rowIndex = projectDataGridView.CurrentCell.RowIndex; //set the selection for the entire row with the same rowindex projectDataGridView.Rows[rowIndex].Selected = true; //get the project name from the row with the same rowindex string projectName = projectDataGridView.Rows[rowIndex].Cells[1].Value.ToString(); //navigate to the project dashboard by supplying the project name. frmProjectDashboard projectDashboard = new frmProjectDashboard(projectName); //close the form with a fade out effect. Navigation.FadeOut(this, 50); projectDashboard.Show(); } }
//public async Task ClosePreviousAsync(Form form) //{ // await Task.Delay(1); // form.Close(); //} //Navigate to other pages based in menuselection internal static void Navigate(Form source, string menuSelection) { if (menuSelection.ToUpper() == USER_DASHBOARD.ToUpper()) { FadeOut(source, 50); frmUserDashboard userDashboard = new frmUserDashboard(); userDashboard.Show(); } else if (menuSelection.ToUpper() == USERWISE_REPORT.ToUpper()) { FadeOut(source, 50); frmUserwiseReport userwiseReport = new frmUserwiseReport(); userwiseReport.Show(); } else if (menuSelection.ToUpper() == PROJECTWISE_REPORT.ToUpper()) { FadeOut(source, 50); frmProjectwiseReport projectwiseReport = new frmProjectwiseReport(); projectwiseReport.Show(); } else if (menuSelection.ToUpper() == LOGIN.ToUpper()) { FadeOut(source, 50); frmLogin login = new frmLogin(); login.Show(); } else if (menuSelection.ToUpper() == CLOCK.ToUpper()) { FadeOut(source, 50); frmEmployeeClock employeeClock = new frmEmployeeClock(); employeeClock.Show(); } else if (menuSelection.ToUpper() == PROJECT_BULKCREATION.ToUpper()) { FadeOut(source, 50); frmProjectBulkCreation projectBulkCreation = new frmProjectBulkCreation(); projectBulkCreation.Show(); } else if (menuSelection.ToUpper() == PROJECT_CREATION.ToUpper()) { FadeOut(source, 50); frmProjectCreation projectCreation = new frmProjectCreation(); projectCreation.Show(); } else if (menuSelection.ToUpper() == ACCESS_DENIED.ToUpper()) { FadeOut(source, 50); frmAccessDenied accessDenied = new frmAccessDenied(); accessDenied.Show(); } else if (menuSelection.ToUpper() == PROJECT_DASHBOARD.ToUpper()) { FadeOut(source, 50); frmProjectDashboard projectDashboard = new frmProjectDashboard(); projectDashboard.Show(); } else { //Do nothing } }