Exemplo n.º 1
0
        private PackList ScanPacks(PackList original)
        {
            lock (_packList)
            {
                PackList o, n;
                do
                {
                    o = _packList.get();
                    if (o != original)
                    {
                        // Another thread did the scan for us, while we
                        // were blocked on the monitor above.
                        //
                        return(o);
                    }
                    n = ScanPacksImpl(o);
                    if (n == o)
                    {
                        return(n);
                    }
                } while (!_packList.compareAndSet(o, n));

                return(n);
            }
        }
Exemplo n.º 2
0
        private Dictionary <ulong, string> BuildFileMap(PackList packFiles, bool useCache)
        {
            if (useCache && _packFileLocator.TryGetValue(packFiles, out var files))
            {
                return(files);
            }

            files = new Dictionary <ulong, string>();

            foreach (var packFile in packFiles.Packs)
            {
                var pack = LoadPack(packFile, useCache);
                for (int i = 0; i < pack.FileEntries.Count; i++)
                {
                    var hash = pack.FileEntries[i].PathHash;
                    files[hash] = packFile;
                }
            }

            if (useCache)
            {
                _packFileLocator.TryAdd(packFiles, files);
            }
            return(files);
        }
Exemplo n.º 3
0
        public override void OpenObjectInAllPacksImplementation(ICollection <PackedObjectLoader> @out, WindowCursor windowCursor, AnyObjectId objectId)
        {
            PackList pList = _packList.get();

            while (true)
            {
SEARCH:
                foreach (PackFile p in pList.packs)
                {
                    try
                    {
                        PackedObjectLoader ldr = p.Get(windowCursor, objectId);
                        if (ldr != null)
                        {
                            @out.Add(ldr);
                        }
                    }
                    catch (PackMismatchException)
                    {
                        // Pack was modified; refresh the entire pack list.
                        //
                        pList = ScanPacks(pList);
                        goto SEARCH;
                    }
                    catch (IOException)
                    {
                        // Assume the pack is corrupted.
                        //
                        RemovePack(p);
                    }
                }

                break;
            }
        }
Exemplo n.º 4
0
 public PackService()
 {
     if (_packList == null)
     {
         _packList = InitPacks();
     }
 }
        private PackList UpdateDeliveryNotesWithProductDescriptions(TradevineGateway gateway, PackList input)
        {
            var originalDeliveryNotes = input.DeliveryNotes;

            foreach (var packListItem in input.PackListItems)
            {
                string productDescription = gateway.Products.GetProductById(packListItem.ProductID.Value).Description;
                string productCode = gateway.Products.GetProductById(packListItem.ProductID.Value).Code;
                if (productCode != "SHIP")
                {
                    productDescription = productDescription.Substring(0, Math.Min(1000, productDescription.Length));

                    if (string.IsNullOrEmpty(input.DeliveryNotes) || !input.DeliveryNotes.Contains(productDescription))
                    {
                        input.DeliveryNotes = (input.DeliveryNotes ?? string.Empty) + productDescription;
                    }
                }
            }

            if (input.DeliveryNotes == originalDeliveryNotes)
                return input;

            Console.WriteLine("Updating delivery notes for {0}", input.PackListNumber);
            var output = gateway.Sales.UpdatePackList(input);

            return output;
        }
Exemplo n.º 6
0
        public GameEngine(MyGame game)
        {
            screenLog = new ScreenLog();
            _hotkeys = new List<HotKey>();
            _hotkeys.Add(new HotKey(new Keys[] { Keys.O }, SwichDebugRender));
            _hotkeys.Add(new HotKey(new Keys[] { Keys.P }, SwichBehaviourModel));

            KeyboardManager.Manager.AddKeyboardUser(this);

            game._engine = this;
            packs = new PackList();
             //   newPacks = new ContentNew.PackList();
            Instance = this;
            lightDir.Normalize();

            gameScene = new EngineScene();
            Scene = gameScene.Scene;

            //разме рэкрана
            MyGame.DeviceManager.PreferredBackBufferWidth = (int)(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width *0.8 );
            MyGame.DeviceManager.PreferredBackBufferHeight = (int) (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height*0.8);
            GameConfiguration.ScreenResolution = new Vector2(MyGame.DeviceManager.PreferredBackBufferWidth, MyGame.DeviceManager.PreferredBackBufferHeight);

            MyGame.DeviceManager.IsFullScreen = false;

            _cashe = new ObjectCashe();
        }
Exemplo n.º 7
0
        private static Dictionary <string, PackFile> ReuseMap(PackList old)
        {
            var forReuse = new Dictionary <string, PackFile>();

            foreach (PackFile p in old.packs)
            {
                if (p.IsInvalid)
                {
                    // The pack instance is corrupted, and cannot be safely used
                    // again. Do not include it in our reuse map.
                    //
                    p.Close();
                    continue;
                }

                PackFile prior = forReuse[p.File.Name] = p;
                if (prior != null)
                {
                    // This should never occur. It should be impossible for us
                    // to have two pack files with the same name, as all of them
                    // came out of the same directory. If it does, we promised to
                    // close any PackFiles we did not reuse, so close the one we
                    // just evicted out of the reuse map.
                    //
                    prior.Close();
                }
            }

            return(forReuse);
        }
Exemplo n.º 8
0
        public async Task <ActionResult <PackList> > PostPackList(PackList list)
        {
            _context.PackLists.Add(list);
            await _context.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetPackList), new { id = list.Id }, list));
        }
Exemplo n.º 9
0
 private void SetupNewPackList()
 {
     packList = new PackList();
     foreach (Pack.PackID packId in Enum.GetValues(typeof(Pack.PackID)))
     {
         packList.Add(new Pack(packId));
     }
 }
        private PackList UpdatePacklistToAwaitingPack(TradevineGateway gateway, PackList input)
        {
            input.Status = Constants.CVs.PackListStatus.Values.AwaitingPack;
            var output = gateway.Sales.UpdatePackList(input);

            Console.WriteLine("Packlist {0} now has status {1}", output.PackListNumber, output.Status);

            return output;
        }
Exemplo n.º 11
0
        public override bool tryAgain1()
        {
            PackList old = _packList.get();

            _packDirectory.Refresh();
            if (old.tryAgain(_packDirectory.LastWriteTime.Ticks))
            {
                return(old != ScanPacks(old));
            }

            return(false);
        }
Exemplo n.º 12
0
        public override bool tryAgain1()
        {
            PackList old = _packList.get();

            _packDirectory.Refresh();
            if (old.tryAgain(_packDirectory.lastModified()))
            {
                return(old != ScanPacks(old));
            }

            return(false);
        }
Exemplo n.º 13
0
 private void ComparePackListFile(PackList packListFromFile)
 {
     for (int i = 0; i < packList.GetList().Count; i++)
     {
         foreach (Pack packFromFile in packListFromFile.GetList())
         {
             if (packList.GetList()[i].packId == packFromFile.packId)
             {
                 packList.GetList()[i] = packFromFile;
             }
         }
     }
 }
Exemplo n.º 14
0
        private void InsertPack(PackFile pf)
        {
            PackList o, n;

            do
            {
                o = _packList.get();
                PackFile[] oldList = o.packs;
                var        newList = new PackFile[1 + oldList.Length];
                newList[0] = pf;
                Array.Copy(oldList, 0, newList, 1, oldList.Length);
                n = new PackList(o.lastRead, o.lastModified, newList);
            } while (!_packList.compareAndSet(o, n));
        }
Exemplo n.º 15
0
    private void LoadLevelDataAndroid()
    {
        WWW file = new WWW(LEVEL_DATA_FILENAME);

        while (!file.isDone)
        {
            ;
        }
        MemoryStream    memStream = new MemoryStream(file.bytes);
        BinaryFormatter bf        = new BinaryFormatter();

        packList = bf.Deserialize(memStream) as PackList;
        memStream.Close();
    }
Exemplo n.º 16
0
        public override void closeSelf()
        {
            PackList packs = _packList.get();

            _packList.set(NoPacks);
            foreach (PackFile p in packs.packs)
            {
                p.Close();
            }

#if DEBUG
            GC.SuppressFinalize(this); // Disarm lock-release checker
#endif
        }
Exemplo n.º 17
0
        public ActionResult Create(string item, bool isPurchased)
        {
            PackList newPackList = new PackList(item, isPurchased);

            if (isPurchased == false)
            {
                newPackList.IsPurchased = false;
            }
            else
            {
                newPackList.IsPurchased = true;
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 18
0
        public List <Card> Draw(int aAmount)
        {
            if (aAmount > PackList.Count)
            {
                throw new Exception("Not enough cards remaining in the deck.");
            }
            List <Card> returnList = new List <Card>();

            for (int i = 0; i < aAmount; i++)
            {
                returnList.Add(PackList[0]);
                PackList.RemoveAt(0);
            }
            return(returnList);
        }
Exemplo n.º 19
0
        public ActionResult Index()
        {
            PackList PackList = new PackList();

            var dbPacklist = ShopManager.GetAllPacks();

            foreach (var p in dbPacklist)
            {
                Pack pack = new Pack();
                pack.IdPack       = p.idpack;
                pack.Packname     = p.packname;
                pack.Packprice    = (double)p.packprice;
                pack.Cardquantity = (int)p.cardquantity;
                pack.Goldquantity = p.goldquantity;
                pack.Url          = pack.Url + p.picturename;
                PackList.AllPack.Add(pack);
            }

            var dbCardPacklist = ShopManager.GetCardPacks();

            foreach (var p in dbCardPacklist)
            {
                Pack pack = new Pack();
                pack.IdPack       = p.idpack;
                pack.Packname     = p.packname;
                pack.Packprice    = (double)p.packprice;
                pack.Cardquantity = (int)p.cardquantity;
                pack.Goldquantity = p.goldquantity;
                pack.Url          = pack.Url + p.picturename;
                PackList.CardPack.Add(pack);
            }

            var dbGoldPacklist = ShopManager.GetGoldPacks();

            foreach (var p in dbGoldPacklist)
            {
                Pack pack = new Pack();
                pack.IdPack       = p.idpack;
                pack.Packname     = p.packname;
                pack.Packprice    = (double)p.packprice;
                pack.Cardquantity = (int)p.cardquantity;
                pack.Goldquantity = p.goldquantity;
                pack.Url          = pack.Url + p.picturename;
                PackList.GoldPack.Add(pack);
            }

            return(View(PackList));
        }
Exemplo n.º 20
0
 protected virtual void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             foreach (var pack in PackList)
             {
                 if (pack.Key != PackageType.SystemPack)
                 {
                     pack.Value.Dispose();
                 }
             }
             PackList.Clear();
         }
         SystemPack.Dispose();
         disposedValue = true;
     }
 }
Exemplo n.º 21
0
        private void RemovePack(PackFile deadPack)
        {
            PackList o, n;

            do
            {
                o = _packList.get();
                PackFile[] oldList = o.packs;
                int        j       = indexOf(oldList, deadPack);
                if (j < 0)
                {
                    break;
                }
                var newList = new PackFile[oldList.Length - 1];
                Array.Copy(oldList, 0, newList, 0, j);
                Array.Copy(oldList, j + 1, newList, j, newList.Length - j);
                n = new PackList(o.lastRead, o.lastModified, newList);
            } while (!_packList.compareAndSet(o, n));
            deadPack.Close();
        }
Exemplo n.º 22
0
        public ListController(PackContext context)
        {
            _context = context;

            if (_context.PackLists.Count() == 0)
            {
                // Create a new PackList if collection is empty,
                // which means you can't delete all PackList.
                PackList packList1 = new PackList {
                    Description = "List1"
                };
                packList1.PackItems.Add(new PackItem {
                    Description = "PackItem1ListItem1", Weight = 25, Volume = 30
                });
                packList1.PackItems.Add(new PackItem {
                    Description = "PackItem1ListItem2", Weight = 5, Volume = 10
                });

                _context.PackLists.Add(packList1);

                _context.SaveChanges();
            }
        }
Exemplo n.º 23
0
        public override ObjectLoader openObject1(WindowCursor curs, AnyObjectId objectId)
        {
            PackList pList = _packList.get();

            while (true)
            {
SEARCH:
                foreach (PackFile p in pList.packs)
                {
                    try
                    {
                        PackedObjectLoader ldr = p.Get(curs, objectId);
                        if (ldr != null)
                        {
                            ldr.Materialize(curs);
                            return(ldr);
                        }
                    }
                    catch (PackMismatchException)
                    {
                        // Pack was modified; refresh the entire pack list.
                        //
                        pList = ScanPacks(pList);
                        goto SEARCH;
                    }
                    catch (IOException)
                    {
                        // Assume the pack is corrupted.
                        //
                        RemovePack(p);
                    }
                }

                return(null);
            }
        }
Exemplo n.º 24
0
        private static StreamReader Open(FileSystemInfo f)
        {
            return new StreamReader(new FileStream(f.FullName, System.IO.FileMode.Open));
        }

        private static Dictionary<string, PackFile> ReuseMap(PackList old)
        {
            var forReuse = new Dictionary<string, PackFile>();
            foreach (PackFile p in old.packs)
            {
                if (p.IsInvalid)
                {
                    // The pack instance is corrupted, and cannot be safely used
                    // again. Do not include it in our reuse map.
                    //
                    p.Dispose();
                    continue;
                }

                PackFile prior = forReuse[p.File.Name] = p;
                if (prior != null)
                {
                    // This should never occur. It should be impossible for us
                    // to have two pack files with the same name, as all of them
                    // came out of the same directory. If it does, we promised to
                    // close any PackFiles we did not reuse, so close the one we
                    // just evicted out of the reuse map.
                    //
Exemplo n.º 25
0
        public void pkUpDb(PackList pk, string guid)
        {
            Packinglistdal pkdll = new Packinglistdal();

            pkdll.pkUpDb(pk, guid);
        }
Exemplo n.º 26
0
        public void pkUpDb(PackList pk)
        {
            Packinglistdal pkdll = new Packinglistdal();

            pkdll.pkUpDb(pk);
        }
 public FormNewElement(PackList _packs, TreeView _tv)
 {
     InitializeComponent();
     packs = _packs;
     tv = _tv;
 }
Exemplo n.º 28
0
 public void AddPackList(PackList packList)
 {
     PackLists.Add(packList);
 }
Exemplo n.º 29
0
        private PackList ScanPacksImpl(PackList old)
        {
            Dictionary <string, PackFile> forReuse = ReuseMap(old);
            long             lastRead     = DateTime.Now.Ticks;
            long             lastModified = _packDirectory.LastWriteTime.Ticks;
            HashSet <String> names        = listPackDirectory();
            var  list     = new List <PackFile>(names.Count >> 2);
            bool foundNew = false;

            foreach (string indexName in names)
            {
                // Must match "pack-[0-9a-f]{40}.idx" to be an index.
                //
                if (indexName.Length != 49 || !indexName.EndsWith(".idx"))
                {
                    continue;
                }
                string @base    = indexName.Slice(0, indexName.Length - 4);
                string packName = IndexPack.GetPackFileName(@base);

                if (!names.Contains(packName))
                {
                    // Sometimes C Git's HTTP fetch transport leaves a
                    // .idx file behind and does not download the .pack.
                    // We have to skip over such useless indexes.
                    //
                    continue;
                }
                PackFile oldPack;
                forReuse.TryGetValue(packName, out oldPack);
                forReuse.Remove(packName);
                if (oldPack != null)
                {
                    list.Add(oldPack);
                    continue;
                }

                var packFile = new FileInfo(_packDirectory.FullName + "/" + packName);

                var idxFile = new FileInfo(_packDirectory + "/" + indexName);
                list.Add(new PackFile(idxFile, packFile));
                foundNew = true;
            }

            // If we did not discover any new files, the modification time was not
            // changed, and we did not remove any files, then the set of files is
            // the same as the set we were given. Instead of building a new object
            // return the same collection.
            //
            if (!foundNew && lastModified == old.lastModified && forReuse.isEmpty())
            {
                return(old.updateLastRead(lastRead));
            }

            foreach (PackFile p in forReuse.Values)
            {
                p.Close();
            }

            if (list.Count == 0)
            {
                return(new PackList(lastRead, lastModified, NoPacks.packs));
            }

            PackFile[] r = list.ToArray();
            Array.Sort(r, PackFile.PackFileSortComparison);
            return(new PackList(lastRead, lastModified, r));
        }
Exemplo n.º 30
0
 private void Awake()
 {
     packList    = GameObject.FindObjectOfType <PackList>();
     dataManager = GameObject.FindObjectOfType <DataManager>();
 }
Exemplo n.º 31
0
 public IEnumerable <PackList> GetPackList(PackList param = null)
 {
     return(GetDictionary <PackList>(nameof(PackList), param));
 }
Exemplo n.º 32
0
        public void pkUpDb(PackList pk)
        {
            String sql = @"INSERT INTO  T_PackList
           (guid
           ,CustomName
           ,GoodsTypeEnName
           ,CustomStyleName
           ,CustomStyleCode
           ,SizeName
           ,TotalCount
           ,CutNo
           ,ManufactureOrder
           ,CustomPO
           ,ColorGroupName
           ,BoxSize
           ,BoxNoTotal
           ,PerCount
           ,perCountTotal
           ,NW
           ,TNW
           ,GW
           ,TGW
           ,BoxVolume
           ,MT
           ,BOXTONO
           ,BOXNO
           ,Totsumcount
           ,Boxsumcount
           ,OrderDate)
  VALUES
            (@guid
           ,@CustomName
           ,@GoodsTypeEnName
           ,@CustomStyleName
           ,@CustomStyleCode
           ,@SizeName
           ,@TotalCount
           ,@CutNo
           ,@ManufactureOrder
           ,@CustomPO
           ,@ColorGroupName
           ,@BoxSize
           ,@BoxNoTotal
           ,@PerCount
           ,@perCountTotal
           ,@NW
           ,@TNW
           ,@GW
           ,@TGW
           ,@BoxVolume
           ,@MT
           ,@BOXTONO
           ,@BOXNO
           ,@Totsumcount
           ,@Boxsumcount
           ,@OrderDate);";

            SqlParameter[] sps =
            {
                new SqlParameter("@Guid", SqlDbType.UniqueIdentifier)
                {
                    Value = pk.guid
                },
                new SqlParameter("@CustomName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomName)
                },
                new SqlParameter("@GoodsTypeEnName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.GoodsTypeEnName)
                },
                new SqlParameter("@CustomStyleName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomStyleName)
                },
                new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomStyleCode)
                },
                new SqlParameter("@SizeName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.SizeName)
                },
                new SqlParameter("@TotalCount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.TotalCount)
                },
                new SqlParameter("@CutNo", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CutNo)
                },
                new SqlParameter("@ManufactureOrder", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.ManufactureOrder)
                },
                new SqlParameter("@CustomPO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomPO)
                },
                new SqlParameter("@ColorGroupName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.ColorGroupName)
                },
                new SqlParameter("@BoxSize", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxSize)
                },
                new SqlParameter("@BoxNoTotal", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxNoTotal)
                },
                new SqlParameter("@PerCount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.PerCount)
                },
                new SqlParameter("@perCountTotal", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.perCountTotal)
                },
                new SqlParameter("@NW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.NW)
                },
                new SqlParameter("@TNW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.TNW)
                },
                new SqlParameter("@GW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.GW)
                },
                new SqlParameter("@TGW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.TGW)
                },
                new SqlParameter("@BoxVolume", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxVolume)
                },
                new SqlParameter("@MT", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.MT)
                },
                new SqlParameter("@BOXTONO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BOXTONO)
                },
                new SqlParameter("@BOXNO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BOXNO)
                },
                new SqlParameter("@Totsumcount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.Totsumcount)
                },
                new SqlParameter("@Boxsumcount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.Boxsumcount)
                },
                new SqlParameter("@OrderDate", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.OrderDate)
                }
            };
            SqlHelper.ExecuteNonQuery(sql, sps);
        }
Exemplo n.º 33
0
        public void pkUpDb(PackList pk, string guid)
        {
            String sql = @" UPDATE T_PackList   SET
            CustonName=@CustonName
           ,GoodsTypeEnName=@GoodsTypeEnName
           ,CustoStyleName=@CustoStyleName
           ,CustomStyleCode=CustomStyleCode
           ,SizeName=@SizeName
           ,TotalCount=@TotalCount
           ,CutNo=@CutNo
           ,ManufactureOrder=@ManufactureOrder
           ,CustomPO=@CustomPO
           ,ColorGroupName=@ColorGroupName
           ,BoxSize=@BoxSize
           ,BoxNoTotal=@BoxNoTotal
           ,PerCount=@PerCount
           ,perCountTotal=@perCountTotal
           ,NW=@NW
           ,TNW=@TNW
           ,GW=@GW
           ,TGW=@TGW
           ,BoxVolume=@BoxVolume
           ,MT=@MT
           ,BOXTONO=@BOXTONO
           ,BOXNO=@BOXNO
           ,Totsumcount=@Totsumcount
           ,Boxsumcount=@Boxsumcount
            ,OrderDate=@OrderDate WHERE  guid= '" + guid + "'";

            SqlParameter[] sps =
            {
                //   new SqlParameter("@Guid",SqlDbType.UniqueIdentifier) {Value= pk.guid },
                new SqlParameter("@CustomName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomName)
                },
                new SqlParameter("@GoodsTypeEnName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.GoodsTypeEnName)
                },
                new SqlParameter("@CustomStyleName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomStyleName)
                },
                new SqlParameter("@CustomStyleCode", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomStyleCode)
                },
                new SqlParameter("@SizeName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.SizeName)
                },
                new SqlParameter("@TotalCount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.TotalCount)
                },
                new SqlParameter("@CutNo", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CutNo)
                },
                new SqlParameter("@ManufactureOrder", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.ManufactureOrder)
                },
                new SqlParameter("@CustomPO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.CustomPO)
                },
                new SqlParameter("@ColorGroupName", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.ColorGroupName)
                },
                new SqlParameter("@BoxSize", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxSize)
                },
                new SqlParameter("@BoxNoTotal", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxNoTotal)
                },
                new SqlParameter("@PerCount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.PerCount)
                },
                new SqlParameter("@perCountTotal", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.perCountTotal)
                },
                new SqlParameter("@NW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.NW)
                },
                new SqlParameter("@TNW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.TNW)
                },
                new SqlParameter("@GW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.GW)
                },
                new SqlParameter("@TGW", SqlDbType.Float)
                {
                    Value = SqlHelper.ToDbValue(pk.TGW)
                },
                new SqlParameter("@BoxVolume", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BoxVolume)
                },
                new SqlParameter("@MT", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.MT)
                },
                new SqlParameter("@BOXTONO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BOXTONO)
                },
                new SqlParameter("@BOXNO", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.BOXNO)
                },
                new SqlParameter("@Totsumcount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.Totsumcount)
                },
                new SqlParameter("@Boxsumcount", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.Boxsumcount)
                },
                new SqlParameter("@OrderDate", SqlDbType.NVarChar)
                {
                    Value = SqlHelper.ToDbValue(pk.OrderDate)
                }
            };
            SqlHelper.ExecuteNonQuery(sql, sps);
        }
Exemplo n.º 34
0
        {
            string d = objectName.Slice(0, 2);
            string f = objectName.Substring(2);
            return new FileInfo(_objects.FullName + "/" + d + "/" + f);
        }

        private void InsertPack(PackFile pf)
        {
            PackList o, n;
            do
            {
                o = _packList.get();
                PackFile[] oldList = o.packs;
Exemplo n.º 35
0
        public void AddItemToPackList(PackList packList, PackItem item)
        {
            var list = PackLists.Where(p => p.PackListId == packList.PackListId).FirstOrDefault();

            list.PackItems.Add(item);
        }
Exemplo n.º 36
0
                Repository db = RepositoryCache.open(RepositoryCache.FileKey.exact(parent));
                return new AlternateRepositoryDatabase(db);
            }
            return new ObjectDirectory(objdir, null);
        }

        private void RemovePack(PackFile deadPack)
        {
            PackList o, n;
            do
            {
                o = _packList.get();
                PackFile[] oldList = o.packs;
                int j = indexOf(oldList, deadPack);
                if (j < 0)
                    break;
                var newList = new PackFile[oldList.Length - 1];
Exemplo n.º 37
0
                Array.Copy(oldList, j + 1, newList, j, newList.Length - j);
                n = new PackList(o.lastRead, o.lastModified, newList);
            } while (!_packList.compareAndSet(o, n));
            deadPack.Dispose();
        }

        private PackList ScanPacks(PackList original)
        {
            lock (_packList)
            {
                PackList o, n;
                do
                {
                    o = _packList.get();
                    if (o != original)
                    {
                        // Another thread did the scan for us, while we
                        // were blocked on the monitor above.
                        //
                        return o;
                    }
                    n = ScanPacksImpl(o);
                    if (n == o)
Exemplo n.º 38
0
                } while (!_packList.compareAndSet(o, n));

                return n;
            }
        }

        private PackList ScanPacksImpl(PackList old)
        {
            Dictionary<string, PackFile> forReuse = ReuseMap(old);
            long lastRead = DateTime.Now.Ticks;
            long lastModified = _packDirectory.LastWriteTime.Ticks;
            HashSet<String> names = listPackDirectory();
            var list = new List<PackFile>(names.Count >> 2);
            bool foundNew = false;
            foreach (string indexName in names)
            {
                // Must match "pack-[0-9a-f]{40}.idx" to be an index.
                //
                if (indexName.Length != 49 || !indexName.EndsWith(".idx"))
                    continue;
                string @base = indexName.Slice(0, indexName.Length - 4);
                string packName = IndexPack.GetPackFileName(@base);

                if (!names.Contains(packName))
                {
                    // Sometimes C Git's HTTP fetch transport leaves a
                    // .idx file behind and does not download the .pack.
                    // We have to skip over such useless indexes.
                    //
                    continue;
                }
                PackFile oldPack;
                forReuse.TryGetValue(packName, out oldPack);
                forReuse.Remove(packName);
                if (oldPack != null)
                {
                    list.Add(oldPack);
                    continue;
                }

                var packFile = new FileInfo(_packDirectory.FullName + "/" + packName);

                var idxFile = new FileInfo(_packDirectory + "/" + indexName);
                list.Add(new PackFile(idxFile, packFile));
                foundNew = true;
            }

            // If we did not discover any new files, the modification time was not
            // changed, and we did not remove any files, then the set of files is
            // the same as the set we were given. Instead of building a new object
            // return the same collection.
            //
            if (!foundNew && lastModified == old.lastModified && forReuse.isEmpty())
                return old.updateLastRead(lastRead);

            foreach (PackFile p in forReuse.Values)
            {
                p.Dispose();
            }

            if (list.Count == 0)
            {
                return new PackList(lastRead, lastModified, NoPacks.packs);
Exemplo n.º 39
0
        public ActionResult Index()
        {
            List <PackList> newList = PackList.GetAll();

            return(View(newList));
        }