public IQueryable<EventClassViewModel> ReadEventClassList(int type) { List<EventClassViewModel> ret = new List<EventClassViewModel>(); var qryE = db.EventClass.OrderBy(p => p.Class); foreach (EventClass e in qryE) { EventClassViewModel v = new EventClassViewModel(); EventClassViewModel v2 = new EventClassViewModel(); if (ret.Count() == 0) { v.Class = e.Class.First().ToString(); v.Name = e.Class.First().ToString() + "大類"; ret.Add(v); } if (ret[ret.Count() - 1].Class.First() != e.Class.First()) { v.Class = e.Class.First().ToString(); v.Name = e.Class.First().ToString() + "大類"; ret.Add(v); } v2.Class = e.Class; v2.Name = e.Class + " : " + e.Name; if (!(type == 1 && e.Class == "C01")) ret.Add(v2); } return ret.AsQueryable(); }
public IQueryable<EventClassViewModel> ReadEventClassList(int type) { List<EventClassViewModel> ret = new List<EventClassViewModel>(); var qryE = db.EventClass.OrderBy(p => p.Class); foreach (EventClass e in qryE) { //EventClassViewModel v = new EventClassViewModel(); EventClassViewModel v2 = new EventClassViewModel(); //if (ret.Count() == 0) //{ // v.Class = e.Class.First().ToString(); // v.Name = e.Class.First().ToString() + "大類"; // if (type == 2 && (e.Class == "C01" || e.Class == "I01" || e.Class == "I02")) // ret.Add(v); //} //if (ret[ret.Count() - 1].Class.First() != e.Class.First()) //{ // v.Class = e.Class.First().ToString(); // v.Name = e.Class.First().ToString() + "大類"; // if (type == 2 && (e.Class == "C01" || e.Class == "I01" || e.Class == "I02")) // ret.Add(v); //} v2.Class = e.Class; v2.Name = e.Class + " : " + e.Name; //if (!(type == 1 && e.Class == "C01")) if ((type == 2 && (e.Class != "M01" && e.Class != "C02" && e.Class != "C03")) || type == 1) ret.Add(v2); } return ret.AsQueryable(); }
public IQueryable<ViewModels.EventClassViewModel> Read() { List<EventClassViewModel> ret = new List<EventClassViewModel>(); var qry = db.EventClass; foreach (EventClass o in qry) { EventClassViewModel e = new EventClassViewModel(); e.Class = o.Class; e.Name = o.Name; ret.Add(e); } return ret.AsQueryable(); }
public IQueryable<EventClassViewModel> ReadEventClassList() { List<EventClassViewModel> ret = new List<EventClassViewModel>(); var qryE = db.EventClass.OrderBy(p => p.Class); foreach (EventClass e in qryE) { //EventClassViewModel v = new EventClassViewModel(); EventClassViewModel v2 = new EventClassViewModel(); //if (ret.Count() == 0) //{ // v.Class = e.Class.First().ToString(); // v.Name = e.Class.First().ToString() + "大類"; // ret.Add(v); //} //if (ret[ret.Count() - 1].Class.First() != e.Class.First()) { // v.Class = e.Class.First().ToString(); // v.Name = e.Class.First().ToString() + "大類"; // ret.Add(v); //} v2.Class = e.Class; v2.Name = e.Class + " : " + e.Name; ret.Add(v2); } return ret.AsQueryable(); }