//private void FillReportingBossName()
        //{
        //    try
        //    {
        //        //     string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
        //        ddlReportingTo.DataSource = empSetupDal.GetPersonInfo().ToList();
        //        ddlReportingTo.DataTextField = "FirstName";
        //        ddlReportingTo.DataValueField = "EID";
        //        ddlReportingTo.DataBind();
        //        ddlReportingTo.Items.Insert(0, new ListItem("--Select--", "0"));
        //    }
        //    catch (Exception ex)
        //    {
        //        throw ex;
        //    }
        //}

        // Employeement Data
        private void GetEmployemntInfo(string employeeid)
        {
            try
            {
                string Ocode = ((SessionUser)Session["SessionUser"]).OCode;

                HRM_PersonalInformations _personalInfo = employeeBll.getPersonalInfosByID(employeeid);

                if (_personalInfo.RegionsId != null)
                {
                    var employments = employeeBll.GetEmployemntInfo(employeeid, Ocode);
                    foreach (var item in employments)
                    {
                        lblRegion.Text           = item.RegionName;
                        lblOffice.Text           = item.OfficeName;
                        lblDepartment.Text       = item.DepartmentName;
                        lblSection.Text          = item.SectionName;
                        lblSubSction.Text        = item.SubSectionName;
                        lblGrade.Text            = item.GradeName;
                        lblDesignation.Text      = item.Desgination;
                        lblCategoryName.Text     = item.Category;
                        lblShit.Text             = item.TimeShifting + "-" + item.ShiftCode;
                        lblJoiningDate.Text      = ConvertDate(item.JoiningDate.ToString());
                        lblJobResposibility.Text = item.JobResponsibility;
                        lblEmployeeType.Text     = item.EmployeeTypeName;
                        lblEffectiveSlary.Text   = Convert.ToDecimal(item.EffectiveSlary).ToString("#,##0.00");
                        lblGrade.Text            = item.Grade;
                        if (item.OTApplicable == true)
                        {
                            lblOtApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblOtApplicable.Text = "No";
                        }

                        if (item.Attendance_Bouns == true)
                        {
                            lblAttendanceApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblAttendanceApplicable.Text = "No";
                        }

                        if (item.Late_Applicable == true)
                        {
                            lblLateApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblLateApplicable.Text = "No";
                        }

                        if (item.Absence_Applicable == true)
                        {
                            lblAbsenceApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblAbsenceApplicable.Text = "No";
                        }

                        if (item.Tax_Applicable == true)
                        {
                            lblTaxApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblTaxApplicable.Text = "No";
                        }

                        if (item.PF_Applicable == true)
                        {
                            lblPFApplicable.Text = "Yes";
                        }
                        else
                        {
                            lblPFApplicable.Text = "No";
                        }
                        // lblOtApplicable.Text = item.OTApplicable.ToString();
                        // lblAttendanceApplicable.Text = item.Attendance_Bouns.ToString();
                        //lblAbsenceApplicable.Text = item.Absence_Applicable.ToString();
                        // lblTaxApplicable.Text = item.Tax_Applicable.ToString();
                        // lblPFApplicable.Text = item.PF_Applicable.ToString();
                        // lblLateApplicable.Text = item.Late_Applicable.ToString();
                        lblProbationPeriodFrom.Text = ConvertDate(item.ProbationPeriodFrom.ToString());
                        lblProbationPeriodTo.Text   = ConvertDate(item.ProbationPeriodTo.ToString());
                        lblConfirmationDate.Text    = ConvertDate(item.ConfiramtionDate.ToString());
                        lblGossSalary.Text          = Convert.ToDecimal(item.Salary).ToString("#,##0.00");

                        //lblReportingBoss.Text = item.ReportinBoss;

                        //Step-1
                        //int? step = item.Step;
                        //if (step == 1)
                        //{
                        //    lblStep.Text = "Step-1";
                        //}
                        //else if (step == 2)
                        //{
                        //    lblStep.Text = "Step-2";
                        //}
                        //else if (step == 3)
                        //{
                        //    lblStep.Text = "Step-3";
                        //}
                        //else if (step == 4)
                        //{
                        //    lblStep.Text = "Step-4";
                        //}
                        //else if (step == 5)
                        //{
                        //    lblStep.Text = "Step-5";
                        //}
                        //else if (step == 6)
                        //{
                        //    lblStep.Text = "Step-6";
                        //}

                        // Bank Info
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void btnSave_click(object sender, EventArgs e)
        {
            try
            {
                if (txtEid_TRNS.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input E-ID')", true);
                }
                else if (drpLeaveType.SelectedItem.ToString() == "--Select--")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Leave Type')", true);
                }
                else if (txtbxFromDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input From Date')", true);
                }
                else if (txtbxToDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Date')", true);
                }
                else
                {
                    if (!IsExist())
                    {
                        string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                        int    count = objLeave_BLL.GetLastRowNumber(OCODE);
                        int    total = count + 1;
                        string Code  = " LC" + total;

                        string thirdReportingBoss              = null;
                        string secondReportingBoss             = null;
                        string hrmreportinBoss                 = null;
                        HRM_PersonalInformations _personalinfo = objEmp_BLL.getPersonalInfosByID(txtEid_TRNS.Text);
                        if (_personalinfo.ReportingBossId != null)
                        {
                            hrmreportinBoss = _personalinfo.ReportingBossId.ToString();
                        }
                        if (_personalinfo.SecondReportingBossId != null)
                        {
                            secondReportingBoss = _personalinfo.SecondReportingBossId.ToString();
                        }
                        if (_personalinfo.ThirdReportingBossId != null)
                        {
                            thirdReportingBoss = _personalinfo.ThirdReportingBossId.ToString();
                        }
                        DateTime DateTimeFrom = Convert.ToDateTime(txtbxFromDate.Text);
                        DateTime DateTo       = Convert.ToDateTime(txtbxToDate.Text);
                        List <HRM_LeaveApply> leaveApplyesDates = new List <HRM_LeaveApply>();
                        for (int i = 0; i < Convert.ToInt16(txtbxTotalDay.Text); i++)
                        {
                            HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                            leaveApplyObj.LeaveCode        = Code;
                            leaveApplyObj.OCODE            = OCODE;
                            leaveApplyObj.LeaveDates       = DateTimeFrom.AddDays(i);
                            leaveApplyObj.LeaveAppliedDate = Convert.ToDateTime(txtbxFromDate.Text);
                            leaveApplyObj.LeaveToDate      = Convert.ToDateTime(txtbxToDate.Text);
                            leaveApplyObj.Eid                         = txtEid_TRNS.Text;
                            leaveApplyObj.LeaveTypeId                 = Convert.ToInt16(drpLeaveType.SelectedValue.ToString());
                            leaveApplyObj.LeaveCurrentYear            = DateTime.Now.Year;
                            leaveApplyObj.LeaveResion                 = txtbxResion.Text.Trim();
                            leaveApplyObj.TotalDay                    = 1;
                            leaveApplyObj.IsPandingStatus             = false;
                            leaveApplyObj.LeaveStatusHRM              = false;
                            leaveApplyObj.ReprotingBoss1ApproveStatus = false;
                            leaveApplyObj.ReportingBoss2ApporveStatus = false;


                            leaveApplyObj.ReprotingBossHRM = hrmreportinBoss;
                            leaveApplyObj.ReprotingBoss1   = secondReportingBoss;
                            leaveApplyObj.ReprotingBoss2   = thirdReportingBoss;


                            leaveApplyesDates.Add(leaveApplyObj);
                        }
                        int result = objLeave_BLL.InsertLeaveApply(leaveApplyesDates);
                        if (result == 1)
                        {
                            int Attendanceresult = objLeave_BLL.DeleteAttendanceByLeaveDate(leaveApplyesDates);
                            if (Attendanceresult == 1)
                            {
                                ClaerAllController();
                                string employeeID = Convert.ToString(txtEid_TRNS.Text);
                                getLeaveEnjoyedInfoById(employeeID);
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Save Successfully')", true);
                            }
                        }

                        string eid = txtEid_TRNS.Text;

                        List <LeaveForReport> report = new List <LeaveForReport>();
                        report = objLeave_BLL.GetEmployeeApplyReport(eid, DateTimeFrom, DateTo);

                        if (report.Count > 0)
                        {
                            Session["rptDs"]    = "DataSet1";
                            Session["rptDt"]    = report;
                            Session["rptFile"]  = "/HRM/reports/HRM_Leave_Apply_ById.rdlc";
                            Session["rptTitle"] = "Leave Apply";
                            Response.Redirect("Report_Viewer.aspx");

                            //ReportViewer1.LocalReport.DataSources.Clear();
                            //ReportDataSource rpts = new ReportDataSource("DataSet1", report);
                            //ReportViewer1.LocalReport.DataSources.Add(rpts);
                            //ReportViewer1.LocalReport.ReportPath = "D:/TFS/HOMEBOUND/ERPSSL/HRM/reports/HRM_Leave_Apply_ById.rdlc";

                            //ReportViewer1.LocalReport.Refresh();
                            //rpt_Leave_Apply.Reset();
                            //ReportDataSource rpts = new ReportDataSource("D:/TFS/HOMEBOUND/ERPSSL/HRM/reports/DataSet1", report);
                            //rpt_Leave_Apply.LocalReport.DataSources.Add(rpts);
                            //rpt_Leave_Apply.LocalReport.ReportPath = "D:/TFS/HOMEBOUND/ERPSSL/HRM/reports/HRM_Leave_Apply_ById.rdlc";
                        }
                    }

                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Date Already Exist for Leave !')", true);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }