コード例 #1
0
 private void GenerateDemoEntries()
 {
     WaitingList.Add(new Transportation()
     {
         Countdown   = 5,
         Destination = "Vienna",
         Source      = "Linz",
         Cargo       = new List <CargoItem>()
         {
             new CargoItem()
             {
                 Description = "Manna Schnitten",
                 Amount      = 1000,
                 Weight      = 2
             },
             new CargoItem()
             {
                 Description = "Auer Torten Ecken",
                 Amount      = 2000,
                 Weight      = 3
             }
         }
     });
     DispatcherTimer timer = new DispatcherTimer();
 }
コード例 #2
0
 public bool Contains(SmartCoin coin)
 {
     lock (StateLock)
     {
         return(WaitingList.ContainsKey(coin) || Rounds.Any(x => x.CoinsRegistered.Contains(coin)));
     }
 }
コード例 #3
0
        private void btn_Analysis_Click(object sender, EventArgs e)
        {
            if (_nextTicketShow && _waitingListShow)
            {
                _waitingListShow = false;
                WaitingList.Hide();

                int entireDayTicket = TotalTicketSold[0] + TotalTicketSold[1] + TotalTicketSold[2] + TotalTicketSold[3];
                int entireDayCus    = TotalCutomers[0] + TotalCutomers[1] + TotalCutomers[2] + TotalCutomers[3];

                lbl_NextTicket.Text = string.Format(@"=========================================================" + @"
0am to 2am: " + @"
Total number of tickets sold: {0}   Total number customers: {1}
9am to 3pm: " + "\r\nTotal number of tickets sold: {2}   Total number customers: {3}\r\n5pm to 9pm: " +
                                                    "\r\nTotal number of tickets sold: {4}   Total number customers: {5}\r\n9pm to 12am: " +
                                                    "\r\nTotal number of tickets sold: {6}   Total number customers: {7}\r\nEntire day: " +
                                                    "\r\nTotal number of tickets sold: {8}   Total number customers: {9}\r\n=========================================================",
                                                    TotalTicketSold[0], TotalCutomers[0], TotalTicketSold[1],
                                                    TotalCutomers[1], TotalTicketSold[2], TotalCutomers[2],
                                                    TotalTicketSold[3], TotalCutomers[3], entireDayTicket, entireDayCus);
                lbl_NextTicket.Font = new Font(lbl_NextTicket.Font.FontFamily.Name, 12);
                _nextTicketShow     = false;
            }
            else
            {
                lbl_NextTicket.Text = _nextTicketText;
                lbl_NextTicket.Font = new Font(lbl_NextTicket.Font.Name, int.Parse(txt_size.Text));
                _nextTicketShow     = true;
                _waitingListShow    = true;
                WaitingList.Show();
            }
        }
コード例 #4
0
ファイル: Ambulance.cs プロジェクト: jakublackanic/cs-cpy
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (RoomNumber != null)
         {
             hashCode = hashCode * 59 + RoomNumber.GetHashCode();
         }
         if (WaitingList != null)
         {
             hashCode = hashCode * 59 + WaitingList.GetHashCode();
         }
         if (PredefinedConditions != null)
         {
             hashCode = hashCode * 59 + PredefinedConditions.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #5
0
 private void btnRefresh_Click(object sender, EventArgs e)
 {
     _waitingList   = new WaitingList();
     _patientstatus = _waitingList.GetWaitingListObject(_waitingid).Status.ToString();
     if (_patientstatus != "")
     {
         if (_patientstatus == "True")
         {
             MedicalsForm.lblPName.Text    = _waitingList.GetWaitingListObject(_waitingid).Patient.FirstName + @"  " + _waitingList.GetWaitingListObject(_waitingid).Patient.LastName;
             MedicalsForm.lblPGender.Text  = _waitingList.GetWaitingListObject(_waitingid).Patient.Gender;
             MedicalsForm.lblPAddress.Text = _waitingList.GetWaitingListObject(_waitingid).Patient.Address;
             MedicalsForm.lblPPhone.Text   = _waitingList.GetWaitingListObject(_waitingid).Patient.Phone1;
             MedicalsForm.WaitingList      = WaitingList;
             MedicalsForm.Patient          = _waitingList.GetWaitingListObject(_waitingid).Patient;
             Waitinglistform.Close();
             Close();
         }
         else
         {
             timer.Stop();
             MessageBox.Show(@"This Patient is Not Available...!");
             Close();
         }
     }
 }
コード例 #6
0
 public SmartCoin GetSingleOrDefaultFromWaitingList(SmartCoin coin)
 {
     lock (StateLock)
     {
         return(WaitingList.SingleOrDefault(x => x == coin));
     }
 }
コード例 #7
0
 private void ReleaseTasks(int currentCycle)
 {
     while (WaitingList.Count() > 0 && currentCycle >= WaitingList.Peek().Release)
     {
         ReadyList.Enqueue(WaitingList.Dequeue());
     }
 }
コード例 #8
0
ファイル: Manager.cs プロジェクト: usamasubhani/ccube
 public string OnePlayerArrived(Player p1)
 {
     if (QueueIsEmpty())
     {
         WaitingList.Enqueue(p1);
         return("Player added in queue.");
     }
     else if (!QueueIsEmpty())
     {
         if (!AllTablesBusy())
         {
             Game anewGame = new Game();
             anewGame.Player1   = Manager.WaitingList.Dequeue();
             anewGame.Player2   = p1;
             anewGame.TableName = Manager.getTable();
             Manager.BusyTable();
             Manager.GamesList.Add(anewGame);
         }
         else if (AllTablesBusy())
         {
             WaitingList.Enqueue(p1);
         }
         return("All Tables Busy. Player Added in queue");
     }
     else
     {
         return("ERROR!");
     }
 }
コード例 #9
0
        private XmlTextReader addWaitingListToWaitingListStock(XmlTextReader reader)
        {
            WaitingList newWaitingList = new WaitingList();

            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                case "order":
                    newWaitingList.Order = Int32.Parse(reader.Value);
                    break;

                case "item":
                    newWaitingList.Item = Int32.Parse(reader.Value);
                    break;

                case "amount":
                    newWaitingList.Amount = Int32.Parse(reader.Value);
                    break;
                }
            }

            this.WaitingListStocks[WaitingListStocks.Count - 1].WaitingList.Add(newWaitingList);
            return(reader);
        }
コード例 #10
0
 public IEnumerable <(uint256 txid, uint index)> GetSpentCoins()
 {
     lock (StateLock)
     {
         return(WaitingList.Concat(Rounds.SelectMany(x => x.CoinsRegistered)).Where(x => !x.Unspent).Select(x => (x.TransactionId, x.Index)).ToArray());
     }
 }
コード例 #11
0
        public StudentDTO AddToWaitinglist(StudentViewModel student, int Id)
        {
            if (GetStudentFromWaitingList(student.SSN, Id) != null)
            {
                throw new AlreadyOnWaitingListException();
            }
            // get the course and throw error if it is not found
            var course = checkIfCourseExsists(Id);

            // get the student and throw error if it is not found
            var stu = checkIfStudentExsists(student.SSN);

            //Búa til fall með þessu(líka notað í add to course)
            Enrollment enrollment = _db.Enrollments.SingleOrDefault(e => e.StudentSSN == student.SSN && e.CourseId == Id);

            if (enrollment != null && enrollment.NotRemoved)
            {
                throw new AlreadyInCourseException();
            }

            var waitingList = new WaitingList {
                CourseId = Id, StudentSSN = student.SSN
            };

            _db.WaitingList.Add(waitingList);
            _db.SaveChanges();

            return(new StudentDTO
            {
                SSN = stu.SSN,
                Name = (from st in _db.Students
                        where st.SSN == stu.SSN
                        select st).SingleOrDefault().Name
            });
        }
コード例 #12
0
ファイル: CcjClientState.cs プロジェクト: ikohut/WalletWasabi
        public void UpdateCoin(SmartCoin coin)
        {
            lock (StateLock)
            {
                SmartCoin found = WaitingList.Keys.Concat(Rounds.SelectMany(x => x.CoinsRegistered)).FirstOrDefault(x => x == coin);
                if (found != default)
                {
                    if (WaitingList.Keys.Contains(coin))
                    {
                        coin.CoinJoinInProgress = true;
                        WaitingList.Remove(found);
                        WaitingList.Add(coin, DateTimeOffset.UtcNow);
                        return;
                    }

                    foreach (CcjClientRound round in Rounds)
                    {
                        if (round.CoinsRegistered.Contains(coin))
                        {
                            coin.CoinJoinInProgress = true;
                            round.CoinsRegistered.Remove(found);
                            round.CoinsRegistered.Add(coin);
                            return;
                        }
                    }
                }
            }
        }
コード例 #13
0
        public void Create(WaitingList list, string Token)
        {
            if (!this.UserHandler.AuthenticateUser(list.UserID, Token))
            {
                throw new Exception("Unauthorized");
            }

            list.ID = Guid.NewGuid();

            var User = this.Context.Users.Where(x => x.ID == list.UserID).FirstOrDefault();

            if (User == null)
            {
                throw new Exception("User not found");
            }

            var Estate = this.Context.Estates.Where(x => x.ID == list.EstateID).FirstOrDefault();

            if (Estate == null)
            {
                throw new Exception("Estate not found");
            }

            var listCheck = this.Context.WaitingList.Where(x => x.UserID == list.UserID && x.EstateID == list.EstateID).FirstOrDefault();

            if (listCheck != null)
            {
                throw new Exception("Du er allerede skrevet op til denne bolig");
            }

            this.Context.WaitingList.Add(list);
            this.Context.SaveChanges();
        }
コード例 #14
0
ファイル: DataMock.cs プロジェクト: Dotax13/Unik_Concept
        public void AddToWaitingList()
        {
            WaitingList list = new WaitingList();

            list.ID       = Guid.NewGuid();
            list.UserID   = this.Renter.ID;
            list.EstateID = this.Estate.ID;
        }
コード例 #15
0
 /// <summary>
 /// Moves a player from the waiting room to the staging area as a game begins.
 /// </summary>
 private static void MovePlayersFromWaitingToStaging()
 {
     for (int i = ReversiSettings.ReversiPlayersPerGame - 1; i >= 0; i--)
     {
         StagingArea.Add(WaitingList[i]);
         WaitingList.RemoveAt(i);
     }
 }
コード例 #16
0
        public ActionResult DeleteConfirmed(int id)
        {
            WaitingList waitingList = db.WaitingList.Find(id);

            db.WaitingList.Remove(waitingList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #17
0
        private IEnumerable <TxoRef> GetRegistrableCoinsNoLock(int maximumInputCountPerPeer, Money feePerInputs, Money amountNeededExceptInputFees, bool allowUnconfirmedZeroLink)
        {
            if (!WaitingList.Any())             // To avoid computations.
            {
                return(Enumerable.Empty <TxoRef>());
            }

            Func <SmartCoin, bool> confirmationPredicate;

            if (allowUnconfirmedZeroLink)
            {
                confirmationPredicate = x => x.Confirmed || x.Label.StartsWith("ZeroLink", StringComparison.Ordinal);
            }
            else
            {
                confirmationPredicate = x => x.Confirmed;
            }

            var coins = WaitingList
                        .Where(x => x.Value <= DateTimeOffset.UtcNow)
                        .Select(x => x.Key)         // Only if registering coins is already allowed.
                        .Where(confirmationPredicate);

            for (int i = 1; i <= maximumInputCountPerPeer; i++)             // The smallest number of coins we can register the better it is.
            {
                var linq = coins.GetPermutations(i);
                linq = linq.Where(x => x.Sum(y => y.Amount) >= amountNeededExceptInputFees + (feePerInputs * i)); // If the sum reaches the minimum amount.

                if (i == 1)                                                                                       // If only one coin is to be registered.
                {
                    // Prefer the largest one, so more mixing volume is more likely.
                    linq = linq.OrderByDescending(x => x.Sum(y => y.Amount));

                    // Try to register with the smallest anonymity set, so new unmixed coins come to the mix.
                    linq = linq.OrderBy(x => x.Sum(y => y.AnonymitySet));
                }
                else                 // Else coin merging will happen.
                {
                    // Prefer the lowest amount sum, so perfect mix should be more likely.
                    linq = linq.OrderBy(x => x.Sum(y => y.Amount));

                    // Try to register the largest anonymity set, so red and green coins input merging should be less likely.
                    linq = linq.OrderByDescending(x => x.Sum(y => y.AnonymitySet));
                }

                linq = linq.OrderBy(x => x.Count(y => y.Confirmed == false));                 // Where the lowest amount of unconfirmed coins there are.

                IEnumerable <SmartCoin> best = linq.FirstOrDefault();

                if (best != default)
                {
                    return(best.Select(x => x.GetTxoRef()).ToArray());
                }
            }

            return(Enumerable.Empty <TxoRef>());           // Inputs are too small, max input to be registered is reached.
        }
コード例 #18
0
ファイル: CEHelper.cs プロジェクト: BannerlordCE/CEEvents
        internal static void ChangeMenu(int number)
        {
            string waitingList = new WaitingList().CEWaitingList();

            if (waitingList != null)
            {
                GameMenu.SwitchToMenu(waitingList);
            }
            waitMenuCheck = number;
        }
コード例 #19
0
 public void OrderTasks()
 {
     if (WaitingList.Count == 0) //Prompt warning
     {
         System.Windows.MessageBox.Show("No waiting tasks to be ordered!");
         return;
     }
     WaitingList = WaitingList.OrderBy(o => o.Priority).ThenBy(o => o.TopWaitingRequestedRecipe.Priority).ToList();
     //WaitingList = WaitingList.OrderBy(o => o.Priority).ToList();
 }
コード例 #20
0
        public void Initialize()
        {
            foreach (Job j in Tasks)
            {
                j.Reset();
                WaitingList.Enqueue(j);
            }

            CalcSeparation();
        }
コード例 #21
0
 public ActionResult Edit([Bind(Include = "Id,FirstName,LastName,Phone,DateAndTime")] WaitingList waitingList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(waitingList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(waitingList));
 }
コード例 #22
0
 public void RemoveCoinFromWaitingList(SmartCoin coin)
 {
     lock (StateLock)
     {
         if (WaitingList.ContainsKey(coin))
         {
             WaitingList.Remove(coin);
             Logger.LogInfo <CcjClientState>($"Coin removed from the waiting list: {coin.Index}:{coin.TransactionId}.");
         }
     }
 }
コード例 #23
0
 public void AddCoinToWaitingList(SmartCoin coin)
 {
     lock (StateLock)
     {
         if (!(WaitingList.ContainsKey(coin) || Rounds.Any(x => x.CoinsRegistered.Contains(coin))))
         {
             WaitingList.Add(coin, DateTimeOffset.UtcNow);
             Logger.LogInfo <CcjClientState>($"Coin added to the waiting list: {coin.Index}:{coin.TransactionId}.");
         }
     }
 }
コード例 #24
0
 public void ImportTasks(List <RequestedSubProgramClass> newlist)
 {
     foreach (var sp in newlist)
     {
         foreach (var RequestedRecipe in sp.RequestedRecipes)
         {
             RequestedRecipe.ValidExecutor.StatusChanged += new EventHandler(Executor_StatusChanged);
         }
         WaitingList.Add(sp);
     }
     //WaitingList.AddRange(newlist);
 }
コード例 #25
0
        public ActionResult Create([Bind(Include = "Id,FirstName,LastName,Phone")] WaitingList waitingList)
        {
            if (ModelState.IsValid)
            {
                waitingList.DateAndTime = DateTime.Now;
                db.WaitingList.Add(waitingList);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(waitingList));
        }
コード例 #26
0
        private void Init()
        {
            if (mInited)
            {
                return;
            }
            mInited = true;

            mWaitLoadBundleList = new WaitingList();
            mBundleList         = new BundleVector();
            mBundleTaskList     = new LoadTaskVector();

            LoadResInfo();
        }
コード例 #27
0
        // GET: WaitingLists/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WaitingList waitingList = db.WaitingList.Find(id);

            if (waitingList == null)
            {
                return(HttpNotFound());
            }
            return(View(waitingList));
        }
コード例 #28
0
        private void GenerateDemoEntries()
        {
            WaitingList.Add(new Transportation(CounterEllapsedInformer) //constructur used to provide instance of Informer delegate to Transportation object
            {
                Countdown   = 10,
                Destination = "Vienna",
                Source      = "Linz",
                Cargo       = new ObservableCollection <CargoItem>()
                {
                    new CargoItem()
                    {
                        Description = "Manna Schnitten",
                        Amount      = 1000,
                        Weight      = 2
                    },
                    new CargoItem()
                    {
                        Description = "Auer Torten Ecken",
                        Amount      = 2000,
                        Weight      = 3
                    }
                }
            });
            WaitingList.Last().StartCountDown();


            WaitingList.Add(new Transportation(CounterEllapsedInformer)
            {
                Countdown   = 3,
                Destination = "Innsbruck",
                Source      = "bregenz",
                Cargo       = new ObservableCollection <CargoItem>()
                {
                    new CargoItem()
                    {
                        Description = "Käse ecken",
                        Amount      = 1000,
                        Weight      = 2
                    },
                    new CargoItem()
                    {
                        Description = "Mozartkugeln",
                        Amount      = 3000,
                        Weight      = 500
                    }
                }
            });
            WaitingList.Last().StartCountDown();
        }
コード例 #29
0
        public List <StudentLiteDTO> AddStudentToWaitingList(int id, StudentViewModel newStudent)
        {
            var course = _db.Courses.SingleOrDefault(x => x.ID == id);

            if (course == null)
            {
                throw new AppObjectNotFoundException();
            }

            var student = _db.Students.SingleOrDefault(x => x.SSN == newStudent.SSN);

            if (student == null)
            {
                throw new AppObjectNotFoundException();
            }

            var studentInCourse = _db.CourseStudent.SingleOrDefault(x => x.SSN == newStudent.SSN && x.CourseID == id);

            if (studentInCourse != null && studentInCourse.Active == 1)
            {
                throw new AppDataPreconditionFailedException();
            }

            var studentInWaitingList = _db.WaitingList.SingleOrDefault(x => x.SSN == newStudent.SSN && x.CourseID == id);

            if (studentInWaitingList != null)
            {
                throw new AppDataPreconditionFailedException();
            }
            var addStudent = new WaitingList {
                SSN = newStudent.SSN, CourseID = id
            };

            _db.WaitingList.Add(addStudent);
            _db.SaveChanges();


            var result = (from cs in _db.WaitingList
                          join s in _db.Students on cs.SSN equals s.SSN
                          where cs.CourseID == id
                          select new StudentLiteDTO
            {
                SSN = s.SSN,
                Name = s.Name
            }).ToList();

            return(result);
        }
コード例 #30
0
 public void ClearRoundRegistration(long roundId)
 {
     lock (StateLock)
     {
         foreach (var round in Rounds.Where(x => x.State.RoundId == roundId))
         {
             foreach (var coin in round.CoinsRegistered)
             {
                 WaitingList.Add(coin, DateTimeOffset.UtcNow);
                 Logger.LogInfo <CcjClientState>($"Coin added to the waiting list: {coin.Index}:{coin.TransactionId}.");
             }
             round.ClearRegistration();
             Logger.LogInfo <CcjClientState>($"Round ({round.State.RoundId}) registration is cleared.");
         }
     }
 }