示例#1
0
        public Status DeleteProduct(TProductNumInfo product)
        {
            this._logger.LogWarning("The server excute DeleteProduct  --" + DateTime.Now.ToString());
            EFHelper <TProductNumInfo> eFHelper = new EFHelper <TProductNumInfo>();
            int result = eFHelper.Delete(product);

            return(result > 0 ? new Status(true) : new Status(false));
        }
示例#2
0
        public Status AddProduct(string productnumber, string productinfo, string productionbase, string warehouse, List <IFormFile> files)
        {
            this._logger.LogWarning("The server excute AddProduct  --" + DateTime.Now.ToString());
            bool            flag;
            List <string>   filenames      = new List <string>();
            string          resultfilename = string.Empty;
            TProductNumInfo product        = new TProductNumInfo()
            {
                ProductNumber  = productnumber,
                ProductionBase = productionbase,
                ProductInfo    = productinfo,
                WareHouse      = warehouse
            };

            if (product.ProductInfo != "")
            {
                flag = UpLoadFile.FileSave(files, product.ProductInfo, out filenames);
            }
            else
            {
                flag = UpLoadFile.FileSave(files, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), out filenames);
            }
            if (flag)
            {
                filenames.Sort();
                resultfilename = string.Join("", filenames.ToArray());
                product.Image  = resultfilename;
                EFHelper <TProductNumInfo> eFHelper = new EFHelper <TProductNumInfo>();
                int result = eFHelper.Add(product);
                return(result > 0 ? new Status(true) : new Status(false));
            }
            else
            {
                return(new Status(false));
            }
        }