コード例 #1
0
 /// <summary>
 /// 添加物品
 /// </summary>
 /// <param name="g"></param>
 /// <returns></returns>
 public static bool AddGoods(Entity.Goods g)
 {
     if (DAL.GoodsDAL.AddGoods(g) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #2
0
 /// <summary>
 /// 更新物品数量物品数量,价格
 /// </summary>
 /// <returns></returns>
 public static bool UpAdd(Entity.Goods g)
 {
     if (DAL.GoodsDAL.UpAdd(g) > 0)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
コード例 #3
0
ファイル: GoodsController.cs プロジェクト: lwsadmin/UnionMall
        public async Task <IActionResult> Add(long?id)
        {
            CreateOrEditDto     s         = new CreateOrEditDto();
            List <Entity.Image> imageList = new List <Entity.Image>();

            Entity.Goods a = new Entity.Goods();
            if (id != null)
            {
                a = await _AppService.GetByIdAsync((long)id);

                imageList = await _imgAppService.GetList((long)id, (int)ImageType.商品图片);

                string imgs = "", config = "";
                for (int i = 0; i < imageList.Count; i++)
                {
                    imgs += $"\'{imageList[i].Url.ToString()}\',";
                    //config += string.Format("{" + "key: 'item{0}',url:'{1}',size:{2}" + "}",
                    //    imageList[i].ToString(), imageList[i].Url, imageList[i].Size);
                    config += "{img:'" + imageList[i].Url + "', key: '" + imageList[i].Id.ToString() + "',url:'/common/deleteimg'},";
                }
                ViewBag.Images = imgs;
                ViewBag.Config = config;
            }
            s.Goods     = a;
            s.ImageList = imageList;

            var cat = _catAppService.GetCategoryDropDownList(AbpSession.TenantId, 0);

            ViewData.Add("Category", new SelectList(cat, "Id", "Title"));
            var b = _brandAppService.GetMultiSelect();

            ViewData.Add("Brand", new SelectList(b, "Id", "Title"));

            var storeDropDown = (await _storeAppService.GetDropDown());

            ViewData.Add("ChainStore", new SelectList(storeDropDown, "Id", "Name"));

            IList <SelectListItem> listItem = new List <SelectListItem>();
            Array values = System.Enum.GetValues(typeof(Entity.GoodsType));

            foreach (int item in values)
            {
                listItem.Add(new SelectListItem
                {
                    Value = item.ToString(),
                    Text  = L(System.Enum.GetName(typeof(Entity.GoodsType), item))
                });
            }
            ViewData.Add("GoodsType", new SelectList(listItem, "Value", "Text"));
            return(View(s));
        }
コード例 #4
0
        /// <summary>
        /// load goods from database, using global one reference of entity.map
        /// </summary>
        /// <returns></returns>
        public List <Entity.Goods> LoadGoods()
        {
            DAL.GoodDA.IGoodDA  goodDA  = new DAL.GoodDA.GoodDAO();
            List <DAL.Goods>    glist   = goodDA.GetGoods();
            List <Entity.Goods> resList = new List <Entity.Goods>();

            foreach (DAL.Goods g in glist)
            {
                g.Batch     = g.Batch.Trim();
                g.Model     = g.Model.Trim();
                g.Name      = g.Name.Trim();
                g.ProductId = g.ProductId.Trim();
                g.BarCode   = g.BarCode.Trim();
                Entity.Goods tmp = new Entity.Goods();
                tmp.DAL_SetGood(g);
                resList.Add(tmp);
            }
            _map.Goods    = resList;
            _DAL_GoodList = glist;
            return(resList);
        }
コード例 #5
0
        public void AddGoods(Model.Goods goods)
        {
            if (goods == null)
            {
                throw new Exception("商品信息无效");
            }
            if (string.IsNullOrEmpty(goods.Name))
            {
                throw new Exception("商品名称无效");
            }
            var entity = new Entity.Goods()
            {
                Name    = goods.Name,
                ClassID = goods.ClassID,
                Disable = false,
                UnitID  = goods.UnitID
            };
            var dbContext = ServiceProvider.GetDbcontext <IPurocumentDbcontext>();

            dbContext.Add(entity);
            dbContext.SaveChanges();
        }
コード例 #6
0
        /// <summary>
        /// 查询总数
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public static int SearchCount(Entity.Goods g)
        {
            string sql = "select GCount from Goods where GID=" + g.gID + "";

            return((int)DBHelper.GetScalar(sql));
        }
コード例 #7
0
 /// <summary>
 /// 物品详情
 /// </summary>
 /// <returns></returns>
 public static System.Data.DataTable LoadGoodOnly(Entity.Goods g)
 {
     return(DAL.GoodsDAL.LoadGoodOnly(g));
 }
コード例 #8
0
 /// <summary>
 /// 查询总数
 /// </summary>
 /// <param name="g"></param>
 /// <returns></returns>
 public static int SearchCount(Entity.Goods g)
 {
     return(EDAL.GoodsDAL.SearchCount(g));
 }
コード例 #9
0
        /// <summary>
        /// 更新物品数量物品数量,价格
        /// </summary>
        /// <returns></returns>
        public static int UpAdd(Entity.Goods g)
        {
            string sql = "update Goods set GCount='" + g.gCount + "',GPrice='" + g.gPrice + "' where GID=" + g.gID + "";

            return(DBHelper.GetLine(sql));
        }
コード例 #10
0
        /// <summary>
        /// 添加物品
        /// </summary>
        /// <param name="g"></param>
        /// <returns></returns>
        public static int AddGoods(Entity.Goods g)
        {
            string sql = "insert into Goods values('" + g.gName + "','" + g.gCount + "','" + g.gPrice + "')";

            return(DBHelper.GetLine(sql));
        }
コード例 #11
0
        /// <summary>
        /// 物品详情
        /// </summary>
        /// <returns></returns>
        public static System.Data.DataTable LoadGoodOnly(Entity.Goods g)
        {
            string sql = "select GName ,GCount ,GPrice  from Goods where GID=" + g.gID + "";

            return(DBHelper.GetDT(sql));
        }