Esempio n. 1
0
 public void Load()
 {
     using (ReadWriteLock ReadWriteLock1 = new ReadWriteLock(this.readerWriterLockSlim, ReadWriteMode.Write))
     {
         this.PrimaryKey = new DataColumn[] { this.Columns["Account"], this.Columns["StockID"] };
         using (QSDBContext db = new QSDBContext())
         {
             foreach (var item in db.StockLimit)
             {
                 var row = this.NewStockLimitRow();
                 row.Account          = item.Account;
                 row.BuyType          = (int)item.BuyType;
                 row.SaleType         = (int)item.SaleType;
                 row.CommissionCharge = item.CommissionCharge;
                 row.Market           = item.Market;
                 row.QtyCanUse        = item.QtyCanUse;
                 row.StockID          = item.StockID;
                 row.StockName        = item.StockName;
                 this.AddStockLimitRow(row);
             }
         }
         this.StockLimitRowChanging += StockLimitDataTable_StockLimitRowChanging;
         this.StockLimitRowDeleting += StockLimitDataTable_StockLimitRowChanging;
     }
 }
Esempio n. 2
0
 public bool LockStockQty(string stockID)
 {
     using (ReadWriteLock ReadWriteLock1 = new ReadWriteLock(this.readerWriterLockSlim, ReadWriteMode.Write))
     {
         try
         {
             var limist = this.Where(_ => _.StockID == stockID && _.QtyCanUse > _.QtyUsed);
             return(true);
         }
         catch (System.Exception)
         {
             return(false);
         }
     }
 }