private void CheckAwayDeskLog() { DataTable dtLog = objAM.getDeskAwayLog(Session["EMPID"].ToString().Trim(), "", ""); if (dtLog.Rows.Count > 0) { string cmdType; dsEmployee objDS = new dsEmployee(); DataTable dtMst = objDS.Tables["EmpAwayDeskLog"]; DataRow nRow = dtMst.NewRow(); nRow["SLNo"] = Int64.Parse(dtLog.Rows[0]["SLNO"].ToString().Trim()); nRow["EMPID"] = Session["EMPID"].ToString().Trim(); nRow["LogDate"] = DateTime.Now.ToShortDateString(); nRow["Reason"] = dtLog.Rows[0]["Reason"].ToString().Trim(); nRow["OutTime"] = dtLog.Rows[0]["OutTime"].ToString().Trim(); cmdType = "U"; nRow["InTime"] = DateTime.Now.ToShortTimeString(); dtMst.Rows.Add(nRow); dtMst.AcceptChanges(); try { objEmpInfoMgr.SaveData(dtMst, cmdType == "D" ? "U" : cmdType); } catch (Exception ex) { throw new Exception(ex.Message); } } }
private void OpenRecord() { lblDateTime.Text = "Now Date: " + DateTime.Now.ToShortDateString() + " Time: " + DateTime.Now.ToShortTimeString(); DataTable dtLog = objAM.getDeskAwayLog(Session["EMPID"].ToString().Trim(), "", ""); if (dtLog.Rows.Count > 0) { hdfSINO.Value = dtLog.Rows[0]["SLNO"].ToString().Trim(); txtReason.Text = dtLog.Rows[0]["Reason"].ToString().Trim(); hdfOutTime.Value = dtLog.Rows[0]["OutTime"].ToString().Trim(); btnSave.Text = "Save Desk InTime"; } else { hdfSINO.Value = ""; txtReason.Text = ""; btnSave.Text = "Save Desk OutTime"; } DataTable dtAwayUsers = objAM.getDeskAwayLog("", "intime", DateTime.Now.ToShortDateString()); grDeskAway.DataSource = dtAwayUsers; grDeskAway.DataBind(); ScriptManager.RegisterClientScriptBlock(Page, typeof(string), Guid.NewGuid().ToString(), "$('#myModal').modal('show');", true); }