Esempio n. 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (start.Text.Length != 0 || finish.Text.Length != 0 || amount.Text.Length != 0)
            {
                model.start  = start.Text.Trim();
                model.finish = finish.Text.Trim();
                using (TicketEntities1 db = new TicketEntities1())
                {
                    db.books.Add(model);
                    db.SaveChanges();
                }
                MessageBox.Show("จองตั๋วเสร็จสิ้น");
            }
            else
            {
                MessageBox.Show("โปรดใส่ข้อมูลให้ครบ");
            }

            String data1  = time.Value.ToString("HH:mm");
            String data   = day.Value.ToString("dd/MM/yyyy");
            String data2  = start.Text.ToString();
            String data3  = finish.Text.ToString();
            int    data4  = Convert.ToInt32(amount.Text);
            ticket frmtic = new ticket(data, data1, data2, data3, data4);



            frmtic.Show();
        }
Esempio n. 2
0
 private void Save_Click(object sender, EventArgs e)
 {
     if (firstname.Text.Length != 0 || lastname.Text.Length != 0 || gender.Text.Length != 0 || address.Text.Length != 0 || email.Text.Length != 0 || phone.Text.Length != 0 || ncredit.Text.Length != 0)
     {
         model.firstname = firstname.Text.Trim();
         model.lastname  = lastname.Text.Trim();
         model.address   = address.Text.Trim();
         model.email     = email.Text.Trim();
         model.ncradit   = ncredit.Text.Trim();
         model.gender    = gender.Text.Trim();
         model.phone     = phone.Text.Trim();
         using (TicketEntities1 db = new TicketEntities1())
         {
             db.members.Add(model);
             db.SaveChanges();
         }
         Clear();
         MessageBox.Show("บันทึกเสร็จสิ้น");
         this.Hide();
         bookfrom b = new bookfrom();
         b.Show();
     }
     else
     {
         MessageBox.Show("โปรดใส่ข้อมูลให้ครบ");
     }
 }