void BindGridAttendanceByEID()
        {
            try
            {
                string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                using (ERPSSLHBEntities context = new ERPSSLHBEntities())
                {
                    if (context.HRM_ATTENDANCE.Count() > 0)
                    {
                        var row = objAtt_BLL.GetAttendanceByEID(OCODE, txtEID.Text).ToList();
                        if (row.Count > 0)
                        {
                            GridViewEMP_AT.DataSource = row.ToList();
                            GridViewEMP_AT.DataBind();
                        }
                    }
                    else
                    {
                        var obj = new List <HRM_ATTENDANCE>();
                        obj.Add(new HRM_ATTENDANCE());

                        // Bind the DataTable which contain a blank row to the GridView
                        GridViewEMP_AT.DataSource = obj;
                        GridViewEMP_AT.DataBind();

                        int columnsCount = GridViewEMP_AT.Columns.Count;
                        GridViewEMP_AT.Rows[0].Cells.Clear();                      // clear all the cells in the row
                        GridViewEMP_AT.Rows[0].Cells.Add(new TableCell());         //add a new blank cell
                        GridViewEMP_AT.Rows[0].Cells[0].ColumnSpan = columnsCount; //set the column span to the new added cell

                        GridViewEMP_AT.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
                        GridViewEMP_AT.Rows[0].Cells[0].ForeColor       = System.Drawing.Color.Red;
                        GridViewEMP_AT.Rows[0].Cells[0].Font.Bold       = true;

                        //set No Results found to the new added cell
                        GridViewEMP_AT.Rows[0].Cells[0].Text = "NO RECORDS FOUND!";
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
        protected void btnAttSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Attendance_BLL        _attendancebll = new Attendance_BLL();
                List <HRM_ATTENDANCE> attendances    = new List <HRM_ATTENDANCE>();

                foreach (GridViewRow gvRow in GridViewEMP_AT.Rows)
                {
                    CheckBox rowChkBox = ((CheckBox)gvRow.FindControl("rowLevelCheckBox"));

                    HRM_ATTENDANCE obj = new HRM_ATTENDANCE();

                    if (rowChkBox.Checked == true)
                    {
                        Label   lblId           = ((Label)gvRow.FindControl("lblId"));
                        TextBox txtbxExtraOtAdd = ((TextBox)gvRow.FindControl("OTExtraAdd"));
                        Label   lblAttnDate     = ((Label)gvRow.FindControl("lblAttnDate"));
                        //Label lbltotalot = ((Label)gvRow.FindControl("lbltotalot"));
                        //double totalOT = Convert.ToDouble(lbltotalot.Text);

                        DateTime otDate = Convert.ToDateTime(lblAttnDate.Text);

                        obj.ATTE_ID = Convert.ToInt32(lblId.Text);
                        int AttId = Convert.ToInt32(obj.ATTE_ID);

                        if (rdExtraOT.Checked)
                        {
                            obj.OT_ExtraAdd = Convert.ToInt32(txtbxExtraOtAdd.Text);
                            // obj.OT_Total = totalOT + Convert.ToDouble(txtbxExtraOtAdd.Text);
                        }
                        else if (rdExtraOTDeduct.Checked)
                        {
                            obj.OT_Deduction = Convert.ToInt32(txtbxExtraOtAdd.Text);
                            // obj.OT_Total = totalOT - Convert.ToDouble(txtbxExtraOtAdd.Text);
                        }

                        obj.OCode     = ((SessionUser)Session["SessionUser"]).OCode;
                        obj.Edit_Date = DateTime.Now;
                        obj.Edit_User = ((SessionUser)Session["SessionUser"]).UserId;

                        var result = objAtt_BLL.UpdateAttendanceOT(obj, AttId);

                        if (result == 1)
                        {
                            //ot process

                            string OCODE  = Convert.ToString(((SessionUser)Session["SessionUser"]).OCode);
                            string userId = Convert.ToString(((SessionUser)Session["SessionUser"]).UserId);

                            objAtt_BLL.UpdateOT_ByShift_EID(otDate, otDate, hdnEmployeeShiftCode.Value, txtEid_AT.Text);

                            //ot process log
                            var    ParamempID1 = new SqlParameter("@DateFrom", Convert.ToDateTime(otDate));
                            var    ParamempID2 = new SqlParameter("@DateTo", Convert.ToDateTime(otDate));
                            var    ParamempID3 = new SqlParameter("@Edit_User", userId);
                            var    ParamempID4 = new SqlParameter("@Edit_Date", DateTime.Now);
                            var    ParamempID5 = new SqlParameter("@OCODE", OCODE);
                            string SP_SQL      = "HRM_Insert_OTProcessLog @DateFrom, @DateTo, @Edit_User, @Edit_Date, @OCODE";
                            context.ExecuteStoreCommand(SP_SQL, ParamempID1, ParamempID2, ParamempID3, ParamempID4, ParamempID5);

                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Data Update Successfully.')", true);

                            // load grid
                            DateTime fromdate = Convert.ToDateTime(txtfromDate.Text);
                            DateTime toDate   = Convert.ToDateTime(txtToDate.Text);

                            var row = objAtt_BLL.GetAttendanceByEID(txtEid_AT.Text).Where(x => x.Attendance_Date >= fromdate && x.Attendance_Date <= toDate).ToList();

                            if (row.Count > 0)
                            {
                                GridViewEMP_AT.DataSource = row.ToList();
                                GridViewEMP_AT.DataBind();
                            }
                            else
                            {
                                GridViewEMP_AT.DataSource = null;
                                GridViewEMP_AT.DataBind();
                            }
                            ///
                        }
                    }
                }
                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);
            }
        }