protected void ClearAll() { try { LblMsg.Text = ""; HidFldId.Value = ""; DDLClientName.Items.Clear(); DDLClientName.DataSource = BLayer.FillClient(); DDLClientName.DataTextField = "ClientName"; DDLClientName.DataValueField = "ClientId"; DDLClientName.DataBind(); DDLClientName.Items.Insert(0, new ListItem("---Select Client---", "0")); TxtPrjName.Text = ""; TxtStartDate.Text = ""; TxtEndDate.Text = ""; ddlPrjStatus.SelectedIndex = 0; TxtRemark.Text = ""; GridModule.DataSource = null; GridModule.DataBind(); } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void DispRecord(string pStrNavigation) { int IntId = 0; StrSql = new StringBuilder(); StrSql.Length = 0; if (pStrNavigation == "EXAC") { IntId = int.Parse(HidFldId.Value); } else if (pStrNavigation.Trim().ToUpper() == "FIRST") { StrSql.AppendLine("Select Top 1 Id From Project_Mast Order By Id"); } else if (pStrNavigation.Trim().ToUpper() == "NEXT") { if (HidFldId.Value == "") { LblMsg.Text = "Data not found"; return; } StrSql.AppendLine("Select Top 1 Id From Project_Mast Where Id > " + int.Parse(HidFldId.Value)); } else if (pStrNavigation.Trim().ToUpper() == "PREV") { if (HidFldId.Value == "") { LblMsg.Text = "Data not found"; return; } StrSql.AppendLine("Select Top 1 Id From Project_Mast Where Id < " + int.Parse(HidFldId.Value) + " Order By Id Desc"); } else if (pStrNavigation.Trim().ToUpper() == "LAST") { StrSql.AppendLine("Select Top 1 Id From Project_Mast Order By Id Desc"); } if (pStrNavigation != "EXAC") { dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); if (dtTemp.Rows.Count != 0) { IntId = int.Parse(dtTemp.Rows[0]["Id"].ToString()); } } StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select P.Id,P.ClientId,P.ProjectName"); StrSql.AppendLine(",Convert(Varchar(10),P.StartDate,103) As StartDate"); StrSql.AppendLine(",Convert(Varchar(10),P.EndDate,103) As EndDate"); StrSql.AppendLine(",P.ProjctStatus"); StrSql.AppendLine(",P.Remark"); StrSql.AppendLine("From Project_Mast P"); StrSql.AppendLine("Where P.Id=" + IntId); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); if (dtTemp.Rows.Count == 0) { ClearAll(); LblMsg.Text = "Data not found"; return; } LblMsg.Text = ""; HidFldId.Value = IntId.ToString(); DDLClientName.Items.Clear(); DDLClientName.DataSource = BLayer.FillClient(); DDLClientName.DataTextField = "ClientName"; DDLClientName.DataValueField = "ClientId"; DDLClientName.DataBind(); DDLClientName.Items.Insert(0, new ListItem("--Select Client--", "0")); if (dtTemp.Rows[0]["ClientId"].ToString() != "") { DDLClientName.SelectedValue = dtTemp.Rows[0]["ClientId"].ToString(); } TxtPrjName.Text = dtTemp.Rows[0]["ProjectName"].ToString(); TxtStartDate.Text = dtTemp.Rows[0]["StartDate"].ToString(); TxtEndDate.Text = dtTemp.Rows[0]["EndDate"].ToString(); if (dtTemp.Rows[0]["ProjctStatus"].ToString() != "") { ddlPrjStatus.SelectedValue = dtTemp.Rows[0]["ProjctStatus"].ToString(); } else { ddlPrjStatus.SelectedIndex = 0; } TxtRemark.Text = dtTemp.Rows[0]["Remark"].ToString(); FillModuleData(); }
protected void btnPrjSelect_Click(object sender, ImageClickEventArgs e) { try { ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; Session["Id"] = GridPrj.DataKeys[gvrow.RowIndex].Value.ToString(); HidFldId.Value = Session["Id"].ToString(); StrSql = new StringBuilder(); StrSql.Length = 0; StrSql.AppendLine("Select P.Id,P.ClientId,P.ProjectName"); StrSql.AppendLine(",Convert(Varchar(10),P.StartDate,103) As StartDate"); StrSql.AppendLine(",Convert(Varchar(10),P.EndDate,103) As EndDate"); StrSql.AppendLine(",P.ProjctStatus"); StrSql.AppendLine(",P.Remark"); StrSql.AppendLine("From Project_Mast P"); StrSql.AppendLine("Where P.Id=" + int.Parse(HidFldId.Value)); dtTemp = new DataTable(); dtTemp = SqlFunc.ExecuteDataTable(StrSql.ToString()); if (dtTemp.Rows.Count == 0) { LblMsg.Text = "Data not found"; return; } DDLClientName.Items.Clear(); DDLClientName.DataSource = BLayer.FillClient(); DDLClientName.DataTextField = "ClientName"; DDLClientName.DataValueField = "ClientId"; DDLClientName.DataBind(); DDLClientName.Items.Insert(0, new ListItem("--Select Client--", "0")); if (dtTemp.Rows[0]["ClientId"].ToString() != "") { DDLClientName.SelectedValue = dtTemp.Rows[0]["ClientId"].ToString(); } TxtPrjName.Text = dtTemp.Rows[0]["ProjectName"].ToString(); TxtStartDate.Text = dtTemp.Rows[0]["StartDate"].ToString(); TxtEndDate.Text = dtTemp.Rows[0]["EndDate"].ToString(); if (dtTemp.Rows[0]["ProjctStatus"].ToString() != "") { ddlPrjStatus.SelectedValue = dtTemp.Rows[0]["ProjctStatus"].ToString(); } else { ddlPrjStatus.SelectedIndex = 0; } TxtRemark.Text = dtTemp.Rows[0]["Remark"].ToString(); FillModuleData(); //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()); } }