Ejemplo n.º 1
0
        private void btnFacilityDelete_Click(object sender, EventArgs e)
        {
            timer1.Enabled             = true;
            toolStripStatusLabel1.Text = "Delete";

            int nRow = Convert.ToInt32(textBox1.Text);

            AddFacility afDelete = ctx.AddFacilities.Where(x => x.FacilityCode == nRow).First();

            ctx.AddFacilities.Remove(afDelete);

            ctx.SaveChanges();
            textBox1.Text = "";

            MessageBox.Show("Delete Successful");
            timer1.Enabled             = true;
            toolStripStatusLabel1.Text = "Delete Successful";

            var q = from x in ctx.AddFacilities orderby x.FacilityCode select x;

            dataGridView1.DataSource = q.ToList();
        }
        private void btnaddF_Click(object sender, EventArgs e)
        {
            AddFacility    f  = new AddFacility();
            FacilityDetail fd = new FacilityDetail();

            f.FacilityCode = Convert.ToInt32(tbaddFC.Text);
            f.FacilityName = tbaddFN.Text;
            f.Venue        = tbaddV.Text;
            f.MaxCount     = Convert.ToInt32(tbaddMC.Text);

            fd.FacilityCode = Convert.ToInt32(tbaddFC.Text);
            fd.FacilityName = tbaddFN.Text;

            ///
            ///
            ctx.AddFacilities.Add(f);
            ctx.FacilityDetails.Add(fd);


            ctx.SaveChanges();

            MessageBox.Show("Add Successful");
        }
Ejemplo n.º 3
0
        private void btnFacilityAdd_Click(object sender, EventArgs e)
        {
            AddFacility addFacility = new AddFacility();

            addFacility.ShowDialog();
        }