//Umesh: NIS-changes: Skill Search Report Starts public BusinessEntities.RaveHRCollection GetPrimaryAndSecondarySkills() { objDA = new DataAccessClass(); try { BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetPrimaryAndSecondarySkills); while (objDataReader.Read()) { KeyValue <string> keyValue = new KeyValue <string>(); keyValue.KeyName = objDataReader.GetValue(0).ToString(); keyValue.Val = objDataReader.GetValue(0).ToString(); raveHRCollection.Add(keyValue); } return(raveHRCollection); } catch (Exception ex) { throw ex; } finally { if (objDataReader != null) { objDataReader.Close(); } objDA.CloseConncetion(); } }
private void ShowHeaderWhenEmptyGrid(BusinessEntities.RaveHRCollection raveHRCollection) { try { //set header visible grdvHeadCount.ShowHeader = true; // Disable sorting grdvHeadCount.AllowSorting = false; //Create empty datasource for Grid view and bind raveHRCollection.Add(new BusinessEntities.Employee()); grdvHeadCount.DataSource = raveHRCollection; grdvHeadCount.DataBind(); //clear all the cells in the row grdvHeadCount.Rows[0].Cells.Clear(); //add a new blank cell grdvHeadCount.Rows[0].Cells.Add(new TableCell()); grdvHeadCount.Rows[0].Cells[0].Text = CommonConstants.NO_RECORDS_FOUND_MESSAGE; grdvHeadCount.Rows[0].Cells[0].Wrap = false; grdvHeadCount.Rows[0].Cells[0].Width = Unit.Percentage(10); } catch { } }
/// <summary> /// Handles the RowDeleting event of the gvVisaDetails control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> protected void gvVisaDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { int deleteRowIndex = 0; int rowIndex = -1; BusinessEntities.VisaDetails objVisaDetails = new BusinessEntities.VisaDetails(); deleteRowIndex = e.RowIndex; objVisaDetails = (BusinessEntities.VisaDetails)VisaDetailsCollection.Item(deleteRowIndex); objVisaDetails.Mode = 3; if (ViewState[VISADETAILSDELETE] != null) { BusinessEntities.RaveHRCollection objDeleteVisaDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[VISADETAILSDELETE]; objDeleteVisaDetailsCollection.Add(objVisaDetails); ViewState[VISADETAILSDELETE] = objDeleteVisaDetailsCollection; } else { BusinessEntities.RaveHRCollection objDeleteVisaDetailsCollection1 = new BusinessEntities.RaveHRCollection(); objDeleteVisaDetailsCollection1.Add(objVisaDetails); ViewState[VISADETAILSDELETE] = objDeleteVisaDetailsCollection1; } VisaDetailsCollection.RemoveAt(deleteRowIndex); ViewState[DELETEROWINDEX] = deleteRowIndex; DoDataBind(); if (ViewState[ROWINDEX] != null) { rowIndex = Convert.ToInt32(ViewState[ROWINDEX].ToString()); //check edit index with deleted index if edit index is greater than or equal to delete index then rowindex decremented. if (rowIndex != -1 && deleteRowIndex <= rowIndex) { rowIndex--; //store the rowindex in viewstate. ViewState[ROWINDEX] = rowIndex; } ImageButton btnImg = (ImageButton)gvVisaDetails.Rows[rowIndex].FindControl(IMGBTNDELETE); btnImg.Enabled = false; //Disabling all the edit buttons. for (int i = 0; i < gvVisaDetails.Rows.Count; i++) { if (rowIndex != i) { ImageButton btnImgEdit = (ImageButton)gvVisaDetails.Rows[i].FindControl(IMGBTNEDIT); btnImgEdit.Enabled = false; } } } }
/// <summary> /// get the branches of a section. /// </summary> /// <param name="branchID"></param> /// <returns></returns> public RaveHRCollection GetSectionByBranch(int branchID) { BusinessEntities.SeatAllocation objSeatAllocation = null; SqlDataReader objReader = null;; DataAccessClass objDASeatAllocation = new DataAccessClass(); try { raveHRCollection = new RaveHRCollection(); objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter(SPParameter.BranchID, DbType.Int32); sqlParam[0].Value = branchID; objReader = objDASeatAllocation.ExecuteReaderSP(SPNames.SeatAllocation_GetSection, sqlParam); while (objReader.Read()) { objSeatAllocation = new BusinessEntities.SeatAllocation(); objSeatAllocation.SectionID = int.Parse(objReader[DbTableColumn.Seat_SectionID].ToString()); objSeatAllocation.SectionName = objReader[DbTableColumn.Seat_SectionName].ToString(); raveHRCollection.Add(objSeatAllocation); } return(raveHRCollection); } //catches RaveHRException exception catch (RaveHRException ex) { throw ex; } //catches genral exception catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetSectionByBranch", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER); } //close datareader and connection finally { //checks if datareader is null if (!objReader.IsClosed) { //close datareader objReader.Close(); } //close connection objDASeatAllocation.CloseConncetion(); } }
// Ishwar NISRMS 13032015 Start public BusinessEntities.RaveHRCollection FillDropDownsDLForStatus(int categoryId) { //Declare DataAccess Class Object objDA = new DataAccessClass(); SqlParameter[] sqlParam = new SqlParameter[1]; try { BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); sqlParam[0] = new SqlParameter(SPParameter.Category, SqlDbType.Int); sqlParam[0].Value = categoryId; objReader = objDA.ExecuteReaderSP(SPNames.Master_GetMasterDataForStatus, sqlParam); while (objReader.Read()) { if (objReader.GetValue(1).ToString() != "Abort") { KeyValue <string> keyValue = new KeyValue <string>(); keyValue.KeyName = objReader.GetValue(0).ToString(); keyValue.Val = objReader.GetValue(1).ToString(); raveHRCollection.Add(keyValue); } } return(raveHRCollection); } catch (Exception ex) { throw ex; } finally { if (objReader != null) { objReader.Close(); } objDA.CloseConncetion(); } }
//Siddhesh Arekar Issue ID : 55884 Closure Type public BusinessEntities.RaveHRCollection FillDepartmentDropDownDL() { objDA = new DataAccessClass(); SqlParameter[] sqlParam = new SqlParameter[1]; try { BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); //Ishwar : 22062015 Start sqlParam[0] = new SqlParameter(SPParameter.EmailId, SqlDbType.NVarChar); sqlParam[0].Value = string.Empty; //Ishwar : 22062015 End objReader = objDA.ExecuteReaderSP(SPNames.Master_GetDepartment, sqlParam); while (objReader.Read()) { KeyValue <string> keyValue = new KeyValue <string>(); keyValue.KeyName = objReader.GetValue(0).ToString(); keyValue.Val = objReader.GetValue(1).ToString(); raveHRCollection.Add(keyValue); } return(raveHRCollection); } catch (Exception ex) { throw ex; } finally { if (objReader != null) { objReader.Close(); } objDA.CloseConncetion(); } }
// Mohamed : NIS-RMS : 29/12/2014 : Starts // Desc : Show Departement for which the person is eligible public BusinessEntities.RaveHRCollection FillEligibleDepartmentDropDownDL(string strCurrentUser) { objDA = new DataAccessClass(); try { BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); objDA.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[1]; sqlParam[0] = new SqlParameter(SPParameter.EmailId, DbType.String); sqlParam[0].Value = strCurrentUser; objReader = objDA.ExecuteReaderSP(SPNames.MRF_GetMRFRaiseAccesForDepartmentByEmpId, sqlParam); while (objReader.Read()) { KeyValue <string> keyValue = new KeyValue <string>(); keyValue.KeyName = objReader.GetValue(0).ToString(); keyValue.Val = objReader.GetValue(1).ToString(); raveHRCollection.Add(keyValue); } return(raveHRCollection); } catch (Exception ex) { throw ex; } finally { if (objReader != null) { objReader.Close(); } objDA.CloseConncetion(); } }
/// <summary> /// Display Header When GridView Empty with proper message /// </summary> /// <param name="raveHRCollection">EmptyCollection</param> private void ShowHeaderWhenEmptyGrid(BusinessEntities.RaveHRCollection raveHRCollection) { try { //set header visible gvPendingApprovalOfMrf.ShowHeader = true; // Disable sorting gvPendingApprovalOfMrf.AllowSorting = false; //Create empty datasource for Grid view and bind raveHRCollection.Add(new BusinessEntities.MRFDetail()); gvPendingApprovalOfMrf.DataSource = raveHRCollection; gvPendingApprovalOfMrf.DataBind(); //Hide the column for images:Approve/Reject/View gvPendingApprovalOfMrf.Columns[13].Visible = false; gvPendingApprovalOfMrf.Columns[14].Visible = false; gvPendingApprovalOfMrf.Columns[15].Visible = false; //clear all the cells in the row gvPendingApprovalOfMrf.Rows[0].Cells.Clear(); //add a new blank cell gvPendingApprovalOfMrf.Rows[0].Cells.Add(new TableCell()); gvPendingApprovalOfMrf.Rows[0].Cells[0].Text = CommonConstants.NO_RECORDS_FOUND_MESSAGE; gvPendingApprovalOfMrf.Rows[0].Cells[0].Wrap = false; gvPendingApprovalOfMrf.Rows[0].Cells[0].Width = Unit.Percentage(10); } //catches RaveHRException exception catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_MRFPENDINGAPPROVAL, "ShowHeaderWhenEmptyGrid", EventIDConstants.RAVE_HR_RP_PRESENTATION_LAYER); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { Rave.HR.BusinessLayer.Employee.SkillsDetails objSkillsDetailsBAL; Rave.HR.BusinessLayer.Employee.Employee objEmployeeSkillsBAL; BusinessEntities.SkillsDetails objSkillsDetails; BusinessEntities.RaveHRCollection objSaveSkillsDetailsCollection = new BusinessEntities.RaveHRCollection(); try { objSkillsDetailsBAL = new Rave.HR.BusinessLayer.Employee.SkillsDetails(); objEmployeeSkillsBAL = new Rave.HR.BusinessLayer.Employee.Employee(); if (gvSkills.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE) { for (int i = 0; i < gvSkills.Rows.Count; i++) { objSkillsDetails = new BusinessEntities.SkillsDetails(); Label SkillValue = (Label)gvSkills.Rows[i].FindControl(SKILL); Label ProficiencyValue = (Label)gvSkills.Rows[i].FindControl(PROFICIENCY); Label SkillId = (Label)gvSkills.Rows[i].FindControl(SKILLID); Label Mode = (Label)gvSkills.Rows[i].FindControl(MODE); objSkillsDetails.SkillsId = int.Parse(SkillId.Text); objSkillsDetails.EMPId = int.Parse(EMPId.Value); objSkillsDetails.SkillName = gvSkills.Rows[i].Cells[0].Text; objSkillsDetails.Experience = gvSkills.Rows[i].Cells[1].Text; objSkillsDetails.ProficiencyLevel = gvSkills.Rows[i].Cells[2].Text; objSkillsDetails.LastUsedDate = Convert.ToDateTime(gvSkills.Rows[i].Cells[3].Text); objSkillsDetails.Mode = int.Parse(Mode.Text); objSkillsDetails.Skill = int.Parse(SkillValue.Text); objSkillsDetails.Proficiency = int.Parse(ProficiencyValue.Text); objSaveSkillsDetailsCollection.Add(objSkillsDetails); } } BusinessEntities.RaveHRCollection objDeleteSkillsDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[SKILLDETAILSDELETE]; if (objDeleteSkillsDetailsCollection != null) { BusinessEntities.SkillsDetails obj = null; for (int i = 0; i < objDeleteSkillsDetailsCollection.Count; i++) { objSkillsDetails = new BusinessEntities.SkillsDetails(); obj = (BusinessEntities.SkillsDetails)objDeleteSkillsDetailsCollection.Item(i); objSkillsDetails.SkillsId = obj.SkillsId; objSkillsDetails.EMPId = obj.EMPId; objSkillsDetails.Skill = obj.Skill; objSkillsDetails.Experience = obj.Experience; objSkillsDetails.Proficiency = obj.Proficiency; objSkillsDetails.Mode = obj.Mode; objSkillsDetails.Skill = obj.Skill; objSkillsDetails.Proficiency = obj.Proficiency; objSaveSkillsDetailsCollection.Add(objSkillsDetails); } } objSkillsDetailsBAL.Manipulation(objSaveSkillsDetailsCollection); if (ViewState.Count > 0) { ViewState.Clear(); } if (EMPId.Value != string.Empty) { int empID = Convert.ToInt32(EMPId.Value); //Refresh the grip after saving this.PopulateGrid(empID); } if (gvSkills.Rows.Count == 0) { btnSave.Visible = false; } objEmployeeSkillsBAL.SendMailApprovalOfSkillsRating(employee); lblMessage.Text = "Skills details saved successfully."; } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// This method will fetch records of seats from data base and return to business layer /// </summary> /// <param name="criteria"></param> /// <returns></returns> public RaveHRCollection GetSeatDetails(BusinessEntities.SeatAllocation SeatSection) { DataAccessClass objDASeatAllocation = new DataAccessClass(); List <BusinessEntities.SeatAllocation> objListSeatAlloctaion = null; // Initialise Collection class object raveHRCollection = new BusinessEntities.RaveHRCollection(); try { objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[2]; sqlParam[0] = new SqlParameter(SPParameter.SectionID, DbType.Int32); sqlParam[0].Value = SeatSection.SectionID; sqlParam[1] = new SqlParameter(SPParameter.BranchID, DbType.Int32); sqlParam[1].Value = SeatSection.RaveBranchID; //--get result DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetSeatDetailsForBay, sqlParam); //--Create entities and add to list BusinessEntities.SeatAllocation objBESeatDetail = null; objListSeatAlloctaion = new List <BusinessEntities.SeatAllocation>(); foreach (DataRow dr in dsSeatDescription.Tables[0].Rows) { objBESeatDetail = new BusinessEntities.SeatAllocation(); if (dr[DbTableColumn.Seat_SectionID].ToString() != null) { objBESeatDetail.SectionID = Convert.ToInt32(dr[DbTableColumn.Seat_SectionID]); } if (dr[DbTableColumn.Seat_BayID].ToString() != null) { objBESeatDetail.BayID = Convert.ToInt32(dr[DbTableColumn.Seat_BayID]); } if (dr[DbTableColumn.Seat_SeatID].ToString() != null) { objBESeatDetail.SeatID = Convert.ToInt32(dr[DbTableColumn.Seat_SeatID]); } if (dr[DbTableColumn.Seat_SeatName].ToString() != null) { objBESeatDetail.SeatName = dr[DbTableColumn.Seat_SeatName].ToString(); } if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty) { objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID]); } else { objBESeatDetail.EmployeeID = 0; } if (dr[DbTableColumn.Seat_EmployeeName].ToString() != string.Empty) { objBESeatDetail.EmployeeName = dr[DbTableColumn.Seat_EmployeeName].ToString(); } //--add to list objListSeatAlloctaion.Add(objBESeatDetail); } raveHRCollection.Add(objListSeatAlloctaion); return(raveHRCollection); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetSeatDetails", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER); } finally { objDASeatAllocation.CloseConncetion(); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { Rave.HR.BusinessLayer.Employee.QualificationDetails objQualificationDetailsBAL; BusinessEntities.QualificationDetails objQualificationDetails; BusinessEntities.RaveHRCollection objSaveQualificationDetailsCollection = new BusinessEntities.RaveHRCollection(); try { objQualificationDetailsBAL = new Rave.HR.BusinessLayer.Employee.QualificationDetails(); if (gvQualification.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE) { for (int i = 0; i < gvQualification.Rows.Count; i++) { objQualificationDetails = new BusinessEntities.QualificationDetails(); Label QualificationValue = (Label)gvQualification.Rows[i].FindControl(QUALIFICATION); Label QualificationId = (Label)gvQualification.Rows[i].FindControl(QUALIFICATIONID); Label Mode = (Label)gvQualification.Rows[i].FindControl(MODE); objQualificationDetails.QualificationId = int.Parse(QualificationId.Text); objQualificationDetails.EMPId = int.Parse(EMPId.Value); objQualificationDetails.QualificationName = gvQualification.Rows[i].Cells[0].Text; objQualificationDetails.UniversityName = gvQualification.Rows[i].Cells[1].Text; objQualificationDetails.InstituteName = gvQualification.Rows[i].Cells[2].Text; objQualificationDetails.PassingYear = gvQualification.Rows[i].Cells[3].Text; objQualificationDetails.GPA = float.Parse(gvQualification.Rows[i].Cells[4].Text); objQualificationDetails.Outof = float.Parse(gvQualification.Rows[i].Cells[5].Text); objQualificationDetails.Percentage = float.Parse(gvQualification.Rows[i].Cells[6].Text); objQualificationDetails.Mode = int.Parse(Mode.Text); objQualificationDetails.Qualification = int.Parse(QualificationValue.Text); objSaveQualificationDetailsCollection.Add(objQualificationDetails); } } BusinessEntities.RaveHRCollection objDeleteQualificationDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[QUALIFICATIONDETAILSDELETE]; if (objDeleteQualificationDetailsCollection != null) { BusinessEntities.QualificationDetails obj = null; for (int i = 0; i < objDeleteQualificationDetailsCollection.Count; i++) { objQualificationDetails = new BusinessEntities.QualificationDetails(); obj = (BusinessEntities.QualificationDetails)objDeleteQualificationDetailsCollection.Item(i); objQualificationDetails.QualificationId = obj.QualificationId; objQualificationDetails.EMPId = obj.EMPId; objQualificationDetails.QualificationName = obj.QualificationName; objQualificationDetails.UniversityName = obj.UniversityName; objQualificationDetails.InstituteName = obj.InstituteName; objQualificationDetails.PassingYear = obj.PassingYear; objQualificationDetails.GPA = obj.GPA; objQualificationDetails.Outof = obj.Outof; objQualificationDetails.Percentage = obj.Percentage; objQualificationDetails.Mode = obj.Mode; objQualificationDetails.Qualification = obj.Qualification; objSaveQualificationDetailsCollection.Add(objQualificationDetails); } } objQualificationDetailsBAL.Manipulation(objSaveQualificationDetailsCollection); if (ViewState.Count > 0) { ViewState.Clear(); } if (EMPId.Value != string.Empty) { int empID = Convert.ToInt32(EMPId.Value); //Refresh the grip after saving this.PopulateGrid(empID); } if (gvQualification.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE) { btnSave.Visible = false; } lblMessage.Text = "Qualification details saved successfully."; } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { Rave.HR.BusinessLayer.Employee.ProjectDetails objProjectDetailsBAL; BusinessEntities.ProjectDetails objProjectDetails; BusinessEntities.RaveHRCollection objSaveProjectDetailsCollection = new BusinessEntities.RaveHRCollection(); try { objProjectDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProjectDetails(); if (gvProjectDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE) { for (int i = 0; i < gvProjectDetails.Rows.Count; i++) { objProjectDetails = new BusinessEntities.ProjectDetails(); Label ProjectId = (Label)gvProjectDetails.Rows[i].FindControl(PROJECTID); Label Mode = (Label)gvProjectDetails.Rows[i].FindControl(MODE); objProjectDetails.ProjectId = int.Parse(ProjectId.Text); objProjectDetails.EMPId = int.Parse(EMPId.Value); objProjectDetails.Organisation = gvProjectDetails.Rows[i].Cells[2].Text; objProjectDetails.ProjectName = gvProjectDetails.Rows[i].Cells[1].Text; objProjectDetails.ProjectLocation = gvProjectDetails.Rows[i].Cells[3].Text; objProjectDetails.ClientName = gvProjectDetails.Rows[i].Cells[4].Text; objProjectDetails.ProjectSize = int.Parse(gvProjectDetails.Rows[i].Cells[5].Text); objProjectDetails.OnsiteDuration = gvProjectDetails.Rows[i].Cells[6].Text; objProjectDetails.Role = gvProjectDetails.Rows[i].Cells[7].Text; objProjectDetails.Description = gvProjectDetails.Rows[i].Cells[8].Text; objProjectDetails.Resposibility = gvProjectDetails.Rows[i].Cells[9].Text; objProjectDetails.Mode = int.Parse(Mode.Text); Label LocationId = (Label)gvProjectDetails.Rows[i].FindControl(ProjectLocationId); objProjectDetails.LocationId = Convert.ToInt32(LocationId.Text); Label ProjectDoneID = (Label)gvProjectDetails.Rows[i].FindControl(ProjectDoneStatus); objProjectDetails.ProjectDone = Convert.ToInt32(ProjectDoneID.Text); objSaveProjectDetailsCollection.Add(objProjectDetails); } } BusinessEntities.RaveHRCollection objDeleteProjectDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[PROJECTDETAILSDELETE]; if (objDeleteProjectDetailsCollection != null) { BusinessEntities.ProjectDetails obj = null; for (int i = 0; i < objDeleteProjectDetailsCollection.Count; i++) { objProjectDetails = new BusinessEntities.ProjectDetails(); obj = (BusinessEntities.ProjectDetails)objDeleteProjectDetailsCollection.Item(i); objProjectDetails.ProjectId = obj.ProjectId; objProjectDetails.EMPId = obj.EMPId; objProjectDetails.ProjectName = obj.ProjectName; objProjectDetails.Organisation = obj.Organisation; objProjectDetails.ClientName = obj.ClientName; objProjectDetails.ProjectSize = obj.ProjectSize; objProjectDetails.Role = obj.Role; objProjectDetails.ProjectLocation = obj.ProjectLocation; objProjectDetails.OnsiteDuration = obj.OnsiteDuration; objProjectDetails.Description = obj.Description; objProjectDetails.Resposibility = obj.Resposibility; objProjectDetails.ProjectSize = obj.ProjectSize; objProjectDetails.Mode = obj.Mode; objProjectDetails.LocationId = objProjectDetails.LocationId; objProjectDetails.ProjectDone = obj.ProjectDone; objProjectDetails.ProjectDoneName = obj.ProjectDoneName; objSaveProjectDetailsCollection.Add(objProjectDetails); } } objProjectDetailsBAL.Manipulation(objSaveProjectDetailsCollection); if (ViewState.Count > 0) { ViewState.Clear(); } if (EMPId.Value != string.Empty) { int empID = Convert.ToInt32(EMPId.Value); //Refresh the grip after saving this.PopulateGrid(empID); } if (gvProjectDetails.Rows.Count == 0) { btnSave.Visible = false; } lblMessage.Text = "Project details saved successfully."; } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// Gets the skills details. /// </summary> /// <param name="objGetSkillsDetails">The object get skills details.</param> /// <returns></returns> public BusinessEntities.RaveHRCollection GetSkillsDetails(BusinessEntities.SkillsDetails objGetSkillsDetails) { //Initialise Data Access Class object objDA = new DataAccessClass(); //Initialise SqlParameter Class object sqlParam = new SqlParameter[1]; //Initialise Collection class object raveHRCollection = new BusinessEntities.RaveHRCollection(); try { //Open the connection to DB objDA.OpenConnection(DBConstants.GetDBConnectionString()); //Check each parameters nullibality and add values to sqlParam object accordingly sqlParam[0] = new SqlParameter(SPParameter.EmpId, SqlDbType.Int); if (objGetSkillsDetails.EMPId == 0) { sqlParam[0].Value = DBNull.Value; } else { sqlParam[0].Value = objGetSkillsDetails.EMPId; } objDataReader = objDA.ExecuteReaderSP(SPNames.Employee_GetSkillsDetails, sqlParam); while (objDataReader.Read()) { //Initialise the Business Entity object objSkillsDetails = new BusinessEntities.SkillsDetails(); objSkillsDetails.SkillsId = Convert.ToInt32(objDataReader[DbTableColumn.SId].ToString()); objSkillsDetails.EMPId = Convert.ToInt32(objDataReader[DbTableColumn.EMPId].ToString()); objSkillsDetails.Skill = Convert.ToInt32(objDataReader[DbTableColumn.SkillId].ToString()); objSkillsDetails.SkillVersion = objDataReader[DbTableColumn.SkillVersion].ToString(); objSkillsDetails.SkillName = objDataReader[DbTableColumn.Skill].ToString(); objSkillsDetails.Month = Convert.ToInt32(objDataReader[DbTableColumn.ExperienceInMonth].ToString()); objSkillsDetails.Year = Convert.ToInt32(objDataReader[DbTableColumn.ExperienceInYear].ToString()); objSkillsDetails.Proficiency = Convert.ToInt32(objDataReader[DbTableColumn.ProficiencyLevel].ToString()); objSkillsDetails.ProficiencyLevel = objDataReader[DbTableColumn.Proficiency].ToString(); objSkillsDetails.LastUsed = Convert.ToInt32(objDataReader[DbTableColumn.LastUsedDate].ToString()); // Add the object to Collection raveHRCollection.Add(objSkillsDetails); } } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASS_NAME, GETSKILLSDETAILS, EventIDConstants.RAVE_EMP_SKILL_SEARCH_DATA_ACCESS_LAYER); } finally { if (objDataReader != null) { objDataReader.Close(); } objDA.CloseConncetion(); } return(raveHRCollection); }
/// <summary> /// This method will fetch records from data base and return to business layer /// </summary> /// <param name=>BusinessEntities.ContractCriteria</param> /// <returns>BusinessEntities.RaveHRCollection</returns> public BusinessEntities.RaveHRCollection GetProjectsListDetails(BusinessEntities.ContractCriteria criteria) { int pageCount = 1; int counter = 0; List <BusinessEntities.ContractProject> objListOfProjects = null; // Initialise Data Access Class object DataAccessClass objProjectDetails = new DataAccessClass(); // Initialise Collection class object raveHRCollection = new BusinessEntities.RaveHRCollection(); try { //Open the connection to DB objProjectDetails.OpenConnection(DBConstants.GetDBConnectionString()); SqlParameter[] sqlParam = new SqlParameter[4]; sqlParam[0] = new SqlParameter(SPParameter.SortExpresion, DbType.String); sqlParam[0].Value = criteria.SortExpression + criteria.Direction; sqlParam[1] = new SqlParameter(SPParameter.pageNum, DbType.Int32); sqlParam[1].Value = criteria.PageNumber; sqlParam[2] = new SqlParameter(SPParameter.pageSize, DbType.Int32); sqlParam[2].Value = 10; sqlParam[3] = new SqlParameter(SPParameter.pageCount, SqlDbType.Int); sqlParam[3].Direction = ParameterDirection.Output; //gets the all project details. DataSet dsProjectdetails = objProjectDetails.GetDataSet(SPNames.Contract_GetProjectList, sqlParam); pageCount = Convert.ToInt32(sqlParam[3].Value); //Create entities and add to list BusinessEntities.ContractProject objProjects = null; objListOfProjects = new List <BusinessEntities.ContractProject>(); foreach (DataRow dr in dsProjectdetails.Tables[0].Rows) { counter++; objProjects = new BusinessEntities.ContractProject(); objProjects.ProjectID = Convert.ToInt32(dr[DbTableColumn.Con_ProjectID]); objProjects.ProjectCode = dr[DbTableColumn.Con_ProjectCode].ToString(); objProjects.DocumentName = dr[DbTableColumn.Con_DocumentName].ToString(); objProjects.ContractCode = dr[DbTableColumn.Con_ContractCode].ToString(); objProjects.ProjectName = dr[DbTableColumn.Con_ConProjectName].ToString(); objProjects.ContractType = dr[DbTableColumn.Con_ContractName].ToString(); objProjects.ClientName = dr[DbTableColumn.ClientName].ToString(); //add page count only first time. if (counter == 1) { objProjects.PageCount = pageCount; } //--add to list objListOfProjects.Add(objProjects); } raveHRCollection.Add(objListOfProjects); return(raveHRCollection); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetProjectsListDetails", EventIDConstants.RAVE_HR_CONTRACT_DATA_ACCESS_LAYER); } finally { objProjectDetails.CloseConncetion(); } }
/// <summary> /// Handles the RowDeleting event of the gvProfessionalCourses control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> protected void gvProfessionalCourses_RowDeleting(object sender, GridViewDeleteEventArgs e) { int deleteRowIndex = 0; int rowIndex = -1; Boolean Flag = false; Rave.HR.BusinessLayer.Employee.ProfessionalDetails objProfessionalDetailsBAL; BusinessEntities.ProfessionalDetails objProfessionalDetails = new BusinessEntities.ProfessionalDetails(); objProfessionalDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProfessionalDetails(); deleteRowIndex = e.RowIndex; objProfessionalDetails = (BusinessEntities.ProfessionalDetails)ProfessionalDetailsCollection.Item(deleteRowIndex); if (objProfessionalDetails.Mode == 1) { Flag = true; } objProfessionalDetails.Mode = 3; if (ViewState[PROFESSIONALDETAILSDELETE] != null) { BusinessEntities.RaveHRCollection objDeleteProfessionalDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[PROFESSIONALDETAILSDELETE]; objDeleteProfessionalDetailsCollection.Add(objProfessionalDetails); ViewState[PROFESSIONALDETAILSDELETE] = objDeleteProfessionalDetailsCollection; } else { BusinessEntities.RaveHRCollection objDeleteProfessionalDetailsCollection1 = new BusinessEntities.RaveHRCollection(); objDeleteProfessionalDetailsCollection1.Add(objProfessionalDetails); ViewState[PROFESSIONALDETAILSDELETE] = objDeleteProfessionalDetailsCollection1; } ProfessionalDetailsCollection.RemoveAt(deleteRowIndex); ViewState[DELETEROWINDEX] = deleteRowIndex; DoDataBind(); objProfessionalDetailsBAL.DeleteProfessionalDetails(objProfessionalDetails); if (ViewState[ROWINDEX] != null) { rowIndex = Convert.ToInt32(ViewState[ROWINDEX].ToString()); //check edit index with deleted index if edit index is greater than or equal to delete index then rowindex decremented. if (rowIndex != -1 && deleteRowIndex <= rowIndex) { rowIndex--; //store the rowindex in viewstate. ViewState[ROWINDEX] = rowIndex; } ImageButton btnImg = (ImageButton)gvProfessionalCourses.Rows[rowIndex].FindControl(IMGBTNDELETE); btnImg.Enabled = false; //Disabling all the edit buttons. for (int i = 0; i < gvProfessionalCourses.Rows.Count; i++) { if (rowIndex != i) { ImageButton btnImgEdit = (ImageButton)gvProfessionalCourses.Rows[i].FindControl(IMGBTNEDIT); btnImgEdit.Enabled = false; } } } lblMessage.Text = "Professional Courses deleted successfully."; HfIsDataModified.Value = string.Empty; }
/// <summary> /// Handles the RowDeleting event of the gvSkills control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param> protected void gvSkills_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { int deleteRowIndex = 0; int rowIndex = -1; BusinessEntities.SkillsDetails objSkillsDetails = new BusinessEntities.SkillsDetails(); deleteRowIndex = e.RowIndex; objSkillsDetails = (BusinessEntities.SkillsDetails)SkillDetailsCollection.Item(deleteRowIndex); objSkillsDetails.Mode = 3; if (ViewState[SKILLDETAILSDELETE] != null) { BusinessEntities.RaveHRCollection objDeleteSkillDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[SKILLDETAILSDELETE]; objDeleteSkillDetailsCollection.Add(objSkillsDetails); ViewState[SKILLDETAILSDELETE] = objDeleteSkillDetailsCollection; } else { BusinessEntities.RaveHRCollection objDeleteSkillDetailsCollection1 = new BusinessEntities.RaveHRCollection(); objDeleteSkillDetailsCollection1.Add(objSkillsDetails); ViewState[SKILLDETAILSDELETE] = objDeleteSkillDetailsCollection1; } SkillDetailsCollection.RemoveAt(deleteRowIndex); ViewState[DELETEROWINDEX] = deleteRowIndex; BindGrid(); if (ViewState[ROWINDEX] != null) { rowIndex = Convert.ToInt32(ViewState[ROWINDEX].ToString()); //Check edit index with deleted index if edit index is //greater than or equal to delete index then rowindex decremented. if (rowIndex != -1 && deleteRowIndex <= rowIndex) { rowIndex--; //store the rowindex in viewstate. ViewState[ROWINDEX] = rowIndex; } ImageButton ibtnDelete = (ImageButton)gvSkills.Rows[rowIndex].FindControl(IBTNDELETE); ibtnDelete.Enabled = false; //Disabling all the edit buttons. for (int i = 0; i < gvSkills.Rows.Count; i++) { if (rowIndex != i) { ImageButton ibtnEdit = (ImageButton)gvSkills.Rows[i].FindControl(IBTNEDIT); ibtnEdit.Enabled = false; } } } } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "gvSkills_RowDeleting", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } }
/// <summary> /// Handles the Click event of the btnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnSave_Click(object sender, EventArgs e) { if (ValidateControls()) { Rave.HR.BusinessLayer.Employee.VisaDetails objVisaDetailsBAL; //Rave.HR.BusinessLayer.Employee.Employee objEmployeeBAL; BusinessEntities.VisaDetails objVisaDetails; BusinessEntities.RaveHRCollection objSaveVisaDetailsCollection = new BusinessEntities.RaveHRCollection(); try { objEmployeeBAL = new Rave.HR.BusinessLayer.Employee.Employee(); if (rbtnValidPassport.SelectedIndex == CommonConstants.ZERO) { employee.PassportNo = txtPassportNo.Text; employee.PassportIssuePlace = txtIssuePlace.Text; employee.PassportIssueDate = Convert.ToDateTime(txtIssueDate.Text); employee.PassportExpireDate = Convert.ToDateTime(txtExpiryDate.Text); if (rbtnValidVisa.SelectedIndex == CommonConstants.ZERO) { objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails(); if (gvVisaDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE) { for (int i = 0; i < gvVisaDetails.Rows.Count; i++) { objVisaDetails = new BusinessEntities.VisaDetails(); Label VisaId = (Label)gvVisaDetails.Rows[i].FindControl(VISAID); Label Mode = (Label)gvVisaDetails.Rows[i].FindControl(MODE); objVisaDetails.VisaId = int.Parse(VisaId.Text); objVisaDetails.EMPId = int.Parse(EMPId.Value); objVisaDetails.CountryName = gvVisaDetails.Rows[i].Cells[0].Text; objVisaDetails.VisaType = gvVisaDetails.Rows[i].Cells[1].Text; objVisaDetails.ExpiryDate = Convert.ToDateTime(gvVisaDetails.Rows[i].Cells[2].Text); objVisaDetails.Mode = int.Parse(Mode.Text); objSaveVisaDetailsCollection.Add(objVisaDetails); } } BusinessEntities.RaveHRCollection objDeleteVisaDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[VISADETAILSDELETE]; if (objDeleteVisaDetailsCollection != null) { BusinessEntities.VisaDetails obj = null; for (int i = 0; i < objDeleteVisaDetailsCollection.Count; i++) { objVisaDetails = new BusinessEntities.VisaDetails(); obj = (BusinessEntities.VisaDetails)objDeleteVisaDetailsCollection.Item(i); objVisaDetails.VisaId = obj.VisaId; objVisaDetails.EMPId = obj.EMPId; objVisaDetails.CountryName = obj.CountryName; objVisaDetails.VisaType = obj.VisaType; objVisaDetails.ExpiryDate = obj.ExpiryDate; objVisaDetails.Mode = obj.Mode; objSaveVisaDetailsCollection.Add(objVisaDetails); } } } else { //delete visa details if exists. objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails(); objVisaDetailsBAL.DeleteVisaDetailsByEmpId(employeeID); } } else { employee.PassportNo = string.Empty; employee.PassportIssuePlace = string.Empty; employee.PassportIssueDate = DateTime.MinValue; employee.PassportExpireDate = DateTime.MinValue; //delete visa details if exists. objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails(); objVisaDetailsBAL.DeleteVisaDetailsByEmpId(employeeID); } Boolean Flag = false; objEmployeeBAL.UpdateEmployee(employee, Flag); objVisaDetailsBAL.Manipulation(objSaveVisaDetailsCollection); if (ViewState.Count > 0) { ViewState.Clear(); } //Refresh the grip after saving if (EMPId.Value != string.Empty) { int empID = Convert.ToInt32(EMPId.Value); //Refresh the grip after saving this.PopulateGrid(empID); } lblMessage.Text = "Passport details saved successfully."; } catch (RaveHRException ex) { LogErrorMessage(ex); } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } } }