Пример #1
0
        public void SaledMethod()
        {
            adapt = new SqlDataAdapter($"Select SeansTime,SeansDate,StolNo,ClientN,ClientS,SalonName,MovieName,Price from Ticket Join Seans on Seans.Id=Ticket.SeansId Join Salon on Ticket.SalonId=Salon.Id Join Movie on Ticket.MovieId=Movie.Id Join Sale on Ticket.SaleId=Sale.Id Where Ticket.Id='{textBox1.Text}' ", conClass.GetConnection());
            DataTable dt = new DataTable();

            adapt.Fill(dt);
            if (dt.Rows.Count == 0)
            {
                MessageBox.Show($"* {textBox1.Text} * nömrəli bilet yoxdur");
            }
            else
            {
                TicketSaled tk = new TicketSaled();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    DataRow dr = dt.Rows[i];
                    tk.lblSeans.Text       = dr[0].ToString();
                    tk.lblDate.Text        = dr[1].ToString();
                    tk.lblStol.Text        = dr[2].ToString();
                    tk.lblNameSurname.Text = dr[3].ToString() + " " + dr[4].ToString();
                    tk.lblSalonNo.Text     = dr[5].ToString();
                    tk.lblMovieName.Text   = dr[6].ToString();
                    tk.lblPrice.Text       = dr[7].ToString();
                    tk.lbltkNo.Text        = tk.lblBiletNo.Text = textBox1.Text;
                }
                tk.ShowDialog();
            }
        }
Пример #2
0
 private void btnBuyTicket_Click(object sender, EventArgs e)
 {
     if (txtClientName.Text != "" && txtClientSurname.Text != "" && txtMovieName.Text != "" && txtSumCost.Text != "" && txtchoosedTable.Text != "" && cmbCost.Text != "" && cmbSalon.Text != "" && cmbSeans.Text != "" && cmbDate.Text != "")
     {
         if (MessageBox.Show("Bilet almaq istediyinizə əminsinizmi?", "_", MessageBoxButtons.YesNo, MessageBoxIcon.None) == DialogResult.Yes)
         {
             conClass.InsertMethod($"Insert into Client(ClientName,ClientSurname) values('{txtClientName.Text}','{txtClientSurname.Text}')");
             int clntId   = 0;
             int filminId = 0;
             int seansId  = 0;
             int salonId  = 0;
             int saleId   = 0;
             salonId  = mv.SelectId($"Select Id from Salon Where SalonName='{cmbSalon.Text}'");
             filminId = mv.SelectId($"Select Id from Movie Where MovieName='{txtMovieName.Text}'");
             seansId  = mv.SelectId($"Select Id from Seans Where MovId='{filminId}' and SeansDate='{cmbDate.Text}' and SeansTime='{cmbSeans.Text}' and SalId='{salonId}'");
             clntId   = mv.SelectId($"Select Id from Client Where ClientName='{txtClientName.Text}' and ClientSurname='{txtClientSurname.Text}'");
             conClass.InsertMethod($"Insert into Sale(Date,ClientId,Price) values('{cmbDate.Text}','{clntId}','{txtSumCost.Text}')");
             saleId = mv.SelectId($"Select Id from Sale Where Date='{cmbDate.Text}' and Price='{txtSumCost.Text}' and ClientId='{clntId}'");
             conClass.InsertMethod($"Insert into Ticket(MovieId,SalonId,SeansId,Date,StolNo,SaleId,ClientN,ClientS) values('{filminId}','{salonId}','{seansId}','{cmbDate.Text}','{txtchoosedTable.Text}','{saleId}','{txtClientName.Text}','{txtClientSurname.Text}')");
             MessageBox.Show("Bilet Alınmışdır");
             int ticketId = 0;
             ticketId = mv.SelectId($"Select Id from Ticket Where SaleId='{saleId}'");
             TicketSaled tk = new TicketSaled();
             tk.lblPrice.Text       = txtSumCost.Text;
             tk.lblMovieName.Text   = txtMovieName.Text;
             tk.lblNameSurname.Text = txtClientName.Text + " " + txtClientSurname.Text;
             tk.lblSalonNo.Text     = cmbSalon.Text;
             tk.lblSeans.Text       = cmbSeans.Text;
             tk.lblStol.Text        = txtchoosedTable.Text;
             tk.lbltkNo.Text        = tk.lblBiletNo.Text = ticketId.ToString();
             tk.Show();
         }
     }
     else
     {
         MessageBox.Show("Gərəkli xanaları doldurun");
     }
 }