protected void FillGrid() { try { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select W.Id,W.PrjLedId,W.PrjId,W.PrjModId,W.EmpId"); StrSql.AppendLine(",PL.EmpName As ProjectLed,P.ProjectName,M.ModuleName,E.EmpName"); StrSql.AppendLine(",Case When IsNull(CompleteDate,'')<>''"); StrSql.AppendLine(" Then Convert(Varchar(10),CompleteDate,103) Else '' End As CompleteDate"); StrSql.AppendLine("From WorkAssDet W"); StrSql.AppendLine("Left Join Emp_Mast PL On PL.Id=W.PrjLedId"); StrSql.AppendLine("Left Join Emp_Mast E On E.Id=W.EmpId"); StrSql.AppendLine("Left Join Project_Mast P On P.Id=W.PrjId"); StrSql.AppendLine("Left Join Project_Module M On M.Id=W.PrjModId"); if (ViewState["LoginUserGroup"].ToString() == "EMP") { StrSql.AppendLine("Where W.EmpId=" + int.Parse(ViewState["LoginId"].ToString())); } StrSql.AppendLine("Order By Pl.EmpName"); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); GridWork.DataSource = dtTemp; GridWork.DataBind(); } catch (Exception ex) { Response.Write(ex.ToString()); } }
private void loadWork() { Work = new DataTable(); Work.Columns.Add("Experience"); Work.Columns.Add("Organization"); Work.Columns.Add("Year"); GridWork.DataSource = Work; GridWork.DataBind(); }
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 FillWorkData() { try { if (int.Parse(HidFldId.Value) != 0) { StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select D.Id,D.DRFId,D.StartTime,D.EndTime,D.TotTime"); StrSql.AppendLine(",P.Id As PrjId,P.ProjectName AS PrjName"); StrSql.AppendLine(",M.Id As ModId,M.ModuleName AS ModName"); StrSql.AppendLine(",D.Work_Desc AS WorkDesc"); StrSql.AppendLine(",Case When IsNull(D.WorkStatus,'')='D' Then 'Done'"); StrSql.AppendLine(" When IsNull(D.WorkStatus,'')='P' Then 'Pending'"); StrSql.AppendLine(" When IsNull(D.WorkStatus,'')='C' Then 'Cancle' Else '0' End As WorkStatus"); StrSql.AppendLine(",D.Remark"); StrSql.AppendLine("From DRFDET D"); StrSql.AppendLine("Left Join Project_Mast P On D.PrjId=P.Id "); StrSql.AppendLine("Left Join Project_Module M On D.PrjModId=M.Id "); StrSql.AppendLine("Where D.DRFId=" + int.Parse(HidFldId.Value)); StrSql.AppendLine("Order By D.DRFId,D.Id"); StrSql.AppendLine(";"); StrSql.AppendLine("Select IsNull(SUM(ISNULL(TotTime,0)),0) As TotTime From DRFDET Where DRFId=" + int.Parse(HidFldId.Value)); ds = new DataSet(); ds = SqlFunc.ExecuteDataSet(StrSql.ToString()); if (ds.Tables[0].Rows.Count != 0) { GridWork.DataSource = ds; GridWork.DataBind(); if (ds.Tables[1].Rows.Count != 0) { TxtTotTime.Text = ds.Tables[1].Rows[0]["TotTime"].ToString(); } else { TxtTotTime.Text = ""; } ModulePanel.Visible = true; } else { ds.Tables[0].Rows.Add(ds.Tables[0].NewRow()); GridWork.DataSource = ds; GridWork.DataBind(); int columncount = GridWork.Rows[0].Cells.Count; GridWork.Rows[0].Cells.Clear(); GridWork.Rows[0].Cells.Add(new TableCell()); GridWork.Rows[0].Cells[0].ColumnSpan = columncount; GridWork.Rows[0].Cells[0].Text = "No Records Found"; } } } catch (Exception ex) { Response.Write(ex.ToString()); } }