public ActionResult DeleteAdditional(int id) { MehriamarqueeEntities objforcontext = new MehriamarqueeEntities(); AdditionalFacilitiesandFunction addi = new AdditionalFacilitiesandFunction(); Bookingdata book = new Bookingdata(); addi = objforcontext.AdditionalFacilitiesandFunctions.Where(x => x.additionalID.Equals(id)).FirstOrDefault(); book = objforcontext.Bookingdatas.Where(x => x.functionID.Equals(addi.functionID)).FirstOrDefault(); value = addi.additionalFacilityPrice ?? default(int); book.TotalCharges = book.TotalCharges - value; objforcontext.Entry(book).State = System.Data.Entity.EntityState.Modified; objforcontext.SaveChanges(); objforcontext.Entry(addi).State = System.Data.Entity.EntityState.Deleted; objforcontext.SaveChanges(); return(View("Index")); }
public void UpdateCustomerSave(Customer cus) { using (MehriamarqueeEntities meh = new MehriamarqueeEntities()) { meh.Entry(cus).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); } }
public ActionResult EditBeverages(Beverage beve) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); meh.Entry(beve).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); return(RedirectToAction("ViewBeverages")); }
public ActionResult EditVegetable(Item it) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); meh.Entry(it).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); return(RedirectToAction("ViewVegetable")); }
public ActionResult EditDeserts(Desert de) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); meh.Entry(de).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); return(RedirectToAction("ViewDeserts")); }
public void DeleteCustomerbyID(long id) { Customer cus = new Customer(); using (MehriamarqueeEntities meh = new MehriamarqueeEntities()) { cus = meh.Customers.Where(X => X.customerID == id).FirstOrDefault(); meh.Entry(cus).State = System.Data.Entity.EntityState.Deleted; meh.SaveChanges(); } }
public void DeleteFunctionbyID(int id) { Bookingdata book = new Bookingdata { functionID = id }; using (MehriamarqueeEntities meh = new MehriamarqueeEntities()) { meh.Entry(book).State = System.Data.Entity.EntityState.Deleted; meh.SaveChanges(); } }
public ActionResult EditAdditional(EditAdditionalFacilities addfacility) { MehriamarqueeEntities objforcontext = new MehriamarqueeEntities(); AdditionalFacilitiesandFunction addi = new AdditionalFacilitiesandFunction(); Bookingdata book = new Bookingdata(); book = objforcontext.Bookingdatas.Where(x => x.functionID.Equals(addfacility.functionID)).FirstOrDefault(); addi = objforcontext.AdditionalFacilitiesandFunctions.Where(x => x.functionID.Equals(addfacility.functionID)).FirstOrDefault(); value = addi.additionalFacilityPrice ?? default(int); book.TotalCharges = book.TotalCharges - value; objforcontext.Entry(book).State = System.Data.Entity.EntityState.Modified; objforcontext.SaveChanges(); addi.additionalandfunctionID = addfacility.additionalandfunctionID; addi.additionalID = addfacility.additionalID; addi.functionID = addfacility.functionID; addi.additionalFacilityPrice = addfacility.additionalFacilityPrice; objforcontext.Entry(addi).State = System.Data.Entity.EntityState.Modified; objforcontext.SaveChanges(); book.TotalCharges = book.TotalCharges + addfacility.additionalFacilityPrice ?? default(int); objforcontext.Entry(book).State = System.Data.Entity.EntityState.Modified; objforcontext.SaveChanges(); return(RedirectToAction("Alldetailoffunction", "ReservationEventsmain")); }
public void Deleteadditional(int id) { List <AdditionalFacilitiesandFunction> addi = new List <AdditionalFacilitiesandFunction>(); using (MehriamarqueeEntities meh = new MehriamarqueeEntities()) { addi = meh.AdditionalFacilitiesandFunctions.Where(x => x.functionID.Equals(id)).ToList(); foreach (var item in addi) { meh.Entry(item).State = System.Data.Entity.EntityState.Deleted; meh.SaveChanges(); } } }
public ActionResult UpdateVegetable(Item it, string UpdatedQuantity) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); it.quantity = it.quantity + int.Parse(UpdatedQuantity); meh.Entry(it).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); QuantityupdatedItemtable quant = new QuantityupdatedItemtable(); quant.itemID = it.itemId; quant.Date = DateTime.Now; quant.Quantity = int.Parse(UpdatedQuantity); meh.QuantityupdatedItemtables.Add(quant); meh.SaveChanges(); return(RedirectToAction("ViewVegetable")); }
public ActionResult UpdateBeverages(Beverage beve, string UpdatedQuantity) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); beve.quantityOfBeverages = beve.quantityOfBeverages + int.Parse(UpdatedQuantity); meh.Entry(beve).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); QuantityupdateBeveragestable quant = new QuantityupdateBeveragestable(); quant.beverageID = beve.beverageId; quant.Date = DateTime.Now; quant.Quantity = int.Parse(UpdatedQuantity); meh.QuantityupdateBeveragestables.Add(quant); meh.SaveChanges(); return(RedirectToAction("ViewBeverages")); }
public ActionResult UpdateDeserts(Desert de, string UpdatedQuantity) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); de.quantityOfdesert = de.quantityOfdesert + int.Parse(UpdatedQuantity); meh.Entry(de).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); QuantityupdatedDeserttable quant = new QuantityupdatedDeserttable(); quant.desertID = de.desertId; quant.Date = DateTime.Now; quant.Quantity = int.Parse(UpdatedQuantity); meh.QuantityupdatedDeserttables.Add(quant); meh.SaveChanges(); return(RedirectToAction("ViewDeserts")); }
public ActionResult RequestFunction(int ID) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); Bookingdata book = meh.Bookingdatas.Where(X => X.functionID == ID).FirstOrDefault(); book.RequestStatus = "true"; meh.Entry(book).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); FunctionRequestedTable funcls = new FunctionRequestedTable(); funcls.functionID = ID; funcls.requestDate = DateTime.Today; funcls.Status = "SENDED"; meh.FunctionRequestedTables.Add(funcls); meh.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult EditFunctionGet(EditNewFunction function) { MehriamarqueeEntities mqe = new MehriamarqueeEntities(); Bookingdata bookdata = new Bookingdata(); List <AdditionalFacilitiesandFunction> addi = new List <AdditionalFacilitiesandFunction>(); addi = mqe.AdditionalFacilitiesandFunctions.Where(X => X.functionID == function.functionID).ToList(); bookdata.functionID = function.functionID; bookdata.bookingDate = function.bookingDate; bookdata.functionDate = function.functionDate; bookdata.noofGuest = function.noofGuest; bookdata.rateperGuest = function.rateperGuest; var totalrate = function.noofGuest * function.rateperGuest; bookdata.AdvancePayment = function.AdvancePayment; bookdata.RemainingPayment = function.RemainingPayment; bookdata.Extras = function.Extras; bookdata.timeShift = function.timeShift; bookdata.CnicNo = function.CnicNO; bookdata.customerID = function.customerID; bookdata.RequestStatus = function.RequestStatus; bookdata.MenuId = function.MenuId; bookdata.ProgramId = function.ProgramId; int totalpriceoffacility = 0; foreach (var item in addi) { totalpriceoffacility = totalpriceoffacility + item.additionalFacilityPrice ?? default(int); } var fullTotal = totalrate + function.AdvancePayment + function.RemainingPayment + function.Extras + totalpriceoffacility; bookdata.TotalCharges = fullTotal ?? default(int); mqe.Entry(bookdata).State = System.Data.Entity.EntityState.Modified; mqe.SaveChanges(); return(RedirectToAction("Index", "ReservationEventsmain")); }
public ActionResult GetItemsForDish(List <string> items, List <string> Beve, List <string> Desert, int idofrequest) { MehriamarqueeEntities meh = new MehriamarqueeEntities(); List <Item> itemes = meh.Items.ToList(); List <Beverage> Beveitems = meh.Beverages.ToList(); List <Desert> Desetitems = meh.Deserts.ToList(); List <Dish> dihes = meh.Dishes.ToList(); for (int i = 0; i < items.Count; i++) { foreach (var itemcoun in dihes) { if (items[i] == itemcoun.dishName) { foreach (var getitems in itemes) { int count = 0; if (items[i + 1] == "true") { DishWithItem dishofitem = new DishWithItem(); dishofitem.dishId = itemcoun.dishID; dishofitem.itemId = getitems.itemId; dishofitem.priceOfItems = int.Parse(items[i + 3]); dishofitem.qunatityOfItems = int.Parse(items[i + 4]); dishofitem.requestID = idofrequest; Item getid = new Item(); using (MehriamarqueeEntities mh = new MehriamarqueeEntities()) { getid = mh.Items.Where(X => X.itemId == getitems.itemId).FirstOrDefault(); if (getid.quantity >= int.Parse(items[i + 4])) { getid.quantity = getid.quantity - int.Parse(items[i + 4]); mh.Entry(getid).State = System.Data.Entity.EntityState.Modified; mh.SaveChanges(); } else { TempData["message"] = "Quantity is low for required quantity"; goto exit ; } } meh.DishWithItems.Add(dishofitem); meh.SaveChanges(); i = i + 4; count++; } if (count == 0) { i = i + 3; } } } } } for (int i = 0; i < Beve.Count; i++) { foreach (var itemcoun in dihes) { if (Beve[i] == itemcoun.dishName) { foreach (var getitems in Beveitems) { int count = 0; if (Beve[i + 1] == "true") { beveragesWithFunctionWithMenu dishofitem = new beveragesWithFunctionWithMenu(); dishofitem.dishID = itemcoun.dishID; dishofitem.beverageID = getitems.beverageId; dishofitem.PriceBeverages = int.Parse(Beve[i + 3]); dishofitem.quantityBeverages = int.Parse(Beve[i + 4]); dishofitem.requestID = idofrequest; Beverage getid = new Beverage(); using (MehriamarqueeEntities mh = new MehriamarqueeEntities()) { getid = mh.Beverages.Where(X => X.beverageId == getitems.beverageId).FirstOrDefault(); if (getid.quantityOfBeverages >= int.Parse(Beve[i + 4])) { getid.quantityOfBeverages = getid.quantityOfBeverages - int.Parse(Beve[i + 4]); mh.Entry(getid).State = System.Data.Entity.EntityState.Modified; mh.SaveChanges(); } else { TempData["message"] = "Quantity is low for required quantity"; goto exit ; } } meh.beveragesWithFunctionWithMenus.Add(dishofitem); meh.SaveChanges(); i = i + 4; count++; } if (count == 0) { i = i + 3; } } } } } for (int i = 0; i < Desert.Count; i++) { foreach (var itemcoun in dihes) { if (Desert[i] == itemcoun.dishName) { foreach (var getitems in Desetitems) { int count = 0; if (Desert[i + 1] == "true") { DesertWithFunctionWithMenu dishofitem = new DesertWithFunctionWithMenu(); dishofitem.dishID = itemcoun.dishID; dishofitem.desertID = getitems.desertId; dishofitem.PriceDesert = int.Parse(Desert[i + 3]); dishofitem.quantityDesert = int.Parse(Desert[i + 4]); dishofitem.requestID = idofrequest; Desert getid = new Desert(); using (MehriamarqueeEntities mh = new MehriamarqueeEntities()) { getid = mh.Deserts.Where(X => X.desertId == getitems.desertId).FirstOrDefault(); if (getid.quantityOfdesert >= int.Parse(Desert[i + 4])) { getid.quantityOfdesert = getid.quantityOfdesert - int.Parse(Desert[i + 4]); mh.Entry(getid).State = System.Data.Entity.EntityState.Modified; mh.SaveChanges(); } else { TempData["message"] = "Quantity is low for required quantity"; goto exit ; } } meh.DesertWithFunctionWithMenus.Add(dishofitem); meh.SaveChanges(); i = i + 4; count++; } if (count == 0) { i = i + 3; } } } } } exit: FunctionRequestedTable func = meh.FunctionRequestedTables.Where(X => X.requestID == idofrequest).FirstOrDefault(); func.Status = "SERVED"; meh.Entry(func).State = System.Data.Entity.EntityState.Modified; meh.SaveChanges(); return(View("Index")); }