Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex >= 0)
            {
                classExer ce = null;
                var       q1 = from o in pp.context.classExer
                               where o.cid == Lcs2[listBox2.SelectedIndex].classid && o.eid == lid
                               select o;
                ce = q1.First <classExer>();

                ce.cid       = Lcs2[listBox2.SelectedIndex].classid;
                ce.eid       = lid;
                ce.starttime = dateTimePicker1.Value;
                ce.endtime   = dateTimePicker2.Value;
                pp.context.UpdateObject(ce);
                pp.context.SaveChanges();

                dispalylist();
            }



            else
            {
                MessageBox.Show("please select a list");
            }
        }
Beispiel #2
0
 private void listBox2_MouseClick(object sender, MouseEventArgs e)
 {
     if (listBox2.SelectedIndex >= 0)
     {
         classExer ce = null;
         var       q1 = from o in pp.context.classExer
                        where o.cid == Lcs2[listBox2.SelectedIndex].classid && o.eid == lid
                        select o;
         ce = q1.First <classExer>();
         dateTimePicker1.Value = (System.DateTime)ce.starttime;
         dateTimePicker2.Value = (System.DateTime)ce.endtime;
         sel2 = listBox2.SelectedIndex;
     }
 }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex >= 0)
            {
                sel1 = listBox1.SelectedIndex;
                classExer ce = new classExer();
                ce.cid       = Lcs3[sel1].classid;
                ce.eid       = lid;
                ce.starttime = dateTimePicker1.Value;
                ce.endtime   = dateTimePicker2.Value;
                pp.context.AddToclassExer(ce);
                pp.context.SaveChanges();
            }

            dispalylist();
        }
Beispiel #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (listBox2.SelectedIndex >= 0)
            {
                sel2 = listBox2.SelectedIndex;
                int cid = Lcs2[sel2].classid;
                int eid = lid;
                var q4  = from o in pp.context.classExer
                          where o.cid == cid && o.eid == eid
                          select o;
                classExer eed = q4.First <classExer>( );
                pp.context.DeleteObject(eed);
                pp.context.SaveChanges();
            }

            dispalylist();
        }
Beispiel #5
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            c_l = 2;
            DateTime  now1   = System.DateTime.Now;
            int       selid3 = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
            classExer ext    = null;

            ext = lce.Where(o => o.eid == selid3).First();
            if (now1 < ext.starttime)
            {
                c_l = 1;
            }
            if (now1 > ext.endtime)
            {
                c_l = 3;
            }
            // MessageBox.Show(e.RowIndex.ToString());
            //   MessageBox.Show(lce[e.RowIndex].starttime.ToString());
            sel2 = e.RowIndex;
        }