Exemple #1
0
 private void BtnNewMemberConfirm_Click(object sender, EventArgs e)
 {
     if (!IsEmpty(textBox1.Text) &&
         !IsEmpty(textBox2.Text) &&
         !IsEmpty(textBox3.Text))
     {
         if (ctx.Facilities.Count(x => x.FacilityID == textBox1.Text) < 1)
         {
             if ((int)numericUpDown1.Value > 0)
             {
                 Facility f = new Facility();
                 f.FacilityID = textBox1.Text;
                 f.Activity   = textBox2.Text;
                 f.Venue      = textBox3.Text;
                 f.MaxCount   = (int)numericUpDown1.Value;
                 ctx.Facilities.Add(f);
                 ctx.SaveChanges();
                 DialogResult = DialogResult.OK;
                 Close();
             }
             else
             {
                 MessageBox.Show("Please put positive number!");
             }
         }
         else
         {
             MessageBox.Show("ID Exists! Try another one!");
         }
     }
     else
     {
         MessageBox.Show("You need to input all fields!");
     }
 }
Exemple #2
0
 private void BtnNewMemberConfirm_Click(object sender, EventArgs e)
 {
     if (!IsEmpty(tbName.Text) &&
         !IsEmpty(tbAddr.Text) &&
         !IsEmpty(tbPh1.Text) &&
         !IsEmpty(tbPh2.Text))
     {
         m.MemberName = tbName.Text;
         m.Birthdate  = dateTimePicker1.Value;
         if (rbtnF.Checked == true)
         {
             m.Gender = "F";
         }
         else
         {
             m.Gender = "M";
         }
         m.Address  = tbAddr.Text;
         m.HandPhNo = tbPh1.Text + "-" + tbPh2.Text;
         ctx.Members.Add(m);
         ctx.SaveChanges();
         mlist        = ctx.Members.ToList();
         DialogResult = DialogResult.OK;
         Close();
     }
     else
     {
         MessageBox.Show("You need to input all fields!");
     }
 }
        private void BtnEditMem_Click(object sender, EventArgs e)
        {
            int        row      = dataGridView1.CurrentRow.Index;
            EditMember f        = new EditMember();
            Member     toupdate = mlist[row];

            f.MemToEdit = toupdate;
            using (f)
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    toupdate = f.MemToEdit;
                    ctx.SaveChanges();
                    MessageBox.Show("Successful Updated!");
                }
            }
            dataGridView1.Refresh();
        }
Exemple #4
0
        private void BtnEditFac_Click(object sender, EventArgs e)
        {
            int row                   = gridFacility.CurrentRow.Index;
            EditFacilityForm f        = new EditFacilityForm();
            Facility         toupdate = flist[row];

            f.FacToEdit = toupdate;
            using (f)
            {
                if (f.ShowDialog() == DialogResult.OK)
                {
                    toupdate = f.FacToEdit;
                    ctx.SaveChanges();
                    MessageBox.Show("Successful Updated!");
                }
            }
            gridFacility.Refresh();
        }
Exemple #5
0
 private void BtnCancelBooking_Click(object sender, EventArgs e)
 {
     if (b != null)
     {
         b.bookstatus = "cancelled";
         ctx.SaveChanges();
         MessageBox.Show("Successful!");
         blist = m.Bookings.Where(x => x.bookstatus == "active").ToList();
         dataGridView1.DataSource = blist;
         lblBookingInfo.Text      = "";
     }
     else
     {
         MessageBox.Show("Select to cancel!");
     }
 }
 private void Confirm_button_Click(object sender, EventArgs e)
 {
     if (bookm != null && bookt != null)
     {
         Booking b = new Booking();
         b.Facility     = bookf;
         b.Member       = bookm;
         b.Timing       = bookt;
         b.FacilityDate = bookdate;
         b.BookingDate  = DateTime.Today.Date;
         b.bookstatus   = "active";
         ctx.Bookings.Add(b);
         ctx.SaveChanges();
         MessageBox.Show("Successfully Booked!");
         BookingRecForm fshow = new BookingRecForm();
         fshow.Bdetail = b;
         fshow.ShowDialog();
         Close();
     }
     else
     {
         MessageBox.Show("Please select details!");
     }
 }