string GetPricea() { DataTable a = new DataTable(); var Getdt = new Assest.OrcDataAcess(); Getdt.show4(a); string result = ""; double price = 0; foreach (DataRow item in a.Rows) { price += double.Parse(item.Field <string>("PRICE_A").Replace("SAR ", "")); } result = price.ToString("N0") + "ر.س"; return(result); }
public string orignial_Sum() { DataTable dt = new DataTable(); var mainclass = new Assest.OrcDataAcess(); mainclass.show4(dt); var Prices = new List <string>(); var Countier = new List <int>(); foreach (DataRow item in dt.Rows) { Prices.Add(item.Field <string>("PRICE").Replace("SAR", "")); } for (int i = 0; i < Prices.Count - 1; i++) { Countier.Add(int.Parse(Prices[i])); } Double Result = Countier.Sum(); return("SAR " + Result.ToString("N2")); }