public PartialViewResult _MargeTable() { int oulte = xml.getOutletId(); List <BillTableModel> List = new List <BillTableModel>(); var result = db.tblTableMasters.Where(o => o.OutletId == oulte).ToList(); foreach (var item in result) { BillTableModel mo = new BillTableModel(); var filepath = Server.MapPath("~/xmltables/table" + item.TableNo + ".xml"); if (System.IO.File.Exists(filepath)) { XDocument xd = XDocument.Load(filepath); var items = (from p in xd.Descendants("Items") where p.Element("UserId").Value == oulte.ToString() && p.Element("TableNo").Value == item.TableNo.ToString() select p).ToList(); if (items.Count == 0) { mo.TableNo = item.TableNo.ToString(); mo.AcType = item.AcType.ToString(); List.Add(mo); } } } return(PartialView("_MargeTable", List)); }
public ActionResult Index() { NibsBillingModel nibs = new NibsBillingModel(); List <BillTableModelList> ItemLIst = new List <BillTableModelList>(); int oulte = nibsrepo.getOutletId(); var address = (from p in db.tblOutlets where p.OutletId == oulte select p.Address).SingleOrDefault(); ViewBag.outletaddress = address; var category = (from q in db.tblCategories where q.Active == true && (from p in db.tblMenuOutlets where p.OutletId == oulte select p.CategoryId).Contains(q.CategoryId) select q).ToList(); // var ItemList = db.tblMenuOutlets.Where(o => o.OutletId == WebSecurity.CurrentUserId).ToList(); foreach (var item in category) { BillTableModelList model = new BillTableModelList(); model.CategoryId = item.CategoryId; model.CategoryName = item.Name; model.Color = item.Color; model.TextColor = item.TextColor; ItemLIst.Add(model); } nibs.getAllItem = ItemLIst; var result = db.tblTableMasters.Where(o => o.OutletId == oulte).ToList(); List <BillTableModel> List = new List <BillTableModel>(); foreach (var item in result) { BillTableModel mo = new BillTableModel(); var filepath = Server.MapPath("/xmltables/table" + item.TableNo + ".xml"); if (System.IO.File.Exists(filepath)) { XDocument xd = XDocument.Load(filepath); var items = (from p in xd.Descendants("Items") where p.Element("UserId").Value == oulte.ToString() && p.Element("TableNo").Value == item.TableNo.ToString() select p).ToList(); if (items.Count > 0) { mo.Current = "current"; } } mo.TableNo = item.TableNo.ToString(); mo.AcType = item.AcType.ToString(); List.Add(mo); } nibs.getAllTables = List; return(View(nibs)); }
public List <BillTableModel> GetListofTables() { int oulte = getOutletId(); var result = _entities.tblTableMasters.Where(o => o.OutletId == oulte).ToList(); List <BillTableModel> List = new List <BillTableModel>(); foreach (var item in result) { string dirpath = Directory.GetCurrentDirectory(); //XDocument xd = XDocument.Load(Path); //var current = from p in xd.Descendants("Items") // where p.Element("UserId").Value == oulte.ToString() && p.Element("TableNo").Value == item.TableNo.ToString() // select p.Element("TableNo").Value; BillTableModel model = new BillTableModel(); model.TableNo = item.TableNo.ToString(); model.AcType = item.AcType.ToString(); List.Add(model); } return(List); }