public bool DeleteCoffeeLandScape(int CLSID) { try { CoffeeLandScape cls = context.CoffeeLandScapes.Single(m => m.CLSID == CLSID); context.CoffeeLandScapes.DeleteOnSubmit(cls); context.SubmitChanges(); return(true); } catch (Exception e) { throw new Exception("Error delete" + e.Message); } }
public CoffeeLandScape GetCoffeeLandScapeByID(int ID) { try { CoffeeLandScape result = (from coffeelandscape in context.CoffeeLandScapes where coffeelandscape.CLSID == ID select coffeelandscape).SingleOrDefault(); return(result); } catch (Exception ex) { return(null); } }
public bool UpdateCoffeeLandScape(int CLSID, float width, float height, float ratio, int CSID, string FloorID) { try { CoffeeLandScape landscape = GetCoffeeLandScapeByID(CLSID); landscape.Width = width; landscape.Height = height; landscape.MapRatio = ratio; landscape.CSID = CSID; landscape.FloorID = FloorID; this.context.SubmitChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool InsertCoffeeLandScape(int CSID, string FloorID, double MapRatio, double width, double height) { try { CoffeeLandScape coffeeLandScape = new CoffeeLandScape(); coffeeLandScape.CSID = CSID; coffeeLandScape.FloorID = FloorID; coffeeLandScape.MapRatio = MapRatio; coffeeLandScape.Width = width; coffeeLandScape.Height = height; this.context.CoffeeLandScapes.InsertOnSubmit(coffeeLandScape); this.context.SubmitChanges(); return(true); } catch (Exception ex) { throw new Exception("Error InsertCoffeeLandScape" + ex.Message); } }
public ActionResult ViewDiagram(int CLSID) { ViewData["reset"] = TempData["reset"]; string url = Request.Url.AbsoluteUri; int end = url.IndexOf("/admin"); string domain = url.Substring(0, end); IEnumerable <CoffeeLandScape> coffeeLandScapes = info.GetAllCoffeeLandScape(); if (coffeeLandScapes.Count() != 0) { List <SelectListItem> listCoffeeLandScape = new List <SelectListItem>(); foreach (var coffeelandscape in coffeeLandScapes) { SelectListItem select = new SelectListItem(); select.Text = coffeelandscape.CLSID.ToString(); select.Value = coffeelandscape.CLSID.ToString(); listCoffeeLandScape.Add(select); } ViewData["listCoffeeLandScape"] = listCoffeeLandScape; } IEnumerable <CoffeeShop> coffeeShop = info.GetAllCoffeeShop(); List <SelectListItem> listCoffeeShop = new List <SelectListItem>(); foreach (var item in coffeeShop) { SelectListItem select = new SelectListItem(); select.Text = item.Name; select.Value = item.CSID.ToString(); listCoffeeShop.Add(select); } ViewData["listCoffeeShop"] = listCoffeeShop; CoffeeLandScape landscape = info.GetCoffeeLandScapeByID(CLSID); IEnumerable <CoffeeLandScapeDetail> detailLandScapes = info.GetAllCoffeeLandScapeDetailByCoffeeLandScapeID(CLSID); ViewData["landscape"] = landscape; ViewData["detailLandScapes"] = detailLandScapes; ViewData["domain"] = domain; //ViewData["CLSID"] = CLSID; return(View()); }