protected void addColumDt(ArrayList s) { for (int j = 0; j < s.Count - 1; j++) { int count = 1; for (int k = j + 1; k < s.Count; k++) { if (Convert.ToInt32(s[j]) == Convert.ToInt32(s[k])) { ++count; s.RemoveAt(k); } if (count > 1) { productCount p = new productCount(); p.Id = Convert.ToString(s[j]); p.Count = Convert.ToString(count); t.AddLast(p); } if (count == 1) { productCount p = new productCount(); p.Id = Convert.ToString(s[j]); p.Count = "1"; t.AddLast(p); } } } dt.Columns.Add("NewColumn", typeof(System.Int32)); foreach (DataRow row in dt.Rows) { foreach (productCount item in t) { if (item.Id.Equals(row["ProductID"].ToString())) { row["NewColumn"] = item.Count; } else { row["NewColumn"] = "1"; } } } }
public Cart(productCount p, double s) { pc = new productCount(p.Name, p.Price, p.Count); sum = s; }