Ejemplo n.º 1
0
 internal int CancelLeavesForThirdReportinBoss(List <HRM_LeaveApply> leaveApplyesDates)
 {
     foreach (HRM_LeaveApply aiem in leaveApplyesDates)
     {
         HRM_LeaveApply obj = _context.HRM_LeaveApply.FirstOrDefault(a => a.LeaveDates == aiem.LeaveDates && a.LeaveCode == aiem.LeaveCode);
         obj.ReportingBoss2ApproveDate      = aiem.ReportingBoss2ApproveDate;
         obj.ReportingBoss2DisApporveStatus = aiem.ReportingBoss2DisApporveStatus;
         obj.IsPandingStatus = aiem.IsPandingStatus;
         _context.SaveChanges();
     }
     return(1);
 }
Ejemplo n.º 2
0
 internal int LeaveForDisApproveNotChangeForHRM(HRM_LeaveApply leaveApplyObj)
 {
     using (var _context = new ERPSSLHBEntities())
     {
         var    ParamempID  = new SqlParameter("@LeaveCOde", leaveApplyObj.LeaveCode);
         var    ParamempID1 = new SqlParameter("@ReprotingBoss1ApporveStatus", leaveApplyObj.ReprotingBossHRmDisApporveStatus);
         var    ParamempID2 = new SqlParameter("@ReportingBoss1pproveDate", leaveApplyObj.ReportingBossHRMDisApproveDate);
         string SP_SQL      = "HRM_LeaveDisApproveForForReportinHRM @LeaveCOde,@ReprotingBoss1ApporveStatus,@ReportingBoss1pproveDate";
         _context.ExecuteStoreCommand(SP_SQL, ParamempID, ParamempID1, ParamempID2);
         return(1);
     }
 }
Ejemplo n.º 3
0
        internal int UpdateLeaveApplyByLeaveId(HRM_LeaveApply leaveApplyObj, int leaveId)
        {
            HRM_LeaveApply obj = _context.HRM_LeaveApply.First(x => x.LeaveId == leaveId);

            obj.LeaveAppliedDate = leaveApplyObj.LeaveAppliedDate;
            obj.LeaveTypeId      = leaveApplyObj.LeaveTypeId;
            obj.LeaveDates       = leaveApplyObj.LeaveDates;
            obj.TotalDay         = leaveApplyObj.TotalDay;
            obj.LeaveResion      = leaveApplyObj.LeaveResion;
            _context.SaveChanges();
            return(1);
        }
 protected void BtnAprove_Click(object sender, EventArgs e)
 {
     try
     {
         List <HRM_LeaveApply> leaveApplyes = new List <HRM_LeaveApply>();
         int      totalMaternityLeave       = GetMaternityLeaveInfo();
         TimeSpan difference = Convert.ToDateTime(txtbxLeaveDateTo.Text) - Convert.ToDateTime(txtbxLeaveDateFrom.Text);
         var      days       = difference.TotalDays;
         if (days > Convert.ToInt32(totalMaternityLeave))
         {
             lblMessage.Text = "Please Check Maternity Leave!";
         }
         else
         {
             DateTime        begin = Convert.ToDateTime(txtbxLeaveDateFrom.Text);
             DateTime        end   = Convert.ToDateTime(txtbxLeaveDateTo.Text);
             List <DateTime> dates = new List <DateTime>();
             for (DateTime date = begin; date < end; date = date.AddDays(1))
             {
                 HRM_LeaveApply leaveApply = new HRM_LeaveApply();
                 leaveApply.TotalDay = 1;
                 leaveApply.ReprotingBossHRmApporveStatus = true;
                 leaveApply.ReportingBossHRMApproveDate   = DateTime.Now;
                 leaveApply.LeaveDates  = date;
                 leaveApply.LeaveCode   = lblLeaveId.Text;
                 leaveApply.Eid         = lblApplicantId.Text;
                 leaveApply.LeaveTypeId = 6;
                 leaveApply.EDIT_USER   = ((SessionUser)Session["SessionUser"]).UserId;
                 leaveApply.EDIT_DATE   = DateTime.Now;
                 leaveApply.OCODE       = ((SessionUser)Session["SessionUser"]).OCode;
                 leaveApplyes.Add(leaveApply);
                 //dates.Add(date);
             }
             int result = leaveBll.MaternityLeaveAccept(leaveApplyes);
             if (result == 1)
             {
                 HRM_MaternityLeave maternityLeave = new HRM_MaternityLeave();
                 maternityLeave.StatusDate    = DateTime.Now;
                 maternityLeave.EID           = lblApplicantId.Text;
                 maternityLeave.ApproveStatus = true;
                 int result1 = maternityLeaveBll.ApproveMaternityLeaveLeaveInfo(maternityLeave);
                 if (result1 == 1)
                 {
                     lblMessage.Text = "Approve Successfully!";
                 }
             }
         }
     }
     catch (Exception ex)
     {
         ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
     }
 }
Ejemplo n.º 5
0
 internal HRM_LeaveApply GetLeaveInfoById(string leaveId, string OCODE)
 {
     try
     {
         int            LeaveId = Convert.ToInt32(leaveId);
         HRM_LeaveApply obj     = _context.HRM_LeaveApply.First(x => x.LeaveId == LeaveId);
         return(obj);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 6
0
 internal int UpdateLeaveForApproveNotChange(HRM_LeaveApply leaveApplyes)
 {
     try
     {
         using (var _context = new ERPSSLHBEntities())
         {
             var    ParamempID  = new SqlParameter("@LeaveCOde", leaveApplyes.LeaveCode);
             var    ParamempID1 = new SqlParameter("@ReprotingBossHRmApporveStatus", leaveApplyes.ReprotingBossHRmApporveStatus);
             var    ParamempID2 = new SqlParameter("@ReportingBossHRMApproveDate", leaveApplyes.ReportingBossHRMApproveDate);
             string SP_SQL      = "HRM_LeaveApproveForHRM @LeaveCOde,@ReprotingBossHRmApporveStatus,@ReportingBossHRMApproveDate";
             _context.ExecuteStoreCommand(SP_SQL, ParamempID, ParamempID1, ParamempID2);
             return(1);
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 7
0
 private int DeleteAttendenceByCode(List <HRM_LeaveApply> leaveApplyesDates)
 {
     try
     {
         int                   status      = 0;
         HRM_LeaveApply        _leaveobj   = leaveApplyesDates.FirstOrDefault();
         List <HRM_ATTENDANCE> attendences = _context.HRM_ATTENDANCE.Where(x => x.Leave_Code == _leaveobj.LeaveCode).ToList();
         foreach (HRM_ATTENDANCE aitem in attendences)
         {
             _context.HRM_ATTENDANCE.DeleteObject(aitem);
             _context.SaveChanges();
             status = 1;
         }
         return(status);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 8
0
        protected void btnDisapporve_Click(object sender, EventArgs e)
        {
            try
            {
                string         leaveCode     = hidLeaveCode.Value;
                HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                leaveApplyObj.LeaveCode = leaveCode;
                leaveApplyObj.ReportingBoss2DisApporveStatus = true;
                leaveApplyObj.ReportingBoss2DisApproveDate   = DateTime.Now;

                int result = leaveBll.LeaveForDisApproveNotChangeForReportingBoss2(leaveApplyObj);

                if (result == 1)
                {
                    lblMessage.Text = "This Leave has Dispproved";
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void BtnLeaveSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                List <HRM_LeaveApply> leaveApplyes = new List <HRM_LeaveApply>();

                HRM_PersonalInformations personalInfo = employeeSetUpDal.GetReportingBossById(lblApplicantId.Text);
                string firstReportingBoss             = personalInfo.ReportingBossId;
                string secondReportinBoss             = personalInfo.SecondReportingBossId;
                string thirdReportingBoss             = personalInfo.ThirdReportingBossId;
                if (drpLeaveType.SelectedItem.ToString() == "--Select--")
                {
                    lblMessage.Text      = "Please Select Leave Type!";
                    lblMessage.ForeColor = System.Drawing.Color.Red;
                }
                else
                {
                    string[] dates = txtLeaveDate.Text.Split(',');

                    if (dates.Length > 0)
                    {
                        for (int i = 0; i < dates.Length; i++)
                        {
                            HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();

                            //leaveApplyObj.LeaveAppliedDate = DateTime.Now;
                            //leaveApplyObj.LeaveResion = txtbxLeaveReason.Text;
                            //leaveApplyObj.LeaveDates = txtLeaveDate.Text;
                            //leaveApplyObj.LeaveTypeId = Convert.ToInt32(drpLeaveType.SelectedValue);
                            //leaveApplyObj.TotalDay = Convert.ToInt32(txtbxTotalDay.Text);
                            //leaveApplyObj.ReportingBossId = hidReportingBossID.Value.ToString();
                            //if (BtnLeaveSubmit.Text == "Submit")
                            //{
                            //    leaveApplyObj.Eid = lblApplicantId.Text;
                            //    leaveApplyObj.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId;
                            //    leaveApplyObj.EDIT_DATE = DateTime.Now;
                            //    leaveApplyObj.OCODE =((SessionUser)Session["SessionUser"]).OCode;

                            //    int result = leaveBll.InsertLeaveApply(leaveApplyObj);
                            //    if (result == 1)
                            //    {
                            //        lblMessage.Text = "Data Save Successfully.";
                            //        setAnnulLeave();
                            //        GetLeaveInfoByEmployeeId();
                            //    }
                            //}
                            //else
                            //{
                            //    int leaveId = Convert.ToInt32(hidLeaveId.Value);
                            //    int result = leaveBll.UpdateLeaveApplyByLeaveId(leaveApplyObj, leaveId);
                            //    if (result == 1)
                            //    {
                            //        lblMessage.Text = "Data Update Successfully.";
                            //        setAnnulLeave();
                            //        GetLeaveInfoByEmployeeId();
                            //        clearAllControl();
                            //    }

                            //}
                            leaveApplyObj.LeaveCode        = lblLeaveId.Text;
                            leaveApplyObj.ReprotingBoss1   = firstReportingBoss;
                            leaveApplyObj.ReprotingBoss2   = secondReportinBoss;
                            leaveApplyObj.ReprotingBossHRM = thirdReportingBoss;
                            leaveApplyObj.LeaveAppliedDate = DateTime.Now;
                            leaveApplyObj.LeaveResion      = txtbxLeaveReason.Text;
                            leaveApplyObj.LeaveDates       = Convert.ToDateTime(dates[i]);
                            leaveApplyObj.LeaveTypeId      = Convert.ToInt32(drpLeaveType.SelectedValue);
                            leaveApplyObj.TotalDay         = 1;
                            leaveApplyObj.ReportingBossId  = hidReportingBossID.Value.ToString();
                            leaveApplyObj.ReprotingBossHRmApporveStatus    = false;
                            leaveApplyObj.ReprotingBoss1ApproveStatus      = false;
                            leaveApplyObj.ReportingBoss2ApporveStatus      = false;
                            leaveApplyObj.ReprotingBoss1DisApproveStatus   = false;
                            leaveApplyObj.ReportingBoss2DisApporveStatus   = false;
                            leaveApplyObj.ReprotingBossHRmDisApporveStatus = false;
                            leaveApplyObj.Eid       = lblApplicantId.Text;
                            leaveApplyObj.EDIT_USER = ((SessionUser)Session["SessionUser"]).UserId;
                            leaveApplyObj.EDIT_DATE = DateTime.Now;
                            leaveApplyObj.OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                            leaveApplyes.Add(leaveApplyObj);
                        }
                        if (BtnLeaveSubmit.Text == "Submit")
                        {
                            int result = leaveBll.InsertLeaveApply(leaveApplyes);
                            if (result == 1)
                            {
                                lblMessage.Text = "Data Save Successfully.";
                                setAnnulLeave();
                                GetLeaveInfoByEmployeeId();
                            }
                        }
                        getLeaveCode();
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 10
0
 internal int UpdateLeaveApplyByLeaveId(HRM_LeaveApply leaveApplyObj, int leaveId)
 {
     return(objCtx_DAL.UpdateLeaveApplyByLeaveId(leaveApplyObj, leaveId));
 }
Ejemplo n.º 11
0
 internal int LeaveForDisApproveNotChangeForReportingBoss2(HRM_LeaveApply leaveApplyObj)
 {
     return(objCtx_DAL.LeaveForDisApproveNotChangeForReportingBoss2(leaveApplyObj));
 }
Ejemplo n.º 12
0
 internal int UpdateLeaveForApproveNotChangeForReportingBoss1(HRM_LeaveApply leaveApplyObj)
 {
     return(objCtx_DAL.UpdateLeaveForApproveNotChangeForReportingBoss1(leaveApplyObj));
 }
Ejemplo n.º 13
0
 internal int UpdateLeaveForApproveNotChange(HRM_LeaveApply leaveApplyes)
 {
     return(objCtx_DAL.UpdateLeaveForApproveNotChange(leaveApplyes));
 }
Ejemplo n.º 14
0
        protected void btnUpdate_click(object sender, EventArgs e)
        {
            try
            {
                bool   status = false;
                string CL     = "";
                string SL     = "";
                string AL     = "";
                string ML     = "";
                string LWP    = "";

                string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                var    row   = objLeave_BLL.GetAllLeaveType(OCODE).ToList();
                if (row.Count > 0)
                {
                    foreach (var item in row)
                    {
                        if (item.LEV_TYPE == "AL")
                        {
                            AL = item.LEV_DAYS.ToString();
                        }
                        else if (item.LEV_TYPE == "CL")
                        {
                            CL = item.LEV_DAYS.ToString();
                        }
                        else if (item.LEV_TYPE == "SL")
                        {
                            SL = item.LEV_DAYS.ToString();
                        }
                        else if (item.LEV_TYPE == "ML")
                        {
                            ML = item.LEV_DAYS.ToString();
                        }
                    }
                }

                if (txtEid_TRNS.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input E-ID')", true);
                }
                else if (drpLeaveType.SelectedItem.ToString() == "--Select--")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Leave Type')", true);
                }
                else if (txtbxFromDate.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input From Date')", true);
                }
                else if (txtbxToDate.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Date')", true);
                }

                else if (drpLeaveType.SelectedItem.ToString() == "CL")
                {
                    status = true;
                    Int32 totalActualLeave = TotalLeave();
                    Int32 totalLeave       = totalActualLeave - Convert.ToInt16(hidTotalLeave.Value);

                    if (totalLeave + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(CL))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total CL Leave!')", true);
                    }
                }

                else if (drpLeaveType.SelectedItem.ToString() == "SL")
                {
                    status = true;
                    Int32 totalActualLeave = TotalLeave();
                    Int32 totalLeave       = totalActualLeave - Convert.ToInt16(hidTotalLeave.Value);
                    if (Convert.ToInt32(txtbxTotalDay.Text) + totalLeave > Convert.ToInt32(SL))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total SL Leave!')", true);
                    }
                }
                else if (drpLeaveType.SelectedItem.ToString() == "AL")
                {
                    Int32 totalActualLeave = TotalLeave();
                    Int32 totalLeave       = totalActualLeave - Convert.ToInt16(hidTotalLeave.Value);

                    status = true;
                    if (Convert.ToInt32(txtbxTotalDay.Text) + totalLeave > Convert.ToInt32(AL))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total AL Leave!')", true);
                    }
                }
                else if (drpLeaveType.SelectedItem.ToString() == "ML")
                {
                    status = true;
                    Int32 totalActualLeave = TotalLeave();
                    Int32 totalLeave       = totalActualLeave - Convert.ToInt16(hidTotalLeave.Value);
                    if (totalLeave + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(ML))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total ML Leave!')", true);
                    }
                }

                else if (drpLeaveType.SelectedItem.ToString() == "LWP")
                {
                    status = true;
                }
                if (status)
                {
                    if (DeleteExistinLeaveDetailsByCodeId())
                    {
                        if (txtbxToDate.Text != "")
                        {
                            if (!IsExist())
                            {
                                //string OCODE1 = ((SessionUser)Session["SessionUser"]).OCode;

                                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++)
                                {
                                    //check employee present
                                    List <HRM_ATTENDANCE> lstHRM_ATTENDANCE = aAttendance_BLL.GetAttendanceInfo_DateWise(DateTimeFrom.AddDays(i)).Where(x => x.EID == txtEid_TRNS.Text && x.Status == "P").ToList();

                                    if (lstHRM_ATTENDANCE.Count > 0)
                                    {
                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee Already Exist in Attendance!')", true);
                                        return;
                                    }

                                    HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                                    leaveApplyObj.LeaveCode        = hidLeaveCode.Value.ToString();
                                    leaveApplyObj.LeaveDates       = DateTimeFrom.AddDays(i);
                                    leaveApplyObj.LeaveAppliedDate = Convert.ToDateTime(hidAppliedDate.Value);
                                    leaveApplyObj.LeaveToDate      = Convert.ToDateTime(txtbxToDate.Text);
                                    leaveApplyObj.Eid                         = txtEid_TRNS.Text;
                                    leaveApplyObj.LeaveTypeId                 = Convert.ToInt16(drpLeaveType.SelectedValue.ToString());
                                    leaveApplyObj.LeaveCurrentYear            = Convert.ToDateTime(txtbxFromDate.Text).Year;
                                    leaveApplyObj.LeaveResion                 = txtbxResion.Text.Trim();
                                    leaveApplyObj.ReprotingBossHRM            = drpApprovedHR.SelectedValue.ToString();
                                    leaveApplyObj.ReprotingBoss1              = drpdwnApproveSupervisor.SelectedValue.ToString();
                                    leaveApplyObj.ReprotingBoss2              = drpApprovedAdmin.SelectedValue.ToString();
                                    leaveApplyObj.LeaveStatusHRM              = true;
                                    leaveApplyObj.ReprotingBoss1ApproveStatus = true;
                                    leaveApplyObj.ReportingBoss2ApporveStatus = true;
                                    leaveApplyObj.EDIT_USER                   = ((SessionUser)Session["SessionUser"]).UserId;
                                    leaveApplyObj.EDIT_DATE                   = DateTime.Now;
                                    leaveApplyObj.OCODE                       = ((SessionUser)Session["SessionUser"]).OCode;
                                    leaveApplyesDates.Add(leaveApplyObj);
                                }

                                //int checkResult = objLeave_BLL.CheckAttendance(leaveApplyesDates);
                                //if (checkResult == 0)
                                //{
                                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);
                                        GetLeaveDetailsByEID(employeeID);
                                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Updated Successfully!')", true);
                                    }
                                }
                                //}
                                //else
                                //{
                                //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee Already Exist in Attendance!')", true);
                                //}
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Date Already Exist for Leave !')", true);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 15
0
        protected void btnCancel_click(object sender, EventArgs e)
        {
            try
            {
                string OCODE     = ((SessionUser)Session["SessionUser"]).OCode;
                string EID       = Convert.ToString(((SessionUser)Session["SessionUser"]).EID);
                string LeaveCode = Convert.ToString(hidLeaveCode.Value);

                string FirstReportingBossID  = objLeave_BLL.GetFirstReportingBossIDByLeaveCode(LeaveCode);
                string SecondReportingBossID = objLeave_BLL.GetSecondReportingBossIDByLeaveCode(LeaveCode);
                string ThirdReportingBossID  = objLeave_BLL.GetThirdReportingBossIDByLeaveCode(LeaveCode);

                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        = hidLeaveCode.Value.ToString();
                    leaveApplyObj.OCODE            = OCODE;
                    leaveApplyObj.LeaveDates       = DateTimeFrom.AddDays(i);
                    leaveApplyObj.LeaveAppliedDate = Convert.ToDateTime(hidAppliedDate.Value);
                    leaveApplyObj.LeaveToDate      = Convert.ToDateTime(txtbxToDate.Text);
                    leaveApplyObj.Eid              = hidEid.Value;
                    leaveApplyObj.LeaveTypeId      = Convert.ToInt16(drpLeaveType.SelectedValue.ToString());
                    leaveApplyObj.LeaveCurrentYear = DateTime.Now.Year;
                    leaveApplyObj.LeaveResion      = txtbxResion.Text.Trim();
                    leaveApplyObj.ReprotingBossHRM = drpApprovedHR.SelectedValue.ToString();
                    leaveApplyObj.ReprotingBoss1   = drpdwnApproveSupervisor.SelectedValue.ToString();
                    leaveApplyObj.ReprotingBoss2   = drpApprovedAdmin.SelectedValue.ToString();
                    leaveApplyObj.IsPandingStatus  = true;
                    leaveApplyObj.ReprotingBossHRmDisApporveStatus = false;
                    leaveApplyObj.ReportingBossHRMDisApproveDate   = DateTime.Now;
                    leaveApplyObj.ReprotingBoss1DisApproveStatus   = false;
                    leaveApplyObj.ReprotingBoss1DisApproveDate     = DateTime.Now;
                    leaveApplyObj.ReportingBoss2DisApporveStatus   = false;
                    leaveApplyObj.ReportingBoss2DisApproveDate     = DateTime.Now;

                    leaveApplyesDates.Add(leaveApplyObj);
                }

                if (FirstReportingBossID == EID)
                {
                    //leaveApplyObj.ReprotingBossHRmDisApporveStatus = false;
                    //leaveApplyObj.ReportingBossHRMDisApproveDate = DateTime.Now;

                    int result = objLeave_BLL.CancelLeavesForFirstReportinBoss(leaveApplyesDates);
                    if (result == 1)
                    {
                        int Attendanceresult = objLeave_BLL.DeleteAttendanceByLeaveDate(leaveApplyesDates);
                        if (Attendanceresult == 1)
                        {
                            ClaerAllController();
                            //string employeeID = Convert.ToString(txtEid_TRNS.Text);
                            //GetLeaveDetailsByEID(employeeID);
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Level Cancel Successfully!')", true);
                        }
                    }
                }
                else if (SecondReportingBossID == EID)
                {
                    int result = objLeave_BLL.CancelLeavesForSecondReportinBoss(leaveApplyesDates);
                    if (result == 1)
                    {
                        int Attendanceresult = objLeave_BLL.DeleteAttendanceByLeaveDate(leaveApplyesDates);
                        if (Attendanceresult == 1)
                        {
                            ClaerAllController();
                            //string employeeID = Convert.ToString(txtEid_TRNS.Text);
                            //GetLeaveDetailsByEID(employeeID);
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Level Cancel Successfully!')", true);
                        }
                    }
                }
                else if (ThirdReportingBossID == EID)
                {
                    int result = objLeave_BLL.CancelLeavesForThirdReportinBoss(leaveApplyesDates);
                    if (result == 1)
                    {
                        int Attendanceresult = objLeave_BLL.DeleteAttendanceByLeaveDate(leaveApplyesDates);
                        if (Attendanceresult == 1)
                        {
                            ClaerAllController();
                            //string employeeID = Convert.ToString(txtEid_TRNS.Text);
                            //GetLeaveDetailsByEID(employeeID);
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully!')", true);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 16
0
        protected void btnSave_click(object sender, EventArgs e)
        {
            try
            {
                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 (DeleteExistinLeaveDetailsByCodeId())
                    //{
                    if (txtbxToDate.Text != "")
                    {
                        //if (!IsExist())
                        //{
                        string OCODE                 = ((SessionUser)Session["SessionUser"]).OCode;
                        string EID                   = Convert.ToString(((SessionUser)Session["SessionUser"]).UserId);
                        string LeaveCode             = Convert.ToString(hidLeaveCode.Value);
                        string FirstReportingBossID  = objLeave_BLL.GetFirstReportingBossIDByLeaveCode(LeaveCode);
                        string SecondReportingBossID = objLeave_BLL.GetSecondReportingBossIDByLeaveCode(LeaveCode);
                        string ThirdReportingBossID  = objLeave_BLL.GetThirdReportingBossIDByLeaveCode(LeaveCode);

                        List <HRM_LeaveApply> mainLeavesbyCode = objLeave_BLL.getLeaveApplyesByCode(LeaveCode);



                        DateTime DateTimeFrom = Convert.ToDateTime(txtbxFromDate.Text);
                        DateTime DateTo       = Convert.ToDateTime(txtbxToDate.Text);
                        List <HRM_LeaveApply> leaveApplyesDates1 = new List <HRM_LeaveApply>();
                        for (int i = 0; i < Convert.ToInt16(txtbxTotalDay.Text); i++)
                        {
                            HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                            leaveApplyObj.LeaveCode        = hidLeaveCode.Value.ToString();
                            leaveApplyObj.OCODE            = OCODE;
                            leaveApplyObj.LeaveDates       = DateTimeFrom.AddDays(i);
                            leaveApplyObj.LeaveAppliedDate = Convert.ToDateTime(hidAppliedDate.Value);
                            leaveApplyObj.LeaveToDate      = Convert.ToDateTime(txtbxToDate.Text);
                            leaveApplyObj.Eid              = hidEid.Value;
                            leaveApplyObj.LeaveTypeId      = Convert.ToInt16(drpLeaveType.SelectedValue.ToString());
                            leaveApplyObj.LeaveCurrentYear = DateTime.Now.Year;
                            leaveApplyObj.LeaveResion      = txtbxResion.Text.Trim();
                            leaveApplyObj.ReprotingBossHRM = drpApprovedHR.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss1   = drpdwnApproveSupervisor.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss2   = drpApprovedAdmin.SelectedValue.ToString();
                            leaveApplyObj.LeaveStatusHRM   = true;
                            if (FirstReportingBossID == EID)
                            {
                                leaveApplyObj.ReprotingBossHRmDisApporveStatus = false;
                                leaveApplyObj.ReportingBossHRMDisApproveDate   = DateTime.Now;
                            }
                            else if (SecondReportingBossID == EID)
                            {
                                leaveApplyObj.ReprotingBoss1DisApproveStatus = false;
                                leaveApplyObj.ReprotingBoss1DisApproveDate   = DateTime.Now;
                            }

                            else if (ThirdReportingBossID == EID)
                            {
                                leaveApplyObj.ReportingBoss2DisApporveStatus = false;
                                leaveApplyObj.ReportingBoss2DisApproveDate   = DateTime.Now;
                            }
                            leaveApplyesDates1.Add(leaveApplyObj);
                        }

                        List <HRM_LeaveApply> leaveApplyesDates = (from post in mainLeavesbyCode
                                                                   join meta in leaveApplyesDates1
                                                                   on post.LeaveDates equals meta.LeaveDates
                                                                   select post

                                                                   ).ToList();
                        int resultdelete = objLeave_BLL.DeleteLeaveDetailsByLeaveCode(LeaveCode);
                        if (resultdelete == 1)
                        {
                            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);
                                    //GetLeaveDetailsByEID(employeeID);
                                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Leave Approved Successfully')", true);
                                }
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Date Already Exist for Leave !')", true);
                    }
                    //}
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 17
0
        protected void btnSave_click(object sender, EventArgs e)
        {
            try
            {
                bool status = false;

                if (txtEid_TRNS.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input E-ID!')", true);
                }
                else if (drpLeaveType.SelectedItem.ToString() == "--Select--")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Select Leave Type!')", true);
                }
                else if (txtbxFromDate.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input From Date!')", true);
                }
                else if (txtbxToDate.Text == "")
                {
                    status = false;
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Input To Date!')", true);
                }

                else if (drpLeaveType.SelectedItem.ToString() == "CL")
                {
                    status = true;
                    if (Convert.ToInt32(lblCloE.Text) + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(lblCl.Text))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total CL Leave!')", true);
                    }
                }

                else if (drpLeaveType.SelectedItem.ToString() == "SL")
                {
                    status = true;
                    if (Convert.ToInt32(lblSLE.Text) + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(lblSl.Text))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total SL Leave!')", true);
                    }
                }
                else if (drpLeaveType.SelectedItem.ToString() == "AL")
                {
                    status = true;
                    if (Convert.ToInt32(lblALE.Text) + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(lblAL.Text))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total AL Leave!')", true);
                    }
                }
                else if (drpLeaveType.SelectedItem.ToString() == "ML")
                {
                    status = true;
                    if (Convert.ToInt32(lblMLE.Text) + Convert.ToInt32(txtbxTotalDay.Text) > Convert.ToInt32(lblML.Text))
                    {
                        status = false;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Please Check Total ML Leave!')", true);
                    }
                }
                else if (drpLeaveType.SelectedItem.ToString() == "LWP")
                {
                    status = true;
                }

                if (status)
                {
                    if (!IsExist())
                    {
                        string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                        int    count = objLeave_BLL.GetLastRowNumber(OCODE);
                        int    total = count + 1;
                        string Code  = "LC" + total;

                        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++)
                        {
                            //check employee present
                            List <HRM_ATTENDANCE> lstHRM_ATTENDANCE = aAttendance_BLL.GetAttendanceInfo_DateWise(DateTimeFrom.AddDays(i)).Where(x => x.EID == txtEid_TRNS.Text).ToList();

                            if (lstHRM_ATTENDANCE.Count > 0)
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Employee Already Exist in Attendance!')", true);
                                return;
                            }

                            HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                            leaveApplyObj.LeaveCode        = Code;
                            leaveApplyObj.EDIT_USER        = ((SessionUser)Session["SessionUser"]).UserId;
                            leaveApplyObj.EDIT_DATE        = DateTime.Now;
                            leaveApplyObj.OCODE            = ((SessionUser)Session["SessionUser"]).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            = Convert.ToDateTime(txtbxFromDate.Text).Year;
                            leaveApplyObj.LeaveResion                 = txtbxResion.Text.Trim();
                            leaveApplyObj.ReprotingBossHRM            = drpApprovedHR.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss1              = drpdwnApproveSupervisor.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss2              = drpApprovedAdmin.SelectedValue.ToString();
                            leaveApplyObj.LeaveStatusHRM              = true;
                            leaveApplyObj.ReprotingBoss1ApproveStatus = true;
                            leaveApplyObj.ReportingBoss2ApporveStatus = true;
                            leaveApplyObj.EDIT_DATE                   = DateTime.Now;
                            leaveApplyObj.EDIT_USER                   = ((SessionUser)Session["SessionUser"]).UserId;
                            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 Saved Successfully')", true);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Date Already Exist for Leave!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 18
0
        //private void gethrmemployeeList()
        //{
        //    try
        //    {



        //        string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
        //        List<ReportingBoss> personalInfos = objEmp_BLL.GetPersonalInfoByDepartment(OCODE);
        //        if (personalInfos.Count > 0)
        //        {
        //            //drpdwnApproveSupervisor.DataSource = personalInfos;
        //            //drpdwnApproveSupervisor.DataTextField = "FulllName";
        //            //drpdwnApproveSupervisor.DataValueField = "EID";
        //            //drpdwnApproveSupervisor.DataBind();
        //            //drpdwnApproveSupervisor.Items.Insert(0, new ListItem("--Select--", "0"));



        //            //drpApprovedAdmin.DataSource = personalInfos;
        //            //drpApprovedAdmin.DataTextField = "FulllName";
        //            //drpApprovedAdmin.DataValueField = "EID";
        //            //drpApprovedAdmin.DataBind();
        //            //drpApprovedAdmin.Items.Insert(0, new ListItem("--Select--", "0"));


        //            drpApprovedHR.DataSource = personalInfos;
        //            drpApprovedHR.DataTextField = "FulllName";
        //            drpApprovedHR.DataValueField = "EID";
        //            drpApprovedHR.DataBind();
        //            drpApprovedHR.Items.Insert(0, new ListItem("--Select--", "0"));



        //        }


        //    }
        //    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;

                        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.ReprotingBossHRM            = drpApprovedHR.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss1              = drpdwnApproveSupervisor.SelectedValue.ToString();
                            leaveApplyObj.ReprotingBoss2              = drpApprovedAdmin.SelectedValue.ToString();
                            leaveApplyObj.LeaveStatusHRM              = true;
                            leaveApplyObj.ReprotingBoss1ApproveStatus = true;
                            leaveApplyObj.ReportingBoss2ApporveStatus = true;
                            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);
                            }
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('This Date Already Exist for Leave !')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 19
0
        protected void BtnAprove_Click(object sender, EventArgs e)
        {
            try
            {
                LEAVE_BLL leaveBll = new LEAVE_BLL();

                // string leaveId = Session["aLeaveID"].ToString();
                // leaveApplyObj.ApporveBy = "SBD";
                // leaveApplyObj.ApproveDate = DateTime.Now;
                //// leaveApplyObj.LeaveDates = txtLeaveDate.Text.ToString();
                // leaveApplyObj.TotalDay = Convert.ToInt32(txtbxTotalDay.Text);
                // string leaId = Session["aLeaveID"].ToString();

                if (txtLeaveDate.Text == "")
                {
                    string         leaveCode     = hidLeaveCode.Value;
                    HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                    leaveApplyObj.LeaveCode = leaveCode;
                    leaveApplyObj.ReprotingBoss1ApproveStatus = true;
                    leaveApplyObj.ReprotingBoss1ApproveDate   = DateTime.Now;

                    int result = leaveBll.UpdateLeaveForApproveNotChangeForReportingBoss2(leaveApplyObj);

                    if (result == 1)
                    {
                        lblMessage.Text = "This Leave has Approved";
                    }
                }
                else
                {
                    List <HRM_LeaveApply> newLeaveApplyList = new List <HRM_LeaveApply>();
                    string[] dates = txtLeaveDate.Text.Split(',');

                    if (dates.Length > 0)
                    {
                        for (int i = 0; i < dates.Length; i++)
                        {
                            string         leaveCode     = hidLeaveCode.Value;
                            HRM_LeaveApply leaveApplyObj = new HRM_LeaveApply();
                            // DateTime ConvertDate = Convert.ToDateTime(dates[i]);
                            //string formateDate = ConvertDate.ToString("yyyy-MM-dd");
                            leaveApplyObj.LeaveCode  = leaveCode;
                            leaveApplyObj.OCODE      = ((SessionUser)Session["SessionUser"]).OCode;
                            leaveApplyObj.LeaveDates = Convert.ToDateTime(dates[i]);
                            leaveApplyObj.ReprotingBossHRmApporveStatus = true;
                            leaveApplyObj.ReportingBossHRMApproveDate   = DateTime.Now.Date;
                            newLeaveApplyList.Add(leaveApplyObj);
                        }
                    }
                    int result = leaveBll.UpdateLeaveChangeForReportingBoss2(newLeaveApplyList);

                    if (result == 1)
                    {
                        lblMessage.Text = "This Leave has Approved";
                    }
                }

                //int result = leaveBll.UpdateLeaveForApprove(leaveApplyObj, leaId);
                //if (result == 1)
                //{
                //    lblMessage.Text = "This Leave has Approved";
                //}
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Ejemplo n.º 20
0
        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;
            }
        }