public ActionResult CustomiseFoodProduct(string Product) { try { GbMProduct foodproductsDetails = new GbMProduct(); ClsFoodProduct objClsFoodProduct = new ClsFoodProduct(); Int64 productId = 0; if (Product != null && Product != string.Empty) { try { Int64.TryParse(Product, out productId); } catch (Exception exc) { productId = 0; } } foodproductsDetails = objClsFoodProduct.GetProductDetail(productId); ViewBag.FoodProductAttributes = objClsFoodProduct.GetProductAttributes(productId, 0); #region Get Topping And Other Products ViewBag.OtherFoodProducts = objClsFoodProduct.GetProductsByCategories("3,4,6,7,8"); #endregion return(PartialView("CustomiseFoodProduct", foodproductsDetails)); } catch (Exception exc) { throw exc; } }
// GET: Home public ActionResult Home(string Category) { try { List <GbMProduct> foodproductsList = new List <GbMProduct>(); int categoryId = 0; if (Category != null && Category != string.Empty) { try { Int32.TryParse(Category, out categoryId); } catch (Exception exc) { categoryId = 0; } } foodproductsList = new ClsFoodProduct().GetProductList(0, categoryId); return(View("Home", foodproductsList)); } catch (Exception exc) { throw exc; } }
public ActionResult FoodItemIU(string product) { try { Int64 productId = 0; GbMProduct objProductDetails = new GbMProduct(); if (product != null && product != string.Empty) { try { Int64.TryParse(product, out productId); } catch (Exception exc) { productId = 0; } } if (productId > 0) { ViewBag.Title = "Edit Food Item"; objProductDetails = new ClsFoodProduct().GetProductDetail(productId); } else { ViewBag.Title = "Add Food Item"; } GetFoodProductViewBagData(productId, objProductDetails.CategoryId); return(View("FoodItemIU", objProductDetails)); } catch (Exception exc) { throw exc; } }
public JsonResult InsUpdFoodProduct(string jsonProduct, string jsonProductDetails) { GbMProduct objProduct = null; List <KeyValuePair <string, string> > objStatus = null; List <GbMProductAttribute> listProductAttributes = null; string MsgType = "Error"; string Msg = string.Empty; try { string strDateValidation = string.Empty; objProduct = (ClsWebCommon.JsonDeserialize <GbMProduct>(jsonProduct)) as GbMProduct; DataTable dtProductAttributeDetails = GetProductAttributeTable(); if (objProduct.IsActive == "Y") { #region Food Product Detail listProductAttributes = new List <GbMProductAttribute>(); if (jsonProductDetails != "" && jsonProductDetails != null) { listProductAttributes = (ClsWebCommon.JsonDeserialize <List <GbMProductAttribute> >(jsonProductDetails)) as List <GbMProductAttribute>; } #region Get Product Attributes Datatble DataRow dr = null; foreach (GbMProductAttribute attributes in listProductAttributes) { dr = dtProductAttributeDetails.NewRow(); dr["BasePrice"] = attributes.BasePrice; dr["AttributeId1"] = attributes.AttributeId1; dr["AttributeId2"] = attributes.AttributeId2; dr["AttributeId3"] = attributes.AttributeId3; dr["AttributeId4"] = attributes.AttributeId4; dr["AttributeId5"] = attributes.AttributeId5; dr["AttributeId6"] = attributes.AttributeId6; dr["AttributeId7"] = attributes.AttributeId7; dr["AttributeId8"] = attributes.AttributeId8; dr["AttributeId9"] = attributes.AttributeId9; dr["AttributeId10"] = attributes.AttributeId10; dr["IsDefault"] = attributes.IsDefault; dr["IsActive"] = attributes.IsActive; dtProductAttributeDetails.Rows.Add(dr); } #endregion #endregion } #region Ins Upd Food Product if (strDateValidation == string.Empty) { objProduct.CrtBy = GetSession.GetSessionFromContext().UserId; objProduct.CrtIp = FSCSecurity.GetIPAddress(); string[] Out = new ClsFoodProduct().InsUpdFoodProduct(objProduct, dtProductAttributeDetails); if (Out[0] != string.Empty) { switch (Out[0]) { case CodeConstant.Code_InsertSuccess: case CodeConstant.Code_UpdateSuccess: case CodeConstant.Code_DeleteSuccess: MsgType = "Success"; Msg = HttpContext.GetGlobalResourceObject("AdminPanel", "FoodProduct_" + Out[0]).ToString(); break; case CodeConstant.Code_FOOD_ITEM_NAME_DUPLICATE: case CodeConstant.Code_FOOD_ITEM_ATTRIBUTE_MANDATORY: case CodeConstant.Code_FOOD_PRODUCT_ATTRIBUTE_NOT_EXISTS: Msg = HttpContext.GetGlobalResourceObject("AdminPanel", "FoodProduct_" + Out[0]).ToString(); break; default: Msg = HttpContext.GetGlobalResourceObject("AdminPanel", "T1100").ToString(); break; } } else { Msg = HttpContext.GetGlobalResourceObject("AdminPanel", "T1100").ToString(); } } else { Msg = strDateValidation; } #endregion objStatus = new List <KeyValuePair <string, string> >(); objStatus.Add(new KeyValuePair <string, string>("MsgType", MsgType)); objStatus.Add(new KeyValuePair <string, string>("Msg", Msg)); } catch (Exception ex) { objStatus = new List <KeyValuePair <string, string> >(); objStatus.Add(new KeyValuePair <string, string>("MsgType", MsgType)); Msg = HttpContext.GetGlobalResourceObject("AdminPanel", "T1100").ToString(); objStatus.Add(new KeyValuePair <string, string>("Msg", Msg)); throw ex; } return(Json(objStatus)); }
public ActionResult GetFoodProduct(DataTablesRequest pageRequest) { var pageResponse = new ClsFoodProduct().GetFoodProducts(pageRequest); return(Json(pageResponse)); }
private void GetFoodProductViewBagData(Int64 productId, int categoryId) { ClsCommon clsCommon = new ClsCommon(); ViewBag.FoodProductIUCategory = clsCommon.GetCategory(0); ViewBag.FoodProductIUVendor = clsCommon.GetVendors(0); ViewBag.FoodProductIUCurrency = clsCommon.GetCurrency(0); if (productId > 0) { List <GbMProductAttribute> objProductAttributes = new ClsFoodProduct().GetProductAttributes(productId, 0); if (objProductAttributes != null && objProductAttributes.Count > 0) { ViewBag.FoodProductIUAttributes = objProductAttributes; } if (categoryId > 0 && objProductAttributes.Count > 0) { List <GbMAttributes> listGbMAttributes = new List <GbMAttributes>(); List <FSCFoodAttributes> objFoodAttributes = new List <FSCFoodAttributes>(); #region Get Master Attributes listGbMAttributes = new ClsCommon().GetFoodAttributes(0, categoryId, ""); if (listGbMAttributes != null && listGbMAttributes.Count > 0) { var grpAttributes = listGbMAttributes.GroupBy(n => new { n.AttributeGroupCode, n.AttributeGroupDesc }) .Select(g => new { g.Key.AttributeGroupCode, g.Key.AttributeGroupDesc }).ToList(); foreach (var attr in grpAttributes) { FSCFoodAttributes fscAttribute = new FSCFoodAttributes(); fscAttribute.AttributeGroupCode = attr.AttributeGroupCode; fscAttribute.AttributeGroupDesc = attr.AttributeGroupDesc; List <FSCFoodAttributeValues> attributeValuesList = new List <FSCFoodAttributeValues>(); foreach (var att in listGbMAttributes) { if (att.AttributeGroupCode == attr.AttributeGroupCode) { FSCFoodAttributeValues attValue = new FSCFoodAttributeValues(); attValue.AttributeId = att.AttributeId; attValue.AttributeValue = att.AttributeValue; attValue.AttributeGroupCode = att.AttributeGroupCode; attValue.AttributeGroupDesc = att.AttributeGroupDesc; attributeValuesList.Add(attValue); } } fscAttribute.FoodAttributes = attributeValuesList; objFoodAttributes.Add(fscAttribute); } } #endregion if (objFoodAttributes != null && objFoodAttributes.Count > 0) { ViewBag.FoodProductIUAllAttributes = objFoodAttributes; } } } }