public int Save(OutStockItem Item)
        {
            if (Item.OutStockItemID == 0)
            {
                Item.PartNumber    = Item.PartNumber == null ? "" : Item.PartNumber;
                Item.Specification = Item.Specification == null ? "" : Item.Specification;

                Item.OutDate = DateTime.Now;
                _context.OutStockItems.Add(Item);
            }
            else
            {
                OutStockItem _dbEntry = _context.OutStockItems.Find(Item.OutStockItemID);
                if (_dbEntry != null)
                {
                    _dbEntry.WHRequestID    = Item.WHRequestID;
                    _dbEntry.PartName       = Item.PartName;
                    _dbEntry.PartNumber     = Item.PartNumber == null ? "" : Item.PartNumber;
                    _dbEntry.Specification  = Item.Specification == null ? "" : Item.Specification;
                    _dbEntry.Quantity       = Item.Quantity;
                    _dbEntry.OutStockFormID = Item.OutStockFormID;
                    _dbEntry.OutDate        = DateTime.Now;
                    _dbEntry.WHStockID      = Item.WHStockID;
                    _dbEntry.MoldNumber     = Item.MoldNumber;
                }
            }
            _context.SaveChanges();
            return(Item.OutStockItemID);
        }
 public OutStockGridRowModel(OutStockItem Item, OutStockForm Form, string ReceiveUser, string WarehouseUser, string _whRequestNum)
 {
     cell    = new string[9];
     cell[0] = Item.OutStockItemID.ToString();
     cell[1] = _whRequestNum;
     cell[2] = Item.PartName;
     cell[3] = Item.PartNumber;
     cell[4] = Item.Specification;
     cell[5] = Item.Quantity.ToString();
     cell[6] = ReceiveUser;
     cell[7] = Item.OutDate.ToString("yyyy-MM-dd HH:mm");
     cell[8] = WarehouseUser;
 }