private List <FoodMenuModel> PrintFoodMenu(IIterator iterator) { Console.WriteLine("Table List"); Console.WriteLine("**************************************"); Console.WriteLine(); List <FoodMenuModel> foodMenu = new List <FoodMenuModel>(); while (iterator.HasNext()) { FoodMenuModel foodMenuItem = (FoodMenuModel)iterator.Next(); foodMenu.Add(foodMenuItem); Console.WriteLine("Restaurant ID : {0}", foodMenuItem.RestaurantId); Console.WriteLine("Table ID : {0}", foodMenuItem.FoodId); Console.WriteLine("Number of Seat : {0}", foodMenuItem.Cuisine); Console.WriteLine("Table Status : {0}", foodMenuItem.FoodName); Console.WriteLine("____________________________"); Console.WriteLine(); } return(foodMenu); }
public object Next() { FoodMenuModel menuItem = foodItems[postion]; postion++; return(menuItem); }
private List <FoodMenuModel> PrintFoodMenu(IIterator iterator) { Console.WriteLine("Food Menu"); Console.WriteLine("**************************************"); Console.WriteLine(); List <FoodMenuModel> foodMenu = new List <FoodMenuModel>(); while (iterator.HasNext()) { FoodMenuModel foodMenuItem = (FoodMenuModel)iterator.Next(); foodMenu.Add(foodMenuItem); Console.WriteLine("Restaurant ID : {0}", foodMenuItem.RestaurantId); Console.WriteLine("Food ID : {0}", foodMenuItem.FoodId); Console.WriteLine("Food Name : {0}", foodMenuItem.FoodName); Console.WriteLine("Couisine : {0}", foodMenuItem.Cuisine); Console.WriteLine("Rate(Rs.) : {0}", foodMenuItem.Rate); Console.WriteLine("Rating : {0}", foodMenuItem.Rating); Console.WriteLine("____________________________"); Console.WriteLine(); } return(foodMenu); }
public JsonResult GetFoodMenuCategory() { FoodMenuModel foodMenuModel = new FoodMenuModel(); foodMenuModel.FoodCategoryList = _iDropDownService.GetFoodMenuCategoryList(); return(Json(new { FoodCategoryList = foodMenuModel.FoodCategoryList })); }
public object Next() { FoodMenuModel menuItem = items[position]; position = position + 1; return(menuItem); }
public int InsertFoodMenu(FoodMenuModel foodMenuModel) { int result = 0; int detailsResult = 0; using (SqlConnection con = new SqlConnection(_ConnectionString.Value.ConnectionString)) { CommonRepository commonRepository = new CommonRepository(_ConnectionString); result = commonRepository.GetValidateUnique("FoodMenu", "FoodMenuName", foodMenuModel.FoodMenuName, foodMenuModel.Id.ToString()); if (result > 0) { return(-1); } int MaxId = commonRepository.GetMaxId("FoodMenu"); con.Open(); SqlTransaction sqltrans = con.BeginTransaction(); var query = "INSERT INTO FoodMenu " + "( Id,FoodCategoryId, FoodMenuName, FoodMenuType,FoodMenuCode, FoodMenuBarCode,PurchasePrice,SalesPrice, Notes, UnitsId,FoodVatTaxId," + " Position, IsActive) " + "Values " + "(" + MaxId + ", @FoodCategoryId, upper(@FoodMenuName),@FoodMenuType, @FoodMenuCode, @FoodMenuBarCode,@PurchasePrice,@SalesPrice, @Notes,@UnitsId,@FoodVatTaxId," + "@Position, @IsActive);" + " SELECT CAST(SCOPE_IDENTITY() as INT);"; result = con.Execute(query, foodMenuModel, sqltrans, 0, System.Data.CommandType.Text); if (result > 0) { sqltrans.Commit(); //CREATE ENTRY INTO INVETORY AS STOCK 0.00 query = " INSERT INTO INVENTORY (STOREID,FOODMENUID,STOCKQTY,USERIDINSERTED,ISDELETED)" + " Select S.ID as StoreId,FM.Id,0,1,0 from foodmenu FM CROSS JOIN STORE S " + " WHERE FM.ID =" + MaxId; result = con.Execute(query, foodMenuModel, sqltrans, 0, System.Data.CommandType.Text); //CREATE ENTRY INTO FOODMENURATE query = " INSERT INTO FOODMENURATE(Id, OutletId, FoodMenuId, SalesPrice, FoodVatTaxId, IsActive) " + " Select(select max(Id) from foodmenurate) + ROW_NUMBER() OVER(ORDER BY fm.id desc) AS Row# " + " , O.Id,FM.Id,FM.SalesPrice,FM.FoodVatTaxId,1 from FoodMenu FM Cross join Outlet O " + " Where FM.Id =" + MaxId; result = con.Execute(query, foodMenuModel, sqltrans, 0, System.Data.CommandType.Text); string output = commonRepository.SyncTableStatus("FoodMenu"); output = commonRepository.SyncTableStatus("INVENTORY"); output = commonRepository.SyncTableStatus("FOODMENURATE"); } else { sqltrans.Rollback(); } } return(result); }
public FoodMenuModel GetFoodMenueById(int foodMenuId) { List <FoodMenuModel> foodMenuModel = new List <FoodMenuModel>(); FoodMenuModel model = new FoodMenuModel(); model = _iFoodMenuReportsitory.GetFoodMenuById(foodMenuId).ToList().SingleOrDefault(); if (model != null) { // model.FoodMenuDetails = _iFoodMenuReportsitory.GetFoodMenuDetails(foodMenuId); } return(model); }
private string ValidationFoodMenu(FoodMenuModel foodMenuModel) { string ErrorString = string.Empty; //if (string.IsNullOrEmpty(foodMenuModel.FoodMenuName)) //{ // ErrorString = _locService.GetLocalizedHtmlString("ValidAddOnesName"); // return ErrorString; //} //if (string.IsNullOrEmpty(foodMenuModel.Price.ToString()) || foodMenuModel.Price == 0) //{ // ErrorString = _locService.GetLocalizedHtmlString("ValidPrice"); // return ErrorString; //} return(ErrorString); }
public ActionResult FoodMenu(FoodMenuModel foodMenuModel, string submitButton) { if (!ModelState.IsValid) { string errorString = this.ValidationFoodMenu(foodMenuModel); if (!string.IsNullOrEmpty(errorString)) { ViewBag.Validate = errorString; return(View(foodMenuModel)); } } if (foodMenuModel.Id > 0) { var result = _iFoodMenuService.UpdateFoodMenu(foodMenuModel); if (result == -1) { ModelState.AddModelError("FoodMenuName", "Menu Item already exists"); foodMenuModel.FoodCategoryList = _iDropDownService.GetFoodMenuCategoryList(); foodMenuModel.FoodVatTaxList = _iDropDownService.GetTaxList(); foodMenuModel.UnitsList = _iDropDownService.GetUnitList(); return(View(foodMenuModel)); } ViewBag.Result = _locService.GetLocalizedHtmlString("EditSuccss"); } else { var result = _iFoodMenuService.InsertFoodMenu(foodMenuModel); if (result == -1) { ModelState.AddModelError("FoodMenuName", "Menu Item already exists"); foodMenuModel.FoodCategoryList = _iDropDownService.GetFoodMenuCategoryList(); foodMenuModel.FoodVatTaxList = _iDropDownService.GetTaxList(); foodMenuModel.UnitsList = _iDropDownService.GetUnitList(); return(View(foodMenuModel)); } ViewBag.Result = _locService.GetLocalizedHtmlString("SaveSuccess"); } return(RedirectToAction("Index", "Foodmenu")); }
public ActionResult FoodMenu(int?id) { FoodMenuModel foodMenuModel = new FoodMenuModel(); if (UserRolePermissionForPage.Add == true || UserRolePermissionForPage.Edit == true) { if (id > 0) { int foodMenuId = Convert.ToInt32(id); foodMenuModel = _iFoodMenuService.GetFoodMenueById(foodMenuId); } foodMenuModel.FoodCategoryList = _iDropDownService.GetFoodMenuCategoryList(); foodMenuModel.FoodVatTaxList = _iDropDownService.GetTaxList(); foodMenuModel.UnitsList = _iDropDownService.GetUnitList(); return(View(foodMenuModel)); } else { return(RedirectToAction("NotFound", "Error")); } }
public List <FoodMenuModel> PrintFoodMenu(IIterator iterator) { Console.WriteLine("Food Menu"); Console.WriteLine("*********************************"); List <FoodMenuModel> foodMenu = new List <FoodMenuModel>(); while (iterator.HasNext()) { FoodMenuModel foodMenuItem = (FoodMenuModel)iterator.Next(); foodMenu.Add(foodMenuItem); Console.WriteLine("*********************************"); Console.WriteLine($"Food ID : {foodMenuItem.FoodID}"); Console.WriteLine($"Food Name : {foodMenuItem.FoodName}"); Console.WriteLine($"Cuisine : {foodMenuItem.Cuisine}"); Console.WriteLine($"Price : {foodMenuItem.Price}"); Console.WriteLine($"Rating : {foodMenuItem.Rating}"); } return(foodMenu); }
public FoodMenuModel GetFoodMenu(int outLetId) { FoodMenuModel foodMenuModel = new FoodMenuModel(); List <FoodMenu> foodMenus = new List <FoodMenu>(); foodMenuModel.FoodList = new List <FoodList>(); using (var db = new SqlConnection(appSettings.GetConnectionString())) { foodMenus = db.Query <FoodMenu>("SELECT FMC.Id,FM.Id AS FoodMenuId,FMC.IsFavourite, FMC.FoodMenuCategoryName As FoodCategory,FM.FoodCategoryId,FM.FoodMenuName As SmallName,FM.FoodMenuCode,FM.SmallThumb,FMR.SalesPrice,ISNULL(FMR.FoodVat,0) AS FoodVat ,ISNULL(FMR.Foodcess,0) AS Foodcess,ISNULL(FM.IsPriceChange,0) AS IsPriceChange,ISNULL(T.TaxPercentage,0) As TaxPercentage,Case When ISNULL(T.TaxPercentage,0)>0 Then 1 Else 0 End AS IsVatable FROM [dbo].[FoodMenuCategory] FMC " + " Inner Join[dbo].[FoodMenu] FM ON FMC.Id = FM.FoodCategoryId " + " INNER JOIN FoodMenuRate FMR ON FM.Id = FMR.FoodMenuId " + " Left Join Tax T On T.Id=FMR.FoodVatTaxId Where FMR.OutletId =" + outLetId + " And FMR.IsActive=1 And FMC.IsActive=1 AND FMC.ISDeleted=0 AND FoodMenuType!=4 AND FM.ISDeleted=0 order by FMC.position,FM.position").ToList(); foodMenuModel.FoodList = foodMenus.GroupBy(menuCat => new { menuCat.Id, menuCat.FoodCategory, menuCat.IsFavourite }, (menuCategory, mainElements) => new FoodList { Id = menuCategory.Id, FoodCategory = menuCategory.FoodCategory, IsFavourite = menuCategory.IsFavourite, SubCategory = mainElements.GroupBy(subCat => new { subCat.FoodMenuId, subCat.FoodCategoryId, subCat.SmallName, subCat.SalesPrice, subCat.SmallThumb, subCat.FoodVat, subCat.Foodcess, subCat.TaxPercentage, subCat.IsVatable, subCat.IsPriceChange }, (subCategory, subElements) => new SubCategory { FoodMenuId = subCategory.FoodMenuId, FoodCategoryId = subCategory.FoodCategoryId, SmallName = subCategory.SmallName, SalesPrice = subCategory.SalesPrice, SmallThumb = subCategory.SmallThumb, FoodVat = subCategory.FoodVat, Foodcess = subCategory.Foodcess, TaxPercentage = subCategory.TaxPercentage, IsVatable = subCategory.IsVatable, IsPriceChange = subCategory.IsPriceChange }).ToList(), }).ToList(); } return(foodMenuModel); }
public int UpdateFoodMenu(FoodMenuModel foodMenuModel) { int result = 0; int detailsResult = 0; using (SqlConnection con = new SqlConnection(_ConnectionString.Value.ConnectionString)) { CommonRepository commonRepository = new CommonRepository(_ConnectionString); result = commonRepository.GetValidateUnique("FoodMenu", "FoodMenuName", foodMenuModel.FoodMenuName, foodMenuModel.Id.ToString()); if (result > 0) { return(-1); } con.Open(); SqlTransaction sqltrans = con.BeginTransaction(); var query = "UPDATE FoodMenu SET " + "FoodCategoryId=@FoodCategoryId, " + "FoodMenuName=@FoodMenuName, " + "FoodMenuType=@FoodMenuType, " + "FoodMenuCode=@FoodMenuCode, " + "FoodMenuBarCode=@FoodMenuBarCode," + "PurchasePrice=@PurchasePrice, " + " UnitsId = @UnitsId," + " FoodVatTaxId =@FoodVatTaxId ," + "ColourCode=@ColourCode," + "BigThumb=@BigThumb, " + "MediumThumb=@MediumThumb, " + "SmallThumb=@SmallThumb, " + "SalesPrice=@SalesPrice, " + "Notes=@Notes, " + "IsVegItem=@IsVegItem, " + "IsBeverages=@IsBeverages,FoodVat=@FoodVat, " + "Foodcess=@Foodcess, " + "OfferIsAvailable=@OfferIsAvailable," + "Position=@Position, " + "OutletId=@OutletId, " + "IsActive=@IsActive " + ",[UserIdUpdated] = " + LoginInfo.Userid + " " + ",[DateUpdated] = GetUtcDate() WHERE Id = @Id;"; result = con.Execute(query, foodMenuModel, sqltrans, 0, System.Data.CommandType.Text); if (result > 0) { int detailResult = 0; if (foodMenuModel.DeletedId != null) { foreach (var item in foodMenuModel.DeletedId) { var deleteQuery = $"update FoodMenuIngredient set IsDeleted = 1, UserIdDeleted = " + LoginInfo.Userid + ", DateDeleted = GetutcDate() where id = " + item + ";"; result = con.Execute(deleteQuery, null, sqltrans, 0, System.Data.CommandType.Text); } } //foreach (var item in foodMenuModel.FoodMenuDetails) //{ // var queryDetails = string.Empty; // if (item.FoodMenuId > 0) // { // queryDetails = "Update [dbo].[FoodMenuIngredient] set " + // " [FoodMenuId] = " + item.FoodMenuId + "," + // " [IngredientId] = " + item.IngredientId + "," + // " [Consumption] = " + item.Consumption + "," + // " [UserIdUpdated] = " + LoginInfo.Userid + "," + // " [DateUpdated] = GetUTCDate() " + // " where id = " + item.FoodMenuId + ";"; // } // else // { // var detailsQuery = "insert into FoodMenuIngredient (FoodMenuId, IngredientId , Consumption,[UserIdUpdated] ) values (" + // "" + foodMenuModel.Id + "," + // "" + item.IngredientId + "," + // "" + item.Consumption + "," + // "" + LoginInfo.Userid + "); "; // } // detailResult = con.Execute(queryDetails, null, sqltrans, 0, System.Data.CommandType.Text); //} if (result > 0) { sqltrans.Commit(); // query = $"UPDATE FoodMenuRate SET FoodVatTaxId = " + foodMenuModel.FoodVatTaxId + " WHERE FoodmenuId = {foodMenuId};"; // result = con.Execute(query, null, sqltrans, 0, System.Data.CommandType.Text); string output = commonRepository.SyncTableStatus("FoodMenu"); } else { sqltrans.Rollback(); } } return(result); } }
public int UpdateFoodMenu(FoodMenuModel FoodMenuModel) { return(_iFoodMenuReportsitory.UpdateFoodMenu(FoodMenuModel)); }
public int InsertFoodMenu(FoodMenuModel FoodMenuModel) { return(_iFoodMenuReportsitory.InsertFoodMenu(FoodMenuModel)); }