private void PopulateCategories(TranSactionS mTranSactionS) { foreach (TranSaction s in mTranSactionS.ToList()) { currentTransaction = s; if (!CategoryMe(currentTransaction)) { //can't get the category by comparing what the filter xml have //have to ask for user to figure out what it is lblTransactionDescription.Text = s.Description.ToString(); Session["currentTransaction"] = currentTransaction; break; } } if (myTransactions.Count < 1) { //if our filter is complete display our result in new page SaveFilter(); Session.Remove("myTranSactions"); //Session.Remove("XMLFilter"); //Session.Remove("XMLFileLoc"); Session["modifiedTransactions"] = modifiedTransactions; Server.Transfer("MyFinan53.aspx"); } }
private bool DrawMyBarChart(TranSactionS TransactionS) { bool bReturn = false; if (TransactionS != null) { TranSactionS deposit = new TranSactionS(); TranSactionS withraw = new TranSactionS(); Legend leg = new Legend(); Chart3.Legends.Add(leg); Chart3.Series.Add("Spending"); Chart3.Series.Add("Deposit"); //Chart3.Series["Spending"].PostBackValue = "#INDEX"; //Chart3.Series["Spending"].LegendPostBackValue = "#INDEX"; //Chart3.Series["Deposit"].PostBackValue = "#INDEX"; //Chart3.Series["Deposit"].LegendPostBackValue = "#INDEX"; withraw.AddRange(TransactionS); foreach (TranSaction s in withraw.ToList()) { if (s.myCategory == "Bank") { deposit.Add(s); withraw.Remove(s); } } barGraphLookUp = (Lookup <string, decimal>)withraw.ToLookup(p => p.myDate.ToString("y"), p => p.Amt); foreach (IGrouping <string, decimal> TransactionsGroup in barGraphLookUp) { decimal amount = 0.00m; foreach (decimal s in TransactionsGroup) { amount += Math.Abs(s); } Chart3.Series["Spending"].Points.AddXY(TransactionsGroup.Key, amount); } barGraphLookUp = (Lookup <string, decimal>)deposit.ToLookup(p => p.myDate.ToString("y"), p => p.Amt); foreach (IGrouping <string, decimal> TransactionsGroup in barGraphLookUp) { decimal amount = 0.00m; foreach (decimal s in TransactionsGroup) { amount += Math.Abs(s); } Chart3.Series["Deposit"].Points.AddXY(TransactionsGroup.Key, amount); } // Set series visual attributes Chart3.Series["Spending"].ChartType = SeriesChartType.Column; Chart3.Series["Spending"].ShadowOffset = 2; Chart3.Series["Spending"].Color = Color.Red; Chart3.Series["Deposit"].ChartType = SeriesChartType.Column; Chart3.Series["Deposit"].ShadowOffset = 2; Chart3.Series["Deposit"].Color = Color.Green; Chart3.ChartAreas[0].AxisY.Title = "Value in $$"; Chart3.Titles[0].Text = "Overall Spendings"; bReturn = true; } return(bReturn); }