/// <summary> /// Gets the professional details. /// </summary> /// <returns></returns> private BusinessEntities.RaveHRCollection GetVisaDetails(int employeeID) { Rave.HR.BusinessLayer.Employee.VisaDetails objVisaDetailsBAL; BusinessEntities.VisaDetails objVisaDetails; // Initialise Collection class object BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection(); try { objVisaDetailsBAL = new Rave.HR.BusinessLayer.Employee.VisaDetails(); objVisaDetails = new BusinessEntities.VisaDetails(); //objVisaDetails.EMPId = 14; objVisaDetails.EMPId = employeeID; raveHRCollection = objVisaDetailsBAL.GetVisaDetails(objVisaDetails); } catch (RaveHRException ex) { throw ex; } catch (Exception ex) { RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetVisaDetails", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER); LogErrorMessage(objEx); } return(raveHRCollection); }
/// <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); } } }