protected void ClearAll() { try { int IntEmpId = 0; if (ViewState["LoginUserGroup"].ToString() == "EMP") { IntEmpId = int.Parse(ViewState["LoginId"].ToString()); DDLEmplName.Enabled = false; DDLEmpView.Enabled = false; } else { DDLEmplName.Enabled = true; DDLEmpView.Enabled = true; } DDLEmpView.Items.Clear(); DDLEmpView.DataSource = BLayer.FillEmp(IntEmpId, ""); DDLEmpView.DataValueField = "EmpId"; DDLEmpView.DataTextField = "EmpName"; DDLEmpView.DataBind(); if (IntEmpId == 0) { DDLEmpView.Items.Insert(0, new ListItem("--Select Employee--", "0")); } DDLEmplName.Items.Clear(); DDLEmplName.DataSource = BLayer.FillEmp(IntEmpId, ""); DDLEmplName.DataValueField = "EmpId"; DDLEmplName.DataTextField = "EmpName"; DDLEmplName.DataBind(); if (IntEmpId == 0) { DDLEmplName.Items.Insert(0, new ListItem("--Select Employee--", "0")); } LblMsg.Text = ""; HidFldId.Value = ""; TxtDRFDate.Text = ""; TxtInTime.Text = ""; TxtOutTime.Text = ""; TxtTotWrkHours.Text = ""; TxtRemark.Text = ""; GridWork.DataSource = null; GridWork.DataBind(); TxtTotTime.Text = ""; } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void btnDRFSelect_Click(object sender, ImageClickEventArgs e) { try { ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; Session["Id"] = GridDRF.DataKeys[gvrow.RowIndex].Value.ToString(); HidFldId.Value = Session["Id"].ToString(); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select H.Id,H.EmpId,Convert(Varchar(10),H.DRFDate,103) As DRFDate"); StrSql.AppendLine(",H.InTime,H.OutTime,H.TotTime,H.Remark "); StrSql.AppendLine("From DRFH H"); StrSql.AppendLine("Where H.Id=" + int.Parse(HidFldId.Value)); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); if (dtTemp.Rows.Count == 0) { LblMsg.Text = "Data not found"; return; } int IntEmpId = 0; if (ViewState["LoginUserGroup"].ToString() == "EMP") { IntEmpId = int.Parse(ViewState["LoginId"].ToString()); DDLEmplName.Enabled = false; } else { if (dtTemp.Rows[0]["EmpId"].ToString() != "") { IntEmpId = int.Parse(dtTemp.Rows[0]["EmpId"].ToString()); } DDLEmplName.Enabled = true; } DDLEmplName.Items.Clear(); DDLEmplName.DataSource = BLayer.FillEmp(IntEmpId, ""); DDLEmplName.DataValueField = "EmpId"; DDLEmplName.DataTextField = "EmpName"; DDLEmplName.DataBind(); if (ViewState["LoginUserGroup"].ToString() != "EMP") { DDLEmplName.Items.Insert(0, new ListItem("--Select Employee--", "0")); } if (IntEmpId != 0) { DDLEmplName.SelectedValue = dtTemp.Rows[0]["EmpId"].ToString(); } DDLEmplName.Enabled = false; TxtDRFDate.Text = dtTemp.Rows[0]["DRFDate"].ToString(); TxtInTime.Text = dtTemp.Rows[0]["InTime"].ToString(); TxtOutTime.Text = dtTemp.Rows[0]["OutTime"].ToString(); TxtTotWrkHours.Text = dtTemp.Rows[0]["TotTime"].ToString(); TxtRemark.Text = dtTemp.Rows[0]["Remark"].ToString(); FillWorkData(); //Move to Edit Tab MyMenu.Items[0].ImageUrl = "~/Images/ViewDisable.jpg"; MyMenu.Items[1].ImageUrl = "~/Images/NewOrEditEnable.jpg"; MyMenu.Items[1].Selected = true; MyMultiView.ActiveViewIndex = 1; } catch (Exception ex) { Response.Write(ex.ToString()); } }