public JsonResult AddFoodOrder(string[] ids, string[] leftValue, string[] overValue)
        {
            UserContext cont = (UserContext)Session["UserContext"];

            FoodOrderModel fom = new FoodOrderModel();

            string error = "";
            string msg = "";

            try
            {

                if (!ValidationUtility.IsNull(ids) && ids.Length > 0 && !ValidationUtility.IsNull(cont))
                {
                    FoodOrderDTO foodOrderDTO = new FoodOrderDTO();

                    foodOrderDTO.StoreId = fom.GetStoredId(cont.Id);

                    foodOrderDTO.FoodOrderDate = DateTime.Now;
                    foodOrderDTO.CreatedDateTime = DateTime.Now;
                    foodOrderDTO.LastUpdateDateTime = DateTime.Now;

                    fom.AddFoodOrder(foodOrderDTO);

                    int foodId = fom.GetFoodOrderId(foodOrderDTO);

                    for (int i = 0; i < ids.Length; i++)
                    {
                        int itemId = ValidationUtility.ToInteger(ids[i]);
                        int left = ValidationUtility.ToInteger(leftValue[i]);
                        int over = ValidationUtility.ToInteger(overValue[i]);

                        OrderDTO dto = new OrderDTO();
                        dto.ItemId = itemId;
                        dto.NumberRemaining = left;
                        dto.NumberOver = over;
                        dto.FoodOrderId = foodId;
                        dto.CreatedDateTime = DateTime.Now;
                        dto.LastUpdateDateTime = DateTime.Now;
                        fom.AddOrder(dto);

                    }

                    error = "Success";
                    msg = "Food Order Added Successfully";
                }
            }
            catch (Exception ex)
            {
                error = "Error";
                msg = "Food Order is not Added Please Try Again";
                log.Error(" Exception in AddFoodItem Method ", ex);
            }

            ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg };
            return Json(resDTO, JsonRequestBehavior.AllowGet);
        }
        public JsonResult AddFoodItem(string item)
        {
            string error = "";
            string msg = "";

            try
            {
                FoodOrderModel foodOredeModel = new FoodOrderModel();
                foodOredeModel.AddFoodOrderItem(item);
                error = "Success";
                msg = "Food Item is Added Successfully";

            }
            catch (Exception ex)
            {
                error = "Error";
                msg = "Food Item is not Added";
                log.Error(" Exception in AddFoodItem Method ", ex);

            }

            ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg };
            return Json(resDTO, JsonRequestBehavior.AllowGet);
        }
        public JsonResult GetFoodOrderList(string selectedDate, string sId)
        {
            ArrayList foodOrderList = new ArrayList();
            FoodOrderModel foodOredeModel = new FoodOrderModel();

            int storeId = ValidationUtility.ToInteger(sId);

            DateTime formatedDate;

            if (!ValidationUtility.IsNull(selectedDate))
            {
                formatedDate = ValidationUtility.ToDate(selectedDate);

            }
            else
            {
                formatedDate = DateTime.Now;
            }

            if (storeId == 0)
            {

                UserContext cont = (UserContext)Session["UserContext"];

                if (!ValidationUtility.IsNull(cont) && ValidationUtility.IsEqual(cont.Role, "Corporate"))
                {
                    //ArrayList storeList = ValidationUtility.GetCorporateUserAssignStore(cont.Id, false);
                    //foodOrderList.Add(storeList);
                    //foodOrderList.Add(foodOredeModel.GetFoodOrderWeekInfo(formatedDate));

                    //ArrayList corporateFoodOrderList = new ArrayList();
                    //foreach (StoreDTO storeDTO in storeList)
                    //{
                    //    //  corporateFoodOrderList = foodOredeModel.GetOrdersList(formatedDate, storeDTO.Id);
                    //    corporateFoodOrderList.Add(foodOredeModel.GetFoodOrdersListByCorporate(formatedDate, cont.Id));
                    //}

                    //foodOrderList.Add(corporateFoodOrderList);

                    foodOrderList.Add(ValidationUtility.GetCorporateUserAssignStore(cont.Id, false));
                    foodOrderList.Add(foodOredeModel.GetFoodOrderWeekInfo(formatedDate));
                    foodOrderList.Add(foodOredeModel.GetFoodOrdersListByCorporate(formatedDate, cont.Id));
                }
                else
                {
                    foodOrderList.Add(foodOredeModel.GetStoreList());
                    foodOrderList.Add(foodOredeModel.GetFoodOrderWeekInfo(formatedDate));
                    foodOrderList.Add(foodOredeModel.GetOrdersList(formatedDate, storeId));
                }

            }
            else
            {
                foodOrderList.Add(foodOredeModel.GetStoreList());
                foodOrderList.Add(foodOredeModel.GetFoodOrderWeekInfo(formatedDate));
                foodOrderList.Add(foodOredeModel.GetOrdersList(formatedDate, storeId));
            }

            return Json(foodOrderList, JsonRequestBehavior.AllowGet);
        }
 public JsonResult GetFoodNameList()
 {
     FoodOrderModel foodOredeModel = new FoodOrderModel();
     ArrayList foodNameList = foodOredeModel.GetFoodItemList();
     return Json(foodNameList, JsonRequestBehavior.AllowGet);
 }
 public JsonResult GetFoodInfo(string fId)
 {
     FoodOrderModel fom = new FoodOrderModel();
     int id = ValidationUtility.ToInteger(fId);
     ArrayList list = fom.GetFoodOrderInfo(id);
     return Json(list, JsonRequestBehavior.AllowGet);
 }
        public JsonResult DeletFoodItem(string foodItemId)
        {
            string error = "";
            string msg = "";

            try
            {
                FoodOrderModel foodOrderModel = new FoodOrderModel();
                int itemId = ValidationUtility.ToInteger(foodItemId);
                foodOrderModel.DeleteFoodItem(itemId);
                error = "Success";
                msg = "Food Item is Deleted Successfully";
            }
            catch (Exception ex)
            {
                error = "Error";
                msg = "Food Item is not Deleted";
                log.Error(" Exception in DeletFoodItem Method ", ex);

            }

            ResponseDTO resDTO = new ResponseDTO { Error = error, Message = msg };
            return Json(resDTO, JsonRequestBehavior.AllowGet);
        }