/// <summary>
 /// Handles Click event of btnAdd control
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
     CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
     currentDesiredJobEntity.RoleSkills = txtAddSkill.Text.Trim();
     currentDesiredJobBAL.AddRoleSkillsDetailsBAL(currentDesiredJobEntity);
     divAddMoreSkills.Visible = false;
 }
 /// <summary>
 /// Handles the Click event of btnSaveSkills Control
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void btnSaveSkills_Click(object sender, EventArgs e)
 {
     CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
     DataTable dt = (DataTable)ViewState["SkillDetails"];
     try
     {
         currentDesiredJobBAL.SaveRoleSkillsBAL(dt);
         Response.Write("<script language='javascript'>alert('Role Skills Details saved successfully')</script>");
     }
     catch (Exception)
     {
         // throw;
     }
     finally
     {
         dt = null;
         currentDesiredJobBAL = null;
     }
 }
        /// <summary>
        /// Handles ItemDataBound event of rptrRoleSkills control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrRoleSkills_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            DataSet dsRoleSkill = new DataSet();
            CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
            dsRoleSkill = currentDesiredJobBAL.ViewRoleSkillDetailsBAL(candidateId);
            string fromDate, tillDate;
            fromDate = Convert.ToString(dsRoleSkill.Tables[0].Rows[0]["FromDate"]); ;
            string[] Words = fromDate.Split(new char[] { '/' });
            int count = 0;
            tillDate = Convert.ToString(dsRoleSkill.Tables[0].Rows[0]["TillDate"]); ;
            string[] Words1 = tillDate.Split(new char[] { '/' });
            int count1 = 0;

            DropDownList ddlRoleSkill = (DropDownList)e.Item.FindControl("ddlRoleSkill");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataSet dsRoles = new DataSet();
                dsRoles = currentDesiredJobBAL.GetRoleSkillsBAL();
                if (dsRoles != null)
                {
                    ddlRoleSkill.DataSource = dsRoles;
                    ddlRoleSkill.DataTextField = "RoleName";
                    ddlRoleSkill.DataValueField = "RoleId";
                    ddlRoleSkill.DataBind();
                    ddlRoleSkill.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "RoleSkills"));
                }
            }
            DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear");
            DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> monthList = CommonUtil.Utility.GetMonths();
                ddlFromMonth.DataSource = monthList;

                ddlFromMonth.DataBind();

                List<string> yearList = CommonUtil.Utility.GetYears();
                ddlFromYear.DataSource = yearList;
                ddlFromYear.DataBind();

                foreach (string Word in Words)
                {
                    count += 1;
                    if (count == 1)
                    { ddlFromMonth.SelectedValue = Word; }
                    if (count == 2)
                    {
                        ddlFromYear.SelectedValue = Word;
                    }
                }
            }
            DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear");
            DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> monthList = CommonUtil.Utility.GetMonths();
                ddlTillMonth.DataSource = monthList;

                ddlTillMonth.DataBind();
                List<string> yearList = CommonUtil.Utility.GetYears();
                ddlTillYear.DataSource = yearList;
                ddlTillYear.DataBind();

                foreach (string Word in Words1)
                {
                    count1 += 1;
                    if (count1 == 1)
                    {
                        ddlTillMonth.SelectedValue = Word;
                    }
                    if (count1 == 2)
                    {
                        ddlTillYear.SelectedValue = Word;
                    }
                }
            }

            DropDownList ddlProficiency = (DropDownList)e.Item.FindControl("ddlProficiency");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                ddlProficiency.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Proficiency"));
            }
        }
        /// <summary>
        /// Handles ItemCommand event of rptrRoleSkills control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrRoleSkills_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Label lblRoleSkill = (Label)e.Item.FindControl("lblRoleSkill");
            Label lblFromDate = (Label)e.Item.FindControl("lblFromDate");
            Label lblTillDate = (Label)e.Item.FindControl("lblTillDate");
            Label lblProficiency = (Label)e.Item.FindControl("lblProficiency");

            DropDownList ddlRoleSkill = (DropDownList)e.Item.FindControl("ddlRoleSkill");
            //TextBox txtAddSkill = (TextBox)e.Item.FindControl("txtAddSkill");
            DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth");
            DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear");
            DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth");
            DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear");
            DropDownList ddlProficiency = (DropDownList)e.Item.FindControl("ddlProficiency");

            LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit");
            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate");
            LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel");
            // Check repeater commond for edit
            if (e.CommandName == "edit")
            {
                lblRoleSkill.Visible = false;
                lblFromDate.Visible = false;
                lblTillDate.Visible = false;
                lblProficiency.Visible = false;

                ddlRoleSkill.Visible = true;
                ddlFromMonth.Visible = true;
                ddlFromYear.Visible = true;
                ddlTillMonth.Visible = true;
                ddlTillYear.Visible = true;
                ddlProficiency.Visible = true;

                lnkEdit.Visible = false;
                lnkDelete.Visible = false;
                lnkUpdate.Visible = true;
                lnkCancel.Visible = true;
            }
            // Check repeater commond for update
            if (e.CommandName == "update")
            {
                CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
                currentDesiredJobEntity.RoleSkills = ddlRoleSkill.SelectedValue.Trim();
                currentDesiredJobEntity.FromDate = ddlFromMonth.SelectedItem.Text.Trim() + "/" + ddlFromYear.SelectedItem.Text.Trim();
                currentDesiredJobEntity.TillDate = ddlTillMonth.SelectedItem.Text.Trim() + "/" + ddlTillYear.SelectedItem.Text.Trim();
                currentDesiredJobEntity.Proficiency = ddlProficiency.SelectedItem.Text.Trim();
                currentDesiredJobEntity.SkillId = Convert.ToInt32(e.CommandArgument);
                currentDesiredJobEntity.TotalExperience = TotalYears();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.UpdateRoleSkillsBAL(currentDesiredJobEntity);
                BindRepeaterRoleSkills();
            }
            // Check repeater commond for delete
            if (e.CommandName == "delete")
            {
                int SkillId = Convert.ToInt32(e.CommandArgument);
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.DeleteRoleSkillBAL(SkillId);
                BindRepeaterRoleSkills();
            }
            // Check repeater commond for cancel
            if (e.CommandName == "cancel")
            {
                BindRepeaterRoleSkills();
            }
        }
 /// <summary>
 /// Method to Create Skills Records Table for gvSkillsDetails Control
 /// </summary>
 private void BindTechnicalSkills()
 {
     try
     {
         DataSet dsTechnicalSkill = new DataSet();
         CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
         dsTechnicalSkill = currentDesiredJobBAL.GetTechnicalSkillsDetailsBAL();
         // Check dataset is not null
         if (dsTechnicalSkill != null)
         {
             ddlTechnicalSkills.DataSource = dsTechnicalSkill;
             ddlTechnicalSkills.DataValueField = "TechnicalSkillId";
             ddlTechnicalSkills.DataTextField = "TechnicalSkillName";
             ddlTechnicalSkills.DataBind();
             ddlTechnicalSkills.Items.Insert(Convert.ToInt32(ddlTechnicalSkills.Items[ddlTechnicalSkills.Items.Count - 1].Value), new ListItem("----Other----", ""));
             ddlTechnicalSkills.Items.Insert(0, new ListItem("--Select--", "0"));
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
        /// <summary>
        /// Handles ItemDataBound event of rptrPastCurrentJobDetails control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrPastCurrentJobDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
            DropDownList ddlIndustry = (DropDownList)e.Item.FindControl("ddlIndustry");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //DataSet ds1 = new DataSet();

                //ds1 = currentDesiredJobBAL.ViewCurrentJobDetailsBAL(candidateId);
                //bindState();

                DataSet ds = new DataSet();
                ds = currentDesiredJobBAL.GetIndustry();
                if (ds != null)
                {
                    ddlIndustry.DataSource = ds;
                    ddlIndustry.DataTextField = "IndustryName";
                    ddlIndustry.DataValueField = "IndustryId";
                    ddlIndustry.DataBind();
                    ddlIndustry.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Industry"));
                }
            }
            DropDownList ddlDepartment = (DropDownList)e.Item.FindControl("ddlDepartment");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataSet ds1 = new DataSet();
                ds1 = currentDesiredJobBAL.GetDepartment();
                if (ds1 != null)
                {
                    ddlDepartment.DataSource = ds1;
                    ddlDepartment.DataTextField = "DepartmentName";
                    ddlDepartment.DataValueField = "DepartmentId";
                    ddlDepartment.DataBind();
                    ddlDepartment.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Department"));
                }
            }

            DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> monthList = CommonUtil.Utility.GetMonths();
                ddlFromMonth.DataSource = monthList;

                ddlFromMonth.DataBind();

                ddlFromMonth.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FromMonth"));
            }

            DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> monthList = CommonUtil.Utility.GetMonths();
                ddlTillMonth.DataSource = monthList;

                ddlTillMonth.DataBind();

                ddlTillMonth.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "TillMonth"));
            }

            DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> yearList = CommonUtil.Utility.GetYears();
                ddlFromYear.DataSource = yearList;
                ddlFromYear.DataBind();

                ddlFromYear.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FromYear"));
            }

            DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                List<string> yearList = CommonUtil.Utility.GetYears();
                ddlTillYear.DataSource = yearList;
                ddlTillYear.DataBind();

                ddlTillYear.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "TillYear"));
            }

            RadioButtonList rbtlEmployementStatus = (RadioButtonList)e.Item.FindControl("rbtlEmployementStatus");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                rbtlEmployementStatus.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "EmploymentStatus"));
            }

            RadioButtonList rblCompanyType = (RadioButtonList)e.Item.FindControl("rblCompanyType");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                rblCompanyType.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "CompanyType"));
            }

            RadioButtonList rblJobType = (RadioButtonList)e.Item.FindControl("rblJobType");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                rblJobType.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "JobType"));
            }
        }
        /// <summary>
        /// Handles the ItemCommand event of rptrPastCurrentJobDetails control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrPastCurrentJobDetails_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Label lblCurrentComapny = (Label)e.Item.FindControl("lblCurrentComapny");
            CheckBox chkCurrentYes = (CheckBox)e.Item.FindControl("chkCurrentYes");
            Label lblCompanyName = (Label)e.Item.FindControl("lblCompanyName");
            TextBox txtComapnyName = (TextBox)e.Item.FindControl("txtComapnyName");
            Label lblDesignation = (Label)e.Item.FindControl("lblDesignation");
            TextBox txtDesignation = (TextBox)e.Item.FindControl("txtDesignation");
            Label lblRolesResponsibility = (Label)e.Item.FindControl("lblRolesResponsibility");
            TextBox txtRolesResponsibility = (TextBox)e.Item.FindControl("txtRolesResponsibility");
            Label lblFromMonth = (Label)e.Item.FindControl("lblFromMonth");
            Label lblFromYear = (Label)e.Item.FindControl("lblFromYear");
            Label lblTillMonth = (Label)e.Item.FindControl("lblTillMonth");
            Label lblTillYear = (Label)e.Item.FindControl("lblTillYear");
            DropDownList ddlFromMonth = (DropDownList)e.Item.FindControl("ddlFromMonth");
            DropDownList ddlFromYear = (DropDownList)e.Item.FindControl("ddlFromYear");
            DropDownList ddlTillMonth = (DropDownList)e.Item.FindControl("ddlTillMonth");
            DropDownList ddlTillYear = (DropDownList)e.Item.FindControl("ddlTillYear");
            Label lbltillword = (Label)e.Item.FindControl("lbltillword");
            Label lblIndustry = (Label)e.Item.FindControl("lblIndustry");
            Label lblDepartment = (Label)e.Item.FindControl("lblDepartment");
            DropDownList ddlIndustry = (DropDownList)e.Item.FindControl("ddlIndustry");
            DropDownList ddlDepartment = (DropDownList)e.Item.FindControl("ddlDepartment");
            Label lblEmploymentStatus = (Label)e.Item.FindControl("lblEmploymentStatus");
            RadioButtonList rbtlEmployementStatus = (RadioButtonList)e.Item.FindControl("rbtlEmployementStatus");
            Label lblJobType = (Label)e.Item.FindControl("lblJobType");
            RadioButtonList rblJobType = (RadioButtonList)e.Item.FindControl("rblJobType");
            Label lblCompanyType = (Label)e.Item.FindControl("lblCompanyType");
            RadioButtonList rblCompanyType = (RadioButtonList)e.Item.FindControl("rblCompanyType");
            Label lblReasonforjobchange = (Label)e.Item.FindControl("lblReasonforjobchange");
            TextBox txtReasonforJobchange = (TextBox)e.Item.FindControl("txtReasonforJobchange");

            Label lblClientName = (Label)e.Item.FindControl("lblClientName");
            TextBox txtClientName = (TextBox)e.Item.FindControl("txtClientName");
            Label lblClientSite = (Label)e.Item.FindControl("lblClientSite");
            TextBox txtClientSite = (TextBox)e.Item.FindControl("txtClientSite");

            LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit");
            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate");
            LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel");

            if (e.CommandName == "edit")
            {
                lblCurrentComapny.Visible = false;
                chkCurrentYes.Visible = true;
                lblCompanyName.Visible = false;
                txtComapnyName.Visible = true;
                lblDesignation.Visible = false;
                txtDesignation.Visible = true;
                lblRolesResponsibility.Visible = false;
                txtRolesResponsibility.Visible = true;
                lblFromMonth.Visible = false;
                lblFromYear.Visible = false;
                lblTillMonth.Visible = false;
                lblTillYear.Visible = false;
                ddlFromMonth.Visible = true;
                ddlFromYear.Visible = true;
                ddlTillMonth.Visible = true;
                ddlTillYear.Visible = true;
                lbltillword.Visible = true;
                lblEmploymentStatus.Visible = false;
                rbtlEmployementStatus.Visible = true;
                lblJobType.Visible = false;
                rblJobType.Visible = true;
                lblCompanyType.Visible = false;
                rblCompanyType.Visible = true;
                lblReasonforjobchange.Visible = false;
                txtReasonforJobchange.Visible = true;

                lblIndustry.Visible = false;
                lblDepartment.Visible = false;

                ddlIndustry.Visible = true;
                ddlDepartment.Visible = true;

                lblClientName.Visible = false;
                lblClientSite.Visible = false;

                txtClientName.Visible = true;
                txtClientSite.Visible = true;

                lnkEdit.Visible = false;
                lnkDelete.Visible = false;
                lnkUpdate.Visible = true;
                lnkCancel.Visible = true;
            }
            if (e.CommandName == "update")
            {
                CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
                currentDesiredJobEntity.CurrentCompanyOrNot = chkCurrentYes.Checked.ToString();
                currentDesiredJobEntity.CompanyName = txtComapnyName.Text.Trim();
                currentDesiredJobEntity.Designation = txtDesignation.Text.Trim();
                currentDesiredJobEntity.Industry = ddlIndustry.SelectedValue;
                currentDesiredJobEntity.RolesResponsibility = lblRolesResponsibility.Text.Trim();
                currentDesiredJobEntity.FromMonth = ddlFromMonth.SelectedItem.Value;
                currentDesiredJobEntity.FromYear = ddlFromYear.SelectedItem.Value;
                currentDesiredJobEntity.TillMonth = ddlTillMonth.SelectedItem.Value;
                currentDesiredJobEntity.TillYear = ddlTillYear.SelectedItem.Value;
                currentDesiredJobEntity.CurrentEmploymentStatus = rbtlEmployementStatus.Text;
                currentDesiredJobEntity.JobType = rblJobType.Text;
                currentDesiredJobEntity.CompanyType = rblCompanyType.Text;
                currentDesiredJobEntity.ReasonForJobChange = txtReasonforJobchange.Text.Trim();
                currentDesiredJobEntity.ClientName = txtClientName.Text.Trim();
                currentDesiredJobEntity.ClientSite = txtClientSite.Text.Trim();

                currentDesiredJobEntity.Department = ddlDepartment.SelectedValue;

                currentDesiredJobEntity.ExpId = Convert.ToInt32(e.CommandArgument);
                DataSet ds = new DataSet();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.UpdateCurrentPastExperienceDetailsBAL(currentDesiredJobEntity);

                BindRepeaterCurrentPastExp();
            }
            if (e.CommandName == "delete")
            {
                int expId = Convert.ToInt32(e.CommandArgument);
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.DeleteCurrentPastJobDetailsBAL(expId);

                BindRepeaterCurrentPastExp();
            }
            if (e.CommandName == "cancel")
            {
                BindRepeaterCurrentPastExp();
            }
        }
 /// <summary>
 /// Method to Bind department ddlDepartment & ddlDepartment123 control
 /// </summary>
 private void BindDepartment()
 {
     CurrentDesiredJobBAL currentjobBAL = new CurrentDesiredJobBAL();
     try
     {
         DataSet ds = new DataSet();
         ds = currentjobBAL.GetDepartment();
         if (ds != null)
         {
             ddlDepartment.DataSource = ds;
             ddlDepartment123.DataSource = ds;
             ddlDepartment.DataTextField = "DepartmentName";
             ddlDepartment.DataValueField = "DepartmentId";
             ddlDepartment123.DataTextField = "DepartmentName";
             ddlDepartment123.DataValueField = "DepartmentId";
             ddlDepartment.DataBind();
             ddlDepartment123.DataBind();
             ddlDepartment123.Items.Insert(0, new ListItem("--Select--", "0"));
             ddlDepartment.Items.Insert(0, new ListItem("--Select--", "0"));
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
        /// <summary>
        /// Handles the Load event of Page
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //isEdit = Convert.ToBoolean(Request.QueryString["isCheck"]);
            // Check session is not null
            //if (Session["candidateId"] != null)
            //{
            //    if (Session["candidateId"].ToString() != "")
            //    {
            //        candidateId = Convert.ToString(Session["candidateId"]);
            // Check page is not post back
            if (!IsPostBack)
            {
                if (isEdit)
                {
                    try
                    {
                        divCurrentEmployer.Visible = false;
                        divAddMoreJob.Visible = false;
                        divCurrntPastJobDetails.Visible = true;
                        divJobPostLookingFor.Visible = true;

                        BindIndustry();
                        BindDepartment();
                        BindFunctionalArea();
                        hfCandidateId.Value = candidateId;
                        BindRepeaterJobPostLooking();
                        BindRepeaterCurrentPastExp();

                        DataSet ds = new DataSet();
                        DataSet ds2 = new DataSet();
                        CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                        ds = currentDesiredJobBAL.ViewCurrentJobDetailsBAL(candidateId);

                        // Bind Country
                        DataSet datasetCountry = new DataSet();

                        datasetCountry = currentDesiredJobBAL.GetCountry();
                        ddlPreferredCountry.DataSource = datasetCountry;
                        ddlPreferredCountry.DataTextField = "CountryName";
                        ddlPreferredCountry.DataValueField = "CountryId";
                        ddlPreferredCountry.DataBind();

                        ddlPreferredCountry.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["PreferredCountry"]);

                        // Bind State
                        int countryId = Convert.ToInt32(ds.Tables[0].Rows[0]["PreferredCountry"]);
                        DataSet datasetState = new DataSet();
                        datasetState = currentDesiredJobBAL.GetState(countryId);
                        chklState.DataSource = datasetState;
                        chklState.DataValueField = "StateId";
                        chklState.DataTextField = "StateName";
                        chklState.DataBind();

                        string stateId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredState"]);
                        List<string> listofState = new List<string>(stateId.Split(','));
                        listofState.RemoveAll(x => x == "");

                        foreach (ListItem item in chklState.Items)
                        {
                            item.Selected = listofState.Contains(item.Value);
                        }

                        var selectedState = chklState.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtPreferredState.Text = string.Join(",", selectedState.Select(x => x.Text));

                        // Bind City
                        DataSet getcityDataSet = new DataSet();
                        getcityDataSet = currentDesiredJobBAL.GetCity(stateId);
                        chklCity.DataSource = getcityDataSet;
                        chklCity.DataTextField = "cityName";
                        chklCity.DataValueField = "cityID";
                        chklCity.DataBind();

                        string cityId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredCity"]);
                        List<string> listofCity = new List<string>(cityId.Split(','));
                        listofCity.RemoveAll(x => x == "");
                        foreach (ListItem list in chklCity.Items)
                        {
                            list.Selected = listofCity.Contains(list.Value);
                        }
                        var selectedCity = chklCity.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtCity.Text = string.Join(",", selectedCity.Select(x => x.Text));

                        // Bind CityArea
                        DataSet datasetCityArea = new DataSet();
                        datasetCityArea = currentDesiredJobBAL.GetArea(cityId);
                        chklArea.DataSource = datasetCityArea;
                        chklArea.DataValueField = "AreaId";
                        chklArea.DataTextField = "AreaName";
                        chklArea.DataBind();

                        string areaId = Convert.ToString(ds.Tables[0].Rows[0]["PreferredArea"]);
                        List<string> listofArea = new List<string>(areaId.Split(','));
                        listofArea.RemoveAll(x => x == "");
                        foreach (ListItem list in chklArea.Items)
                        {
                            list.Selected = listofArea.Contains(list.Value);
                        }

                        var selectedarea = chklArea.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                        txtarea.Text = string.Join(",", selectedarea.Select(x => x.Text));

                        txtResumeHeadline.Text = Convert.ToString(ds.Tables[0].Rows[0]["ResumeHeadline"]);
                        txtObjective.Text = Convert.ToString(ds.Tables[0].Rows[0]["Objective"]);
                        txtProfileSummary.Text = Convert.ToString(ds.Tables[0].Rows[0]["ProfileSummary"]);
                        lblTotalExp.Text = Convert.ToString(ds.Tables[0].Rows[0]["TotalExpriance"]);
                        txtcurrentannualsalary.Text = Convert.ToString(ds.Tables[0].Rows[0]["CurrentAnualSalary"]);
                        txtexpectedsalary.Text = Convert.ToString(ds.Tables[0].Rows[0]["ExpectedAnualSalary"]);

                        ddlWorkStatus.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["CurrentWorkingStatus"]);
                        ddlNoticePeriod.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["NoticePeriod"]);

                        string employmentstatus = Convert.ToString(ds.Tables[0].Rows[0]["EmploymentStatus"]);
                        List<string> listofemploymentstatus = new List<string>(employmentstatus.Split(','));
                        foreach (ListItem list in chklEmploymentStatus.Items)
                        {
                            list.Selected = listofemploymentstatus.Contains(list.Value);
                        }

                        //chklEmploymentStatus.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["EmploymentStatus"]);

                        string jobtype = Convert.ToString(ds.Tables[0].Rows[0]["JobType"]);
                        List<string> listjobtype = new List<string>(jobtype.Split(','));
                        foreach (ListItem list in chklJobType.Items)
                        {
                            list.Selected = listjobtype.Contains(list.Value);
                        }

                        //chklJobType.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["JobType"]);

                        string companytype = Convert.ToString(ds.Tables[0].Rows[0]["CompanyType"]);
                        List<string> listcompanytype = new List<string>(companytype.Split(','));
                        foreach (ListItem list in chklCompanyType.Items)
                        {
                            list.Selected = listcompanytype.Contains(list.Value);
                        }

                        //chklCompanyType.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["CompanyType"]);
                        rblYesNo.SelectedValue = Convert.ToString(ds.Tables[0].Rows[0]["AvailabilityForInterview"]);

                        string format = Convert.ToString(ds.Tables[0].Rows[0]["BeforeTime"]);
                        string[] Words = format.Split(new char[] { ':' });
                        int count1 = 0;
                        string format1 = Convert.ToString(ds.Tables[0].Rows[0]["AfterTime"]);
                        string[] Words1 = format1.Split(new char[] { ':' });
                        int count2 = 0;

                        foreach (string Word in Words)
                        {
                            count1 += 1;
                            if (count1 == 1)
                            { ddlBeforeHours.SelectedValue = Word; }
                            if (count1 == 2)
                            { ddlBeforeMinutes.SelectedValue = Word; }
                            if (count1 == 3)
                            { ddlBeforeTime.SelectedValue = Word; }
                        }

                        foreach (string word in Words1)
                        {
                            count2 += 1;
                            if (count2 == 1)
                            { ddlAfterHours.SelectedValue = word; }
                            if (count2 == 2)
                            { ddlAfterMinutes.SelectedValue = word; }
                            if (count2 == 3)
                            { ddlAfterTime.SelectedValue = word; }
                            if (count2 == 4)
                            { ddlISTETE.SelectedValue = word; }
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
                else
                {
                    CalendarExtender2.EndDate = DateTime.Now;
                    BindCountry();
                    //BindMonth();
                    //BindYear();

                    BindFunctionalArea();
                    BindIndustry();
                    BindDepartment();
                    hfCandidateId.Value = candidateId;
                    AddExperienceRecords();
                    BindExperienceGrid();
                    AddJobLookingRecords();
                    BindJobPostLookingGrid();
                }
            }
            //    }
            //}
        }
        /// <summary>
        /// Handles SelectedIndexChanged event of ddlPreferredCountry control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void ddlPreferredCountry_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DataSet ds = new DataSet();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                int countryId = Convert.ToInt32(ddlPreferredCountry.SelectedValue);
                ds = currentDesiredJobBAL.GetState(countryId);
                if (ds != null)
                {
                    chklState.DataSource = ds;
                    chklState.DataTextField = "StateName";
                    chklState.DataValueField = "StateId";
                    chklState.DataBind();
                    //chklState.Items.Insert(0, new ListItem("--Select--", "0"));
                }

                //}
            }
            catch (Exception)
            {
                // throw;
            }
        }
        /// <summary>
        /// Handles SelectedIndexChanged event of chklState control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void chklState_SelectedIndexChanged(object sender, EventArgs e)
        {
            //var selectedcity = chklCity.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
            //txtCity.Text = string.Join(",", selectedcity.Select(x => x.Text));

            try
            {
                var selectedstate = chklState.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                txtPreferredState.Text = string.Join(",", selectedstate.Select(x => x.Text));
                DataSet ds = new DataSet();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();

                string stateId = string.Join(",", selectedstate.Select(x => x.Value));
                ds = currentDesiredJobBAL.GetCityBAL(stateId);
                if (ds != null)
                {
                    chklCity.DataSource = ds;
                    chklCity.DataTextField = "CityName";
                    chklCity.DataValueField = "CityId";
                    chklCity.DataBind();
                }

                //}
            }
            catch (Exception)
            {
                // throw;
            }
        }
 private void BindRepeaterJobPostLooking()
 {
     try
     {
         DataSet dsJobPostLooking = new DataSet();
         CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
         dsJobPostLooking = currentDesiredJobBAL.ViewJobPostLookingBAL(candidateId);
         if (dsJobPostLooking != null)
         {
             rptrJobPostLookinFor.DataSource = dsJobPostLooking;
              rptrJobPostLookinFor.DataBind();
         }
     }
     catch (Exception)
     {
         //  throw;
     }
 }
 private void BindRepeaterCurrentPastExp()
 {
     try
     {
         DataSet dsCurrentPastExperience = new DataSet();
         CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
         dsCurrentPastExperience = currentDesiredJobBAL.ViewCurrentPastJobDetailsBAL(candidateId);
         if (dsCurrentPastExperience != null)
         {
             rptrPastCurrentJobDetails.DataSource = dsCurrentPastExperience;
             rptrPastCurrentJobDetails.DataBind();
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
        /// <summary>
        /// Method to Bind industry to ddlIndustry & ddlIndustry123 control
        /// </summary>
        private void BindIndustry()
        {
            CurrentDesiredJobBAL currentjobBAL = new CurrentDesiredJobBAL();
            DataSet ds = new DataSet();
            try
            {
                ds = currentjobBAL.GetIndustry();
                if (ds != null)
                {
                    ddlIndustry.DataSource = ds;
                    ddlIndustry123.DataSource = ds;

                    ddlIndustry.DataTextField = "IndustryName";
                    ddlIndustry.DataValueField = "IndustryId";
                    ddlIndustry123.DataTextField = "IndustryName";
                    ddlIndustry123.DataValueField = "IndustryId";
                    ddlIndustry.DataBind();
                    ddlIndustry123.DataBind();
                    ddlIndustry123.Items.Insert(0, new ListItem("--Select--", "0"));
                    ddlIndustry.Items.Insert(0, new ListItem("--Select--", "0"));
                }
            }
            catch (Exception)
            {
                // throw;
            }
            finally
            {
                ds = null;
            }
        }
 /// <summary>
 /// Method to Bind years to ddlFromYear & ddlTillYear control
 /// </summary>
 //private void BindYear()
 //{
 //    try
 //    {
 //        // Bind Year List
 //        List<string> yearList = CommonUtil.Utility.GetYears();
 //        ddlFromYear.DataSource = yearList;
 //        ddlFromYear.DataBind();
 //        ddlTillYear.DataSource = yearList;
 //        ddlTillYear.DataBind();
 //    }
 //    catch (Exception)
 //    {
 //        // throw;
 //    }
 //}
 /// <summary>
 /// Method to Bind months to ddlFromMonth & ddlTillMonth control
 /// </summary>
 //private void BindMonth()
 //{
 //    try
 //    {
 //        List<string> monthList = CommonUtil.Utility.GetMonths();
 //        ddlFromMonth.DataSource = monthList;
 //        ddlTillMonth.DataSource = monthList;
 //        ddlFromMonth.DataBind();
 //        ddlTillMonth.DataBind();
 //    }
 //    catch (Exception)
 //    {
 //        // throw;
 //    }
 //}
 /// <summary>
 /// Method to Bind FunctionalArea to ddlFunctionalRole control
 /// </summary>
 private void BindFunctionalArea()
 {
     CurrentDesiredJobBAL currentjobBAL = new CurrentDesiredJobBAL();
     DataSet ds = new DataSet();
     try
     {
         ds = currentjobBAL.GetFunctionalArea();
         if (ds != null)
         {
             ddlFunctionalRole.DataSource = ds;
             ddlFunctionalArea.DataSource = ds;
             ddlFunctionalRole.DataTextField = "FunctionalArea";
             ddlFunctionalRole.DataValueField = "FunctionalAreaId";
             ddlFunctionalArea.DataValueField = "FunctionalAreaId";
             ddlFunctionalArea.DataTextField = "FunctionalArea";
             ddlFunctionalArea.DataBind();
             ddlFunctionalRole.DataBind();
             ddlFunctionalRole.Items.Insert(0, new ListItem("--Select--", "0"));
             ddlFunctionalArea.Items.Insert(0, new ListItem("--Select--", "0"));
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
 /// <summary>
 /// Bind repeater for roleskills
 /// </summary>
 private void BindRepeaterRoleSkills()
 {
     try
     {
         DataSet dsRoleSkills = new DataSet();
         CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
         dsRoleSkills = currentDesiredJobBAL.ViewRoleSkillDetailsBAL(candidateId);
         // Check dataset is not null
         if (dsRoleSkills != null)
         {
             rptrRoleSkills.DataSource = dsRoleSkills;
             rptrRoleSkills.DataBind();
         }
     }
     catch (Exception)
     {
         // throw;
     }
 }
        /// <summary>
        /// Method to bind role skills to ddlRoleSkills Control
        /// </summary>
        private void BindRoleSkills()
        {
            DataSet dsRoles = new DataSet();
            CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
            try
            {
                dsRoles = currentDesiredJobBAL.GetRoleSkillsBAL();
                // Check dataset is not null
                if (dsRoles != null)
                {
                    ddlRoleSkills.DataSource = dsRoles;
                    ddlRoleSkills.DataTextField = "RoleName";
                    ddlRoleSkills.DataValueField = "RoleId";
                    ddlRoleSkills.DataBind();

                    ddlRoleSkills.Items.Insert(Convert.ToInt32(ddlRoleSkills.Items.Count), new ListItem("----Other----", ""));
                    ddlRoleSkills.Items.Insert(0, new ListItem("--Select--", "0"));
                }
            }
            catch (Exception)
            {
                // throw;
            }
        }
        /// <summary>
        /// Handles ItemCommand event of rptrJobPostLookinFor control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrJobPostLookinFor_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Label lblJobPostLooking = (Label)e.Item.FindControl("lblJobPostLooking");
            Label lblIndustry = (Label)e.Item.FindControl("lblIndustry");
            Label lblDepartment = (Label)e.Item.FindControl("lblDepartment");
            Label lblFunctionalRole = (Label)e.Item.FindControl("lblFunctionalRole");
            Label lblRelevantExperience = (Label)e.Item.FindControl("lblRelevantExperience");
            TextBox txtJobPostLooking = (TextBox)e.Item.FindControl("txtJobPostLooking");
            DropDownList ddlIndustry123 = (DropDownList)e.Item.FindControl("ddlIndustry123");
            DropDownList ddlDepartment123 = (DropDownList)e.Item.FindControl("ddlDepartment123");
            DropDownList ddlFunctionalRole = (DropDownList)e.Item.FindControl("ddlFunctionalRole");
            TextBox txtRelevantExperience = (TextBox)e.Item.FindControl("txtRelevantExperience");
            LinkButton lnkEdit = (LinkButton)e.Item.FindControl("lnkEdit");
            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            LinkButton lnkUpdate = (LinkButton)e.Item.FindControl("lnkUpdate");
            LinkButton lnkCancel = (LinkButton)e.Item.FindControl("lnkCancel");

            if (e.CommandName == "edit")
            {
                lblJobPostLooking.Visible = false;
                lblIndustry.Visible = false;
                lblDepartment.Visible = false;
                lblFunctionalRole.Visible = false;
                lblRelevantExperience.Visible = false;
                txtJobPostLooking.Visible = true;
                ddlIndustry123.Visible = true;
                ddlDepartment123.Visible = true;
                ddlFunctionalRole.Visible = true;
                txtRelevantExperience.Visible = true;
                lnkEdit.Visible = false;
                lnkDelete.Visible = false;
                lnkUpdate.Visible = true;
                lnkCancel.Visible = true;
            }
            if (e.CommandName == "update")
            {
                CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
                currentDesiredJobEntity.JobPostLookingFor = txtJobPostLooking.Text;
                currentDesiredJobEntity.Industry = ddlIndustry123.SelectedValue;

                currentDesiredJobEntity.Department = ddlDepartment123.SelectedValue;
                currentDesiredJobEntity.FunctionalRole = ddlFunctionalRole.SelectedValue;
                currentDesiredJobEntity.RelevantExp = txtRelevantExperience.Text;
                currentDesiredJobEntity.JobPostLookingId = Convert.ToInt32(e.CommandArgument);
                DataSet ds = new DataSet();
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.UpdateJobLookingBAL(currentDesiredJobEntity);

                BindRepeaterJobPostLooking();
            }
            if (e.CommandName == "delete")
            {
                int JobpostlookingId = Convert.ToInt32(e.CommandArgument);
                CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
                currentDesiredJobBAL.DeleteJobPostLookingForBAL(JobpostlookingId);

                BindRepeaterJobPostLooking();
            }
            if (e.CommandName == "cancel")
            {
                BindRepeaterJobPostLooking();
            }
        }
        /// <summary>
        /// Handles ItemDataBound event of rptrJobPostLookinFor control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void rptrJobPostLookinFor_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
            DropDownList ddlIndustry123 = (DropDownList)e.Item.FindControl("ddlIndustry123");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                //DataSet ds1 = new DataSet();

                //ds1 = currentDesiredJobBAL.ViewCurrentJobDetailsBAL(candidateId);
                //bindState();

                DataSet ds = new DataSet();
                ds = currentDesiredJobBAL.GetIndustry();
                if (ds != null)
                {
                    ddlIndustry123.DataSource = ds;
                    ddlIndustry123.DataTextField = "IndustryName";
                    ddlIndustry123.DataValueField = "IndustryId";
                    ddlIndustry123.DataBind();
                    ddlIndustry123.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Industry"));
                }
            }
            DropDownList ddlDepartment123 = (DropDownList)e.Item.FindControl("ddlDepartment123");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataSet ds1 = new DataSet();
                ds1 = currentDesiredJobBAL.GetDepartment();
                if (ds1 != null)
                {
                    ddlDepartment123.DataSource = ds1;
                    ddlDepartment123.DataTextField = "DepartmentName";
                    ddlDepartment123.DataValueField = "DepartmentId";
                    ddlDepartment123.DataBind();
                    ddlDepartment123.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "Department"));
                }
            }
            DropDownList ddlFunctionalRole = (DropDownList)e.Item.FindControl("ddlFunctionalRole");
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataSet ds2 = new DataSet();

                ds2 = currentDesiredJobBAL.GetFunctionalArea();
                if (ds2 != null)
                {
                    ddlFunctionalRole.DataSource = ds2;
                    ddlFunctionalRole.DataTextField = "FunctionalArea";
                    ddlFunctionalRole.DataValueField = "FunctionalAreaId";
                    ddlFunctionalRole.DataBind();
                    ddlFunctionalRole.SelectedValue = Convert.ToString(DataBinder.Eval(e.Item.DataItem, "FunctionalRole"));
                }
            }
        }
        /// <summary>
        /// Handles the Click event of btnSaveMoreJobs control
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void btnSaveMoreJobs_Click(object sender, EventArgs e)
        {
            CurrentDesiredJobBAL currentDesiredJobBAL = new CurrentDesiredJobBAL();
            CurrentDesiredJobEntity currentDesiredJobEntity = new CurrentDesiredJobEntity();
            var selectedcity = chklCity.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
            var selectedarea = chklArea.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
            var selectedstate = chklState.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
            DataTable dtJobDetails = (DataTable)ViewState["JobDetails"];
            DataTable dtAddExperience = (DataTable)ViewState["ProfessionalDetails"];
            try
            {
                if (!isEdit)
                {
                    currentDesiredJobEntity.Candidateid = hfCandidateId.Value.Trim();
                    currentDesiredJobEntity.Objective = txtObjective.Text.Trim();
                    currentDesiredJobEntity.ProfileSummary = txtProfileSummary.Text.Trim();
                    if (rbtEmployed.Checked)
                    {
                        currentDesiredJobEntity.CurrentEmployeedUnemployeed = rbtEmployed.Text.Trim();
                    }
                    else
                    {
                        currentDesiredJobEntity.CurrentEmployeedUnemployeed = rbtUnEmployed.Text.Trim();
                    }
                    currentDesiredJobEntity.TotalExperience = lblTotalExp.Text;
                    currentDesiredJobEntity.ResumeHeadline = txtResumeHeadline.Text.Trim();
                    currentDesiredJobEntity.CurrentWorkingStatus = ddlWorkStatus.SelectedItem.Text.Trim();
                    currentDesiredJobEntity.CurrentAnualSal = Convert.ToDouble(txtcurrentannualsalary.Text);
                    currentDesiredJobEntity.ExpectedAnualSal = Convert.ToDouble(txtexpectedsalary.Text);
                    currentDesiredJobEntity.NoticePeriod = ddlNoticePeriod.SelectedItem.Text.Trim();

                    var selectedStatus = chklEmploymentStatus.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.EmploymentStatus = string.Join(",", selectedStatus.Select(x => x.Text));

                    var selectedJobType = chklJobType.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.JobType = string.Join(",", selectedJobType.Select(x => x.Text));

                    var selectedCompanyType = chklCompanyType.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.CompanyType = string.Join(",", selectedCompanyType.Select(x => x.Text));

                    currentDesiredJobEntity.Availabilityforinterview = rblYesNo.SelectedItem.Text;
                    currentDesiredJobEntity.TimeInWeekdays = "From" + ddlBeforeHours.SelectedItem.Text + "." + ddlBeforeMinutes.SelectedItem.Text + " " + ddlBeforeTime.SelectedItem.Text + " To " + ddlAfterHours.SelectedItem.Text + "." + ddlAfterMinutes.SelectedItem.Text + " " + ddlAfterTime.SelectedItem.Text + " " + ddlISTETE.SelectedItem.Text;
                    currentDesiredJobEntity.PreferredCountry = Convert.ToInt32(ddlPreferredCountry.SelectedValue);
                    currentDesiredJobEntity.PreferredState = string.Join(",", selectedstate.Select(x => x.Value));
                    currentDesiredJobEntity.PreferredCity = string.Join(",", selectedcity.Select(x => x.Value));
                    currentDesiredJobEntity.PreferrefArea = string.Join(",", selectedarea.Select(x => x.Value));

                    currentDesiredJobEntity.BeforeTime = ddlBeforeHours.SelectedItem.Text + ":" + ddlBeforeMinutes.SelectedItem.Text + ":" + ddlBeforeTime.SelectedItem.Text;

                    currentDesiredJobEntity.AfterTime = ddlAfterHours.SelectedItem.Text + ":" + ddlAfterMinutes.SelectedItem.Text + ":" + ddlAfterTime.SelectedItem.Text + ":" + ddlISTETE.SelectedItem.Text;
                    currentDesiredJobBAL.SaveExperienceDetailsBAL(dtAddExperience);
                    currentDesiredJobBAL.SaveJobLookingDetailsBAL(dtJobDetails);
                    currentDesiredJobBAL.SaveDesiredJobDetailsBAL(currentDesiredJobEntity);
                    currentDesiredJobBAL.SaveJobDetailsBAL(currentDesiredJobEntity);
                    Response.Write("<script language='javascript'>alert('Details saved successfully')</script>");
                }
                else
                {
                    currentDesiredJobEntity.Candidateid = hfCandidateId.Value.Trim();
                    currentDesiredJobEntity.Objective = txtObjective.Text.Trim();
                    currentDesiredJobEntity.ProfileSummary = txtProfileSummary.Text.Trim();
                    if (rbtEmployed.Checked)
                    {
                        currentDesiredJobEntity.CurrentEmployeedUnemployeed = rbtEmployed.Text.Trim();
                    }
                    else
                    {
                        currentDesiredJobEntity.CurrentEmployeedUnemployeed = rbtUnEmployed.Text.Trim();
                    }
                    currentDesiredJobEntity.TotalExperience = lblTotalExp.Text;
                    currentDesiredJobEntity.ResumeHeadline = txtResumeHeadline.Text.Trim();
                    currentDesiredJobEntity.CurrentWorkingStatus = ddlWorkStatus.SelectedItem.Text.Trim();
                    currentDesiredJobEntity.CurrentAnualSal = Convert.ToDouble(txtcurrentannualsalary.Text);
                    currentDesiredJobEntity.ExpectedAnualSal = Convert.ToDouble(txtexpectedsalary.Text);
                    currentDesiredJobEntity.NoticePeriod = ddlNoticePeriod.SelectedItem.Text.Trim();

                    var selectedStatus = chklEmploymentStatus.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.EmploymentStatus = string.Join(",", selectedStatus.Select(x => x.Text));

                    var selectedJobType = chklJobType.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.JobType = string.Join(",", selectedJobType.Select(x => x.Text));

                    var selectedCompanyType = chklCompanyType.Items.Cast<ListItem>().Where(li => li.Selected).ToList();
                    currentDesiredJobEntity.CompanyType = string.Join(",", selectedCompanyType.Select(x => x.Text));

                    currentDesiredJobEntity.Availabilityforinterview = rblYesNo.SelectedItem.Text;
                    currentDesiredJobEntity.TimeInWeekdays = "From" + ddlBeforeHours.SelectedItem.Text + "." + ddlBeforeMinutes.SelectedItem.Text + " " + ddlBeforeTime.SelectedItem.Text + " To " + ddlAfterHours.SelectedItem.Text + "." + ddlAfterMinutes.SelectedItem.Text + " " + ddlAfterTime.SelectedItem.Text + " " + ddlISTETE.SelectedItem.Text;
                    currentDesiredJobEntity.PreferredCountry = Convert.ToInt32(ddlPreferredCountry.SelectedValue);
                    currentDesiredJobEntity.PreferredState = string.Join(",", selectedstate.Select(x => x.Value));
                    currentDesiredJobEntity.PreferredCity = string.Join(",", selectedcity.Select(x => x.Value));
                    currentDesiredJobEntity.PreferrefArea = string.Join(",", selectedarea.Select(x => x.Value));

                    currentDesiredJobEntity.BeforeTime = ddlBeforeHours.SelectedItem.Text + ":" + ddlBeforeMinutes.SelectedItem.Text + ":" + ddlBeforeTime.SelectedItem.Text;

                    currentDesiredJobEntity.AfterTime = ddlAfterHours.SelectedItem.Text + ":" + ddlAfterMinutes.SelectedItem.Text + ":" + ddlAfterTime.SelectedItem.Text + ":" + ddlISTETE.SelectedItem.Text;

                    currentDesiredJobBAL.UpdateProfessionalDetailsBAL(currentDesiredJobEntity);
                    Response.Write("<script language='javascript'>alert('Your Details Updated successfully')</script>");
                }
            }
            catch (Exception)
            {
                // throw;
            }
            finally
            {
                dtJobDetails = null;
                dtAddExperience = null;
                currentDesiredJobBAL = null;
            }
        }