/// <summary> /// Fills the Project Name dropdown /// </summary> private void FillProjectNameDropDown() { // Initialise Collection class object BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); // Initialise Business layer object Rave.HR.BusinessLayer.MRF.MRFDetail mrfProjectName = new Rave.HR.BusinessLayer.MRF.MRFDetail(); try { // Call the Business layer method raveHRCollection = mrfProjectName.GetProjectName(); DataSet dsProject = null; Rave.HR.BusinessLayer.FourC.FourC fourCBAL = new Rave.HR.BusinessLayer.FourC.FourC(); dsProject = fourCBAL.GetProjectNameAddCreatorReviewer(); if (raveHRCollection != null) { // Assign the data source to dropdown ddlProject.DataSource = dsProject; //ddlProject.DataTextField = CommonConstants.DDL_DataTextField; //ddlProject.DataValueField = CommonConstants.DDL_DataValueField; ddlProject.DataTextField = dsProject.Tables[0].Columns[1].ToString(); ddlProject.DataValueField = dsProject.Tables[0].Columns[0].ToString(); // Bind the data to dropdown ddlProject.DataBind(); // Default value of dropdown is "Select" ddlProject.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT); ddlProjectNameFilter.DataSource = raveHRCollection; ddlProjectNameFilter.DataTextField = CommonConstants.DDL_DataTextField; ddlProjectNameFilter.DataValueField = CommonConstants.DDL_DataValueField; // Bind the data to dropdown ddlProjectNameFilter.DataBind(); // Default value of dropdown is "Select" ddlProjectNameFilter.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT); ddlProjectNameFilter.Enabled = false; } } //catches RaveHRException exception catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "FillProjectNameDropDown", EventIDConstants.RAVE_HR_RP_PRESENTATION_LAYER); } }
protected void grdvCreatorApprover_RowCommand(object sender, GridViewCommandEventArgs e) { lblMessage.Visible = false; if (e.CommandName == "Edt") { GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; HiddenField HfProjectId = (HiddenField)row.FindControl("hfProjectId"); HiddenField HfDepartmentId = (HiddenField)row.FindControl("HfDepartmentId"); HiddenField HfCreatorGrd = (HiddenField)row.FindControl("HfCreatorGrd"); HiddenField HfReviewerGrd = (HiddenField)row.FindControl("HfReviewerGrd"); btnAdd.Enabled = false; btnUpdate.Enabled = true; HfCreator.Value = HfCreatorGrd.Value; HfReviewer.Value = HfReviewerGrd.Value; txtCreator.Text = row.Cells[2].Text; txtReviewer.Text = row.Cells[3].Text; //Declaring COllection class object BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); Rave.HR.BusinessLayer.Common.Master master = new Rave.HR.BusinessLayer.Common.Master(); raveHRCollection = master.FillDepartmentDropDownBL(); ddlDepartment.Items.Clear(); ddlDepartment.DataSource = raveHRCollection; ddlDepartment.DataTextField = Common.CommonConstants.DDL_DataTextField; ddlDepartment.DataValueField = Common.CommonConstants.DDL_DataValueField; ddlDepartment.DataBind(); ddlDepartment.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT); ddlDepartment.SelectedValue = HfDepartmentId.Value; if (HfDepartmentId.Value == "1") { ddlProject.Enabled = true; Rave.HR.BusinessLayer.MRF.MRFDetail mrfProjectName = new Rave.HR.BusinessLayer.MRF.MRFDetail(); raveHRCollection = mrfProjectName.GetProjectName(); ddlProject.Items.Clear(); ddlProject.DataSource = raveHRCollection; ddlProject.DataTextField = CommonConstants.DDL_DataTextField; ddlProject.DataValueField = CommonConstants.DDL_DataValueField; // Bind the data to dropdown ddlProject.DataBind(); // Default value of dropdown is "Select" ddlProject.Items.Insert(CommonConstants.ZERO, CommonConstants.SELECT); if (!string.IsNullOrEmpty(HfProjectId.Value)) { ddlProject.SelectedValue = HfProjectId.Value; } } else { ddlProject.SelectedItem.Text = "SELECT"; } ddlDepartment.Enabled = false; ddlProject.Enabled = false; } else if (e.CommandName == "Del") { try { if (rblAdminSelectionOption.SelectedIndex == 0) { GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; HiddenField HfProjectId = (HiddenField)row.FindControl("hfProjectId"); HiddenField HfDepartmentId = (HiddenField)row.FindControl("HfDepartmentId"); HiddenField HfCreatorGrd = (HiddenField)row.FindControl("HfCreatorGrd"); HiddenField HfReviewerGrd = (HiddenField)row.FindControl("HfReviewerGrd"); Rave.HR.BusinessLayer.FourC.FourC fourCBAL = new Rave.HR.BusinessLayer.FourC.FourC(); int depId = int.Parse(HfDepartmentId.Value); int projId = 0; if (depId == 1) { projId = int.Parse(HfProjectId.Value); } fourCBAL.AddUpdateDeleteCreatorReviewer(depId, projId, HfCreator.Value, HfReviewer.Value, UserMailId, "Delete"); FillCreatorApproverData(); ClearControl(); lblMessage.Visible = true; lblMessage.Text = "Data Deleted Successfully!!!."; lblMessage.Style["color"] = "blue"; } else { GridViewRow row = (GridViewRow)((Control)e.CommandSource).NamingContainer; HiddenField HfCreatorGrd = (HiddenField)row.FindControl("HfCreatorGrd"); List <string> ls = new List <string> { }; ls.Add(HfCreatorGrd.Value); if (ls.Count > 0 && !string.IsNullOrEmpty(HfCreatorGrd.Value)) { Rave.HR.BusinessLayer.FourC.FourC fourCBAL = new Rave.HR.BusinessLayer.FourC.FourC(); fourCBAL.AddDeleteViewAccessRights(ls, UserMailId, "Delete"); getEmployeeData(); lblMessage.Visible = true; lblMessage.Text = "Data Added Successfully!!!."; lblMessage.Style["color"] = "blue"; } } } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "grdvCreatorApprover_RowCommand", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } } }