// To get the goals of the user and fill in the grid void FillGridGoal_Planning() { if ((string)Session["userSessionID"] != null) { string xCode = Session["userSessionID"].ToString(); SqlDataAdapter GDA = new SqlDataAdapter(" " + " select Code=g.code,ShName=case when isnull(g.exlcode,'')='' then s.sname else (select sname from schmst where exlcode=g.exlcode) end, CurrentValue=Amount, SExlcode=s.Exlcode, ActualInvestment=isnull(ActualInvestment,0), (year(startdate)-year(EntryDate))*12,GoalName, " + " GoalYear=(SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), StartDate, 106), 8), ' ', '-')), " + " Period=(year(startdate)-year(getdate())), " + " AmountReq=cast(round((Amount*(power(1+(" + xInflation + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000)))),0) as int), " + " SIPAmt=floor(round(((((Amount*(power(1+(" + xInflation + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))))*(" + xRiskPer + "*1.000000/100))/ " + " (power((1+" + xRiskPer + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))-1))/12)/1000,0,0) )*1000 " + " from fp_GoalDetails g,fp_prospects p,fp_RiskObjMatrix r,fp_schemeMatrix s " + " where g.GroupCode=p.code and p.riskcode=r.riskcode and r.Category=s.Category and GoalCode<>7 and " + " (year(startdate)-year(getdate()))*12 between frommonth and tomonth and userid='" + xCode + "' order by startdate " + " ", Con); DataSet GDS = new DataSet(); Con.Open(); GDA.Fill(GDS); Con.Close(); GridViewGoalPlanning.DataSource = GDS; GridViewGoalPlanning.DataBind(); } else { Response.Redirect("SessionExpired.aspx?ss=A"); } }
// To get the goals of the user and fill in the grid void FillGridGoal_Planning() { if ((string)Session["userSessionID"] != null) { string xCode = Session["userSessionID"].ToString(); SqlDataAdapter GDA = new SqlDataAdapter(" " + " select GoalName, CurrentValue=Amount, " + " GoalYear=(SELECT REPLACE(RIGHT(CONVERT(VARCHAR(11), StartDate, 106), 8), ' ', '-')), " + " Period=(year(startdate)-year(getdate())), " + " AmountReq=cast(round((Amount*(power(1+(" + xInflation + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000)))),0) as int), " + " AnnualAmt=cast((((Amount*(power(1+(" + xInflation + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))))*(" + xRiskPer + "*1.000000/100))/ " + " (power((1+" + xRiskPer + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))-1)) as int), " + " SIPAmt=floor(round(((((Amount*(power(1+(" + xInflation + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))))*(" + xRiskPer + "*1.000000/100))/ " + " (power((1+" + xRiskPer + "*1.000000/100),(datediff(M,getdate(),startdate)/12.000))-1))/12)/1000,0,0) )*1000 " + " from fp_GoalDetails where GroupCode=(select Code from fp_prospects where userid='" + xCode + "' ) and GoalCode<>7 order by startdate " + " ", Con); DataSet GDS = new DataSet(); Con.Open(); GDA.Fill(GDS); Con.Close(); GridViewGoalPlanning.DataSource = GDS; GridViewGoalPlanning.DataBind(); } else { Response.Redirect("SessionExpired.aspx"); } }
protected void OnPaging(object sender, GridViewPageEventArgs e) { GridViewGoalPlanning.PageIndex = e.NewPageIndex; GridViewGoalPlanning.DataBind(); FillGridGoal_Planning(); }