Beispiel #1
0
 private void BtnBiletIptal_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(buttonText))
     {
         MessageBox.Show("İlk önce koltuk seçmeniz gerekmektedir!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Chair chair = HelperChair.GetChairByShowtimesIdAndName(showtimes.ShowtimesId, buttonText);
         if (chair.IsSold == false)
         {
             MessageBox.Show("Bu koltuk daha önce satılmamış. Satılmamış bir koltuğun biletini iptal edemezsiniz!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             chair.IsSold = false;
             var    a      = HelperChair.ChairCUD(chair, System.Data.Entity.EntityState.Modified);
             Ticket ticket = HelperTicket.GetTicketByShowtimesIdAndChairId(showtimes.ShowtimesId, chair.ChairId);
             var    b      = HelperTicket.TicketCUD(ticket, System.Data.Entity.EntityState.Deleted);
             RefreshTheSeats();
             RefreshTheTotalBalance();
         }
     }
 }
Beispiel #2
0
 private void BtnBiletSat_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(buttonText))
     {
         MessageBox.Show("İlk önce koltuk seçmeniz gerekmektedir!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         Chair chair = HelperChair.GetChairByShowtimesIdAndName(showtimes.ShowtimesId, buttonText);
         if (chair.IsSold == true)
         {
             MessageBox.Show("Bu koltuk daha önce satılmış. Lütfen başka bir koltuk seçiniz.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             if (radioButton1.Checked == true && radioButton2.Checked == false)
             {
                 chair.IsSold = true;
                 var    b      = HelperChair.ChairCUD(chair, System.Data.Entity.EntityState.Modified);
                 Ticket ticket = new Ticket();
                 ticket.ShowtimesId = showtimes.ShowtimesId;
                 ticket.ChairId     = chair.ChairId;
                 ticket.Type        = 0;
                 ticket.UserId      = user.UserId;
                 var a = HelperTicket.TicketCUD(ticket, System.Data.Entity.EntityState.Added);
                 if (a.Item2)
                 {
                     RefreshTheTotalBalance();
                     RefreshTheSeats();
                     MessageBox.Show($"Salonunun {buttonText} koltuğu satılmıştır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show($"Koltuk satılamamıştır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             else if (radioButton1.Checked == false && radioButton2.Checked == true)
             {
                 chair.IsSold = true;
                 var    b      = HelperChair.ChairCUD(chair, System.Data.Entity.EntityState.Modified);
                 Ticket ticket = new Ticket();
                 ticket.ShowtimesId = showtimes.ShowtimesId;
                 ticket.ChairId     = chair.ChairId;
                 ticket.Type        = 1;
                 ticket.UserId      = user.UserId;
                 var a = HelperTicket.TicketCUD(ticket, System.Data.Entity.EntityState.Added);
                 if (a.Item2)
                 {
                     RefreshTheTotalBalance();
                     RefreshTheSeats();
                     MessageBox.Show($"Salonunun {buttonText} koltuğu satılmıştır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
                 else
                 {
                     MessageBox.Show($"Koltuk satılamamıştır.", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 }
             }
             else
             {
                 MessageBox.Show("İlk önce bilet tipini seçmeniz gerekmektedir!", "Bilgilendirme", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }