示例#1
0
        static void Main(string[] args)
        {
            
            File.ReadAllLines("Products.txt");
            string[] word;
            List<string> validLines = new List<string>();
            foreach (string line in lines)
            {
                //   Console.WriteLine(line);
                word = line.Split(',');
                List<prd> objs = new List<prd>();
                prd p1 = new prd();
                p1.prdname = word[2];
                p1.qty = Convert.ToInt32(word[3]);
                objs.Add(p1);
                foreach (var item in objs)
                {
                    // Console.WriteLine(item.prdname+ "   "+item.qty);
                    var uniqueprdnames = (from i in objs
                                          select i.prdname).Distinct();
                    var qtycount = from i in objs
                                   group i by i.prdname into f



                }
            }
            Console.ReadLine();

        }
示例#2
0
        public JsonResult Getproduct(string prdc)
        {
            List <prd> lst = new List <prd>();

            var data = (from c in db.ProductTypes where c.ProductName.StartsWith(prdc) select c).ToList();

            foreach (var item in data)
            {
                prd e = new prd();
                e.ProductType = item.ProductName;
                lst.Add(e);
            }
            return(Json(lst, JsonRequestBehavior.AllowGet));
        }