protected void btnAttSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                string at_status = "";
                bool   ot_status;

                HRM_ATTENDANCE objAttendance = new HRM_ATTENDANCE();
                objAttendance.EmpId           = Convert.ToInt64(lblHiddenId.Text);
                objAttendance.EID             = txtEid_AT.Text;
                objAttendance.ShiftCode       = lblShiftCode.Text;
                objAttendance.Attendance_Date = Convert.ToDateTime(txtAttDate.Text);
                objAttendance.Attendance_Day  = Convert.ToDateTime(txtAttDate.Text).DayOfWeek.ToString();
                objAttendance.Working_Day     = ddlWorkingDay.Text;
                objAttendance.OT_Compliance   = 0;
                objAttendance.Update_Status   = 0;

                TimeSpan in_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttInTime.Hour, txtAttInTime.Minute, txtAttInTime.Second));
                objAttendance.In_Time = in_time;

                TimeSpan out_time = TimeSpan.Parse(string.Format("{0}:{1}:{2}", txtAttOutTime.Hour, txtAttOutTime.Minute, txtAttOutTime.Second));
                objAttendance.Out_Time = out_time;

                TimeSpan workedTime = Calculations.timeDiff(in_time, out_time);
                TimeSpan overTime   = TimeSpan.Parse("00:00:00");

                TimeSpan originalTime = TimeSpan.Parse("09:00:00");

                if (originalTime < in_time)
                {
                    TimeSpan late_time = Calculations.timeDiff(originalTime, in_time);
                    objAttendance.Late_Time = late_time;
                }
                else
                {
                    objAttendance.Late_Time = TimeSpan.Parse("00:00:00");
                }

                if (overTime == TimeSpan.Parse("00:00:00"))
                {
                    ot_status = false;
                }
                else
                {
                    ot_status = true;
                }

                objAttendance.Worked_Time     = workedTime;
                objAttendance.Shift_TotalHour = shifted_TotalHour;
                objAttendance.Over_Time       = overTime;
                objAttendance.OT_Hour         = 0;
                objAttendance.OT_Minute       = 0;
                objAttendance.OT_Total        = 0;
                objAttendance.OT_ExtraAdd     = 0;
                objAttendance.OT_Deduction    = 0;
                objAttendance.OT_Status       = ot_status;

                if (rdbPresent.Checked == true)
                {
                    at_status = "P";
                }
                if (rdbLate.Checked == true)
                {
                    at_status = "L";
                }
                if (rdbAbsent.Checked == true)
                {
                    at_status = "A";
                }

                objAttendance.Status = at_status;
                //objAttendance.Remarks = "Manual Attendance:" + txtRemarks_AT.Text;
                objAttendance.Remarks = txtRemarks_AT.Text;
                //obj.EDIT_USER = Guid.Parse("a376708d-757f-4777-bd05-bfc89b6971ce");
                objAttendance.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;
                objAttendance.Edit_Date = DateTime.Now;
                objAttendance.OCode     = ((SessionUser)Session["SessionUser"]).OCode;

                int AttendanceCount = (from att in _context.HRM_ATTENDANCE
                                       where att.EID == objAttendance.EID && att.Attendance_Date == objAttendance.Attendance_Date
                                       select att.ATTE_ID).Count();

                if (AttendanceCount == 0)
                {
                    int result = objAtt_BLL.InsertAttendance(objAttendance);
                    if (result == 1)
                    {
                        //lblMessege.Text = "Attendance Recorded successfully!";
                        //lblMessege.ForeColor = System.Drawing.Color.Green;
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Recorded Successfully')", true);
                        var employeeId = txtEid_AT.Text.ToString();
                        BindGridEmployeeAttendanceById(employeeId);
                        reset();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Recording failure!')", true);
                    }
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Attendance Already Recorded in this day for this Employee!')", true);
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }