private void OpenRecord() { grTimeSheetApp.DataSource = null; grTimeSheetApp.DataBind(); dtTimeSheetP.Rows.Clear(); grTimeSheetApp.Dispose(); //grTimeSheetApproved.DataSource = null; //grTimeSheetApproved.DataBind(); //dtTimeSheetA.Rows.Clear(); //grTimeSheetApproved.Dispose(); if (Session["USERID"].ToString().Trim().ToUpper() != "ADMIN") { dtTimeSheetP = timeSheetMgr.GET_TimeSheet_For_App(ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), ddlFiscalYear.SelectedValue.ToString(), "P", Session["EMPID"].ToString().Trim()); dtTimeSheetA = timeSheetMgr.GET_TimeSheet_For_App(ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), ddlFiscalYear.SelectedValue.ToString(), "A", Session["EMPID"].ToString().Trim()); } else { dtTimeSheetP = timeSheetMgr.GET_TimeSheet_For_App(ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), ddlFiscalYear.SelectedValue.ToString(), "P", ""); dtTimeSheetA = timeSheetMgr.GET_TimeSheet_For_App(ddlMonth.SelectedValue.ToString(), ddlYear.SelectedValue.ToString(), ddlFiscalYear.SelectedValue.ToString(), "A", ""); } grTimeSheetApp.DataSource = dtTimeSheetP; grTimeSheetApp.DataBind(); grTimeSheetApproved.DataSource = dtTimeSheetA; grTimeSheetApproved.DataBind(); int slP = 0; if (grTimeSheetApp.Rows.Count > 0) { foreach (GridViewRow gRow in grTimeSheetApp.Rows) { slP = slP + 1; gRow.Cells[0].Text = slP.ToString(); if (string.IsNullOrEmpty(Common.CheckNullString(gRow.Cells[4].Text)) == false) { gRow.Cells[4].Text = Common.DisplayDate(gRow.Cells[4].Text); } if (string.IsNullOrEmpty(Common.CheckNullString(gRow.Cells[5].Text)) == false) { gRow.Cells[5].Text = Common.DisplayDate(gRow.Cells[5].Text); } gRow.Cells[6].Text = Common.RoundDecimal5T1(gRow.Cells[6].Text, 1).ToString(); } slP = 0; } int slA = 0; if (grTimeSheetApproved.Rows.Count > 0) { foreach (GridViewRow gRow in grTimeSheetApproved.Rows) { slA = slA + 1; gRow.Cells[0].Text = slA.ToString(); if (string.IsNullOrEmpty(Common.CheckNullString(gRow.Cells[4].Text)) == false) { gRow.Cells[4].Text = Common.DisplayDate(gRow.Cells[4].Text); } if (string.IsNullOrEmpty(Common.CheckNullString(gRow.Cells[5].Text)) == false) { gRow.Cells[5].Text = Common.DisplayDate(gRow.Cells[5].Text); } } } if (grTimeSheetApp != null) { grTimeSheetApp.Dispose(); } if (grTimeSheetApproved != null) { grTimeSheetApproved.Dispose(); } }