protected void btn_Confirm_Clcik(object sender, EventArgs e)
        {
            try
            {
                UserDAL               userDAl        = new UserDAL();
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                if (ckIndividualPunishment.Checked)   //individual process
                {
                    if (txtbxEID.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Enter E-ID!')", true);
                        return;
                    }
                    if (txtDate.Text == "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select Attendance Date!')", true);
                        return;
                    }
                    HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();

                    _attendance.EID             = txtbxEID.Text;
                    _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                    _attendance.Remarks         = txtbxremark.Text;
                    _attendance.Edit_User       = ((SessionUser)Session["SessionUser"]).UserId;
                    _attendance.Edit_Date       = DateTime.Now;
                    _attendance.OCode           = ((SessionUser)Session["SessionUser"]).OCode;
                    attendances.Add(_attendance);

                    if (attendances.Count > 0)
                    {
                        List <HRM_EMPLOYEES_VIEWER> lstEmpAttendnace = _attendancebll.GetEmployeesByEidForAttendance(txtbxEID.Text, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text)); //check attendance data

                        if (lstEmpAttendnace.Count > 0)
                        {
                            Guid   UserID     = ((SessionUser)Session["SessionUser"]).UserId;
                            string PunishedBy = userDAl.getEIDbyUserGuidID(UserID);

                            int result = _attendancebll.AttendanceAdjustment(attendances, PunishedBy);

                            if (result == 1)
                            {
                                // insert/update leave/holiday attendnace status process by selected eid
                                aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID(attendances, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                                ClearUI();
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Punishment Successfull')", true);
                            }
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Attendance Data Found!')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                    }
                }

                else
                {
                    foreach (GridViewRow gvRow in grdview.Rows)
                    {
                        CheckBox       rowChkBox   = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));
                        HRM_ATTENDANCE _attendance = new HRM_ATTENDANCE();
                        if (rowChkBox.Checked == true)
                        {
                            Label   lblEID = ((Label)gvRow.FindControl("lblEID"));
                            TextBox txtbx  = ((TextBox)gvRow.FindControl("txtbx"));

                            _attendance.EID             = lblEID.Text;
                            _attendance.Attendance_Date = Convert.ToDateTime(txtDate.Text);
                            _attendance.Remarks         = txtbxremark.Text;
                            _attendance.Edit_User       = ((SessionUser)Session["SessionUser"]).UserId;
                            _attendance.Edit_Date       = DateTime.Now;
                            _attendance.OCode           = ((SessionUser)Session["SessionUser"]).OCode;
                            attendances.Add(_attendance);
                        }
                    }


                    if (attendances.Count > 0)
                    {
                        Guid   UserID     = ((SessionUser)Session["SessionUser"]).UserId;
                        string PunishedBy = userDAl.getEIDbyUserGuidID(UserID);
                        int    result     = _attendancebll.AttendanceAdjustment(attendances, PunishedBy);
                        if (result == 1)
                        {
                            // insert/update leave/holiday attendnace status process by selected eid
                            aAttendance_RPT_Bll.Insert_Update_AbsentLeaveStatus_ByDate_EID(attendances, Convert.ToDateTime(txtDate.Text), Convert.ToDateTime(txtDate.Text));

                            ClearUI();
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Punishment Successfull')", true);
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Employee selected in the list!')", true);
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                TimeSpan time = TimeSpan.Parse("00:00:00");

                Attendance_BLL _attendancebll         = new Attendance_BLL();
                string         eid                    = txtbxEID.Text.Trim();
                DateTime       fromDate               = Convert.ToDateTime(txtDate.Text);
                DateTime       toDate                 = Convert.ToDateTime(txtToDate.Text);
                List <HRM_EMPLOYEES_VIEWER> employess = _attendancebll.GetEmployeesByEidForAttendance(eid, fromDate, toDate);

                if (employess.Count > 0)
                {
                    List <HRM_EMPLOYEES_VIEWER> newemployess = new List <HRM_EMPLOYEES_VIEWER>();

                    foreach (HRM_EMPLOYEES_VIEWER aitem in employess)
                    {
                        HRM_EMPLOYEES_VIEWER aemployee = new HRM_EMPLOYEES_VIEWER();
                        aemployee.EID              = aitem.EID;
                        aemployee.EMP_ID           = aitem.EMP_ID;
                        aemployee.EmployeeFullName = aitem.FirstName + " " + aitem.LastName;
                        aemployee.DEG_NAME         = aitem.DEG_NAME;
                        aemployee.AttendanceDate   = aitem.AttendanceDate;

                        //aemployee.In_Time = aitem.In_Time;
                        //aemployee.Out_Time = aitem.Out_Time;



                        if (aitem.In_Time != null)
                        {
                            aemployee.In_Time = aitem.In_Time;
                        }
                        else
                        {
                            aemployee.In_Time = null;
                        }

                        if (aitem.Out_Time != null)
                        {
                            aemployee.Out_Time = aitem.Out_Time;
                        }
                        else
                        {
                            aemployee.Out_Time = null;
                        }

                        aemployee.Status = aitem.Status;
                        newemployess.Add(aemployee);
                    }
                    List <HRM_EMPLOYEES_VIEWER> assendingnewemployess = newemployess.OrderBy(x => x.EMP_ID).ToList();

                    if (assendingnewemployess.Count > 0)
                    {
                        //TextBox txtbxInTime = ((TextBox)grdview.FindControl("txtbxIntime"));
                        //TextBox txtbxOutTIme = ((TextBox)grdview.FindControl("txtbxOuttime"));

                        //if (txtbxInTime.Text == "00:00:00")
                        //{

                        //    txtbxInTime.ForeColor = System.Drawing.Color.Red;
                        //    txtbxInTime.BackColor = System.Drawing.Color.Wheat;
                        //}

                        grdview.DataSource = assendingnewemployess;
                        grdview.DataBind();
                    }
                }

                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Attendance Data Found!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }