예제 #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);
        }
예제 #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);
 }
예제 #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("Овој наптревар е веќе типуван!");
         }
     }
 }
예제 #4
0
파일: Form1.cs 프로젝트: AtanasK/VP
        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("Овој наптревар е веќе типуван!");
                }

            }
        }
예제 #5
0
파일: Form1.cs 프로젝트: AtanasK/VP
 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;
 }