public Result InsertBrandShopInfo(BrandShop shopInfo)
        {
            var result = new Result();

            try
            {
                result.IsSuccess = _ibrand.InsertBrandShopInfo(shopInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Beispiel #2
0
        public bool InsertBrandShopInfo(BrandShop shopInfo)
        {
            try
            {
                _entities.BrandShops.Add(shopInfo);
                _entities.SaveChanges();


                return(true);
            }
            catch (Exception exception)
            {
                throw exception;
            }
        }
        public JsonResult EditBrandShopListById(long id)
        {
            var list = new BrandShop();

            try
            {
                list = _brandManager.EditBrandShopListById(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(Json(list, JsonRequestBehavior.AllowGet));
        }
        public JsonResult UpadteBrandShopInfo(BrandShop shopInfo, string type)
        {
            var result = new Result();

            if (type == "E")
            {
                //shopInfo.EditedBy = Id;
                shopInfo.EditedDate = DateTime.Now;
                result = _brandManager.UpadteBrandShopInfo(shopInfo);
            }
            else
            {
                shopInfo.DeletedDate = DateTime.Now;

                result = _brandManager.UpadteBrandShopInfo(shopInfo);
            }
            return(Json(result));
        }
        public JsonResult InsertBrandShopInfo(BrandShop shopInfo)
        {
            var    userId   = (long)_sessiondictionary[1].Id;
            var    userName = (long)_sessiondictionary[2].Id;
            Result result;

            try
            {
                shopInfo.AddedBy   = userId;
                shopInfo.AddedDate = DateTime.Now;
                shopInfo.Active    = true;
                result             = _brandManager.InsertBrandShopInfo(shopInfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(result));
        }
Beispiel #6
0
        public bool UpadteBrandShopInfo(BrandShop shopInfo)
        {
            BrandShop shopInfoes = _entities.BrandShops.FirstOrDefault(x => x.Id == shopInfo.Id);

            if (shopInfo != null)
            {
                if (shopInfo.ShopName != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.ShopName = shopInfo.ShopName;
                    }
                }
                if (shopInfo.ShopCategory != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.ShopCategory = shopInfo.ShopCategory;
                    }
                }
                if (shopInfo.Address != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.Address = shopInfo.Address;
                    }
                }
                if (shopInfo.Code != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.Code = shopInfo.Code;
                    }
                }
                if (shopInfo.OwnerName != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.OwnerName = shopInfo.OwnerName;
                    }
                }
                if (shopInfo.Phone != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.Phone = shopInfo.Phone;
                    }
                }
                if (shopInfo.Active != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.Active = shopInfo.Active;
                    }
                }
                if (shopInfo.EditedDate != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.EditedDate = shopInfo.EditedDate;
                    }
                }
                if (shopInfo.DeletedDate != null)
                {
                    if (shopInfoes != null)
                    {
                        shopInfoes.DeletedDate = shopInfo.DeletedDate;
                    }
                }
                _entities.Entry(shopInfoes).State = EntityState.Modified;
                _entities.SaveChanges();
            }

            else
            {
                return(false);
            }

            return(true);
        }