Exemple #1
0
        void calculateTotal()
        {
            float totalCoef = 1;

            for (int i = 0; i < lbTickets.Items.Count; ++i)
            {
                TicketItem ti = lbTickets.Items[i] as TicketItem;
                totalCoef *= ti.Game.Coefitients[ti.Tip];
            }
            tbTotalCoef.Text = string.Format("{0:0.000}", totalCoef);
            tbProfit.Text    = string.Format("{0:0.0}", totalCoef * (float)nudPayment.Value);
        }
Exemple #2
0
 bool containsTicketItem(TicketItem ti)
 {
     foreach (object obj in lbTickets.Items)
     {
         TicketItem ticketItem = obj as TicketItem;
         if (ti.Game.Code.Equals(ticketItem.Game.Code))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #3
0
 private void btnAddGame_Click(object sender, EventArgs e)
 {
     if (lbGames.SelectedIndex != -1 && cbTip.SelectedIndex != -1)
     {
         Game       game = (Game)lbGames.SelectedItem;
         TicketItem ti   = new TicketItem();
         ti.Game = game;
         ti.Tip  = cbTip.SelectedIndex;
         if (!containsTicketItem(ti))
         {
             lbTickets.Items.Add(ti);
             lbGames.ClearSelected();
             calculateTotal();
         }
         else
         {
             MessageBox.Show("Овој наптревар е веќе типуван!");
         }
     }
 }
Exemple #4
0
        private void btnAddGame_Click(object sender, EventArgs e)
        {
            if (lbGames.SelectedIndex != -1 && cbTip.SelectedIndex != -1)
            {
                Game game = (Game)lbGames.SelectedItem;
                TicketItem ti = new TicketItem();
                ti.Game = game;
                ti.Tip = cbTip.SelectedIndex;
                if (!containsTicketItem(ti))
                {
                    lbTickets.Items.Add(ti);
                    lbGames.ClearSelected();
                    calculateTotal();
                }
                else
                {
                    MessageBox.Show("Овој наптревар е веќе типуван!");
                }

            }
        }
Exemple #5
0
 bool containsTicketItem(TicketItem ti)
 {
     foreach (object obj in lbTickets.Items)
     {
         TicketItem ticketItem = obj as TicketItem;
         if (ti.Game.Code.Equals(ticketItem.Game.Code))
         {
             return true;
         }
     }
     return false;
 }