예제 #1
0
        public ActionResult ViewStoreProducts(int nBUID, int nUserID)
        {
            GlobalSession.SessionIsAlive(Session, Response);

            _oStores = _oStoreService.Gets(nBUID, (int)Session[GlobalSession.UserID]);

            _oStoreProducts = _oStoreProductService.Gets(nBUID, (int)Session[GlobalSession.UserID]);
            ViewBag.BUID    = nBUID;
            return(View(_oStores));
        }
        public JsonResult Delete(Store oStore)
        {
            _oStore = new Store();
            _oStore = oStore;
            StoreService oStoreService = new StoreService();

            try
            {
                List <StoreProduct> oStoreProducts       = new List <StoreProduct>();
                StoreProductService oStoreProductService = new StoreProductService();
                oStoreProducts = oStoreProductService.Gets("SELECT * FROM View_StoreProduct WHERE StoreID = " + _oStore.StoreID, (int)Session[GlobalSession.UserID]);
                if (oStoreProducts.Count == 0)
                {
                    _oStore.ErrorMessage = oStoreService.Delete(oStore, (int)Session[GlobalSession.UserID]);
                }
                else
                {
                    _oStore.ErrorMessage = "You Can Not Delete This Store. This Store Is Not Empty";
                }
            }
            catch (Exception ex)
            {
                _oStore = new Store();
                _oStore.ErrorMessage = ex.Message;
            }
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            string sjson = serializer.Serialize(_oStore);

            return(Json(sjson, JsonRequestBehavior.AllowGet));
        }