Exemplo n.º 1
0
        public Lop findlop(string malop)
        {
            Lop lop = new Lop();
            try
            {
                ketnoicsdl.Opendb(ketnoicsdl._db_path);

                lop = (from Lop p in ketnoicsdl.db
                       where p.Malop == malop
                      select p).SingleOrDefault();
                return lop;
            }
            finally
            {
                ketnoicsdl.db.Close();
            }
        }
Exemplo n.º 2
0
        public void addlop(string malop,string tenlop,string makhoa)
        {
            Lop lop = new Lop();
            lop.Malop = malop;
            lop.Tenlop = tenlop;
            lop.Makhoa = makhoa;

            try
            {
                ketnoicsdl.Opendb(ketnoicsdl._db_path);
                ketnoicsdl.db.Store(lop);
            }
            finally
            {
                ketnoicsdl.db.Close();
            }
        }
Exemplo n.º 3
0
        public Lop findlop(string malop)
        {
            Lop lop = new Lop();

            try
            {
                ketnoicsdl.Opendb(ketnoicsdl._db_path);

                lop = (from Lop p in ketnoicsdl.db
                       where p.Malop == malop
                       select p).SingleOrDefault();
                return(lop);
            }
            finally
            {
                ketnoicsdl.db.Close();
            }
        }
Exemplo n.º 4
0
        public void addlop(string malop, string tenlop, string makhoa)
        {
            Lop lop = new Lop();

            lop.Malop  = malop;
            lop.Tenlop = tenlop;
            lop.Makhoa = makhoa;

            try
            {
                ketnoicsdl.Opendb(ketnoicsdl._db_path);
                ketnoicsdl.db.Store(lop);
            }
            finally
            {
                ketnoicsdl.db.Close();
            }
        }
Exemplo n.º 5
0
 private void khoasv_SelectedValueChanged(object sender, EventArgs e)
 {
     //MessageBox.Show(((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString());
     if (khoasv.SelectedItem != null)
     {
         Lop lop = new Lop();
         //   MessageBox.Show( ((KeyValuePair<string, string>)khoasv).Value.ToString());
         try
         {
             for (int i = 0; i < lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value).Count; i++)
             {
                 //  khoa.Items.Add(new KeyValuePair<string, string>(kh.listkhoa()[i].Tenkhoa, kh.listkhoa()[i].Makhoa));
                 cmbLop.Items.Add(new KeyValuePair <string, string>(lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop, lop.listlop_khoa(((KeyValuePair <string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop));
             }
             cmbLop.DisplayMember = "Key";
             cmbLop.ValueMember   = "Value";
         }
         catch { };
     }
 }
Exemplo n.º 6
0
        private void khoa_SelectedValueChanged_1(object sender, EventArgs e)
        {
            string     makhoa;
            Lop        lop     = new Lop();
            List <Lop> loplist = new List <Lop>();

            lophoc.Items.Clear();//xoa lop moi khi chon khoa khac
            if (khoa.SelectedIndex != -1)
            {
                makhoa  = ((KeyValuePair <string, string>)khoa.SelectedItem).Value.ToString();
                loplist = lop.listlop_khoa(makhoa);
                for (int i = 0; i < loplist.Count; i++)
                {
                    lophoc.Items.Add(new KeyValuePair <string, string>
                                         (loplist[i].Tenlop, loplist[i].Malop));
                }
                lophoc.DisplayMember = "Key";
                lophoc.ValueMember   = "Value";
            }
        }
Exemplo n.º 7
0
        private void nhapttlop_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();

            string pathToExcelFile = ""
                                     + @openFileDialog1.FileName;

            string sheetName = "Sheet1";

            var excelFile = new ExcelQueryFactory(pathToExcelFile);
            var docexcel  = from a in excelFile.Worksheet <Lop>(sheetName) select a;

            foreach (var a in docexcel)
            {
                Lop lop = new Lop();
                lop.addlop(a.Malop, a.Tenlop, a.Makhoa);
            }
            MessageBox.Show("Đã đọc file excel thành công");
            excelFile.Dispose();
        }
Exemplo n.º 8
0
        public static string taomatudong(string tendoituong)
        {
            try
            {
                Opendb(ketnoicsdl._db_path);
                string t = "";
                switch (tendoituong)
                {
                case "giaovien":
                    Khoa khoa = (from Khoa p in ketnoicsdl.db
                                 orderby p.Makhoa descending
                                 select p).FirstOrDefault();
                    if (khoa == null)    //xem lai giao dien khoa
                    {
                        t = " " + "00000001";
                    }
                    else
                    {
                        t = khoa.Makhoa.Substring(1, 4) + Int32.Parse(khoa.Makhoa.Substring(4, 8)) + 1;
                    }

                    break;

                case "sinhvien":
                    Sinhvien sv = (from Sinhvien p in ketnoicsdl.db
                                   orderby p.Ma descending
                                   select p).FirstOrDefault();
                    if (sv == null)
                    {
                        t = DateTime.Now.Year.ToString() + "00000001";
                    }
                    else
                    {
                        string thu = sv.Ma.Substring(4, 8);
                        t = sv.Ma.Substring(0, 4) + themsokhong(Int32.Parse(sv.Ma.Substring(4, 8)) + 1);
                    }

                    break;

                case "lophoc":
                    Lop lop = (from Lop p in ketnoicsdl.db
                               orderby p.Malop descending
                               select p).FirstOrDefault();
                    if (lop == null)
                    {
                        t = "LH" + DateTime.Now.Year.ToString() + "000001";
                    }
                    else
                    {
                        t = lop.Malop.Substring(1, 6) + Int32.Parse(lop.Malop.Substring(4, 6)) + 1;
                    }

                    break;

                case "monhoc":    //xem lai giao dien mon hoc roi lam
                    Monhoc mh = (from Monhoc p in ketnoicsdl.db
                                 orderby p.Mamh descending
                                 select p).FirstOrDefault();
                    if (mh == null)
                    {
                        t = "MH" + " " + "000001";
                    }
                    else
                    {
                        t = mh.Mamh.Substring(1, 6) + Int32.Parse(mh.Mamh.Substring(4, 6)) + 1;
                    }

                    break;

                    /* case "khoa":
                     *    Khoa khoa = (from Khoa p in ketnoicsdl.db
                     *                  orderby p.Makhoa descending
                     *                  select p).FirstOrDefault();
                     *   if (khoa==null)
                     *   {
                     *       t = DateTime.Now.Year.ToString() + "00000001";
                     *   }
                     *   else
                     *   {
                     *       t =khoa.Makhoa.Substring(1,4)+ Int32.Parse(sv.Ma.Substring(4, 8))+1;
                     *   }
                     *
                     *   break;*/
                }
                return(t);
            }
            finally { ketnoicsdl.db.Close(); }
        }
Exemplo n.º 9
0
        private void nhapttlop_Click(object sender, EventArgs e)
        {
            openFileDialog1.ShowDialog();

            string pathToExcelFile = ""
             + @openFileDialog1.FileName;

            string sheetName = "Sheet1";

            var excelFile = new ExcelQueryFactory(pathToExcelFile);
            var docexcel = from a in excelFile.Worksheet<Lop>(sheetName) select a;

            foreach (var a in docexcel)
            {
                Lop lop = new Lop();
                lop.addlop(a.Malop, a.Tenlop, a.Makhoa);

            }
            MessageBox.Show("Đã đọc file excel thành công");
            excelFile.Dispose();
        }
Exemplo n.º 10
0
        private void khoa_SelectedValueChanged_1(object sender, EventArgs e)
        {
            string makhoa;
            Lop lop = new Lop();
            List<Lop> loplist = new List<Lop>();

            lophoc.Items.Clear();//xoa lop moi khi chon khoa khac
            if (khoa.SelectedIndex != -1)
            {
                makhoa = ((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString();
                loplist = lop.listlop_khoa(makhoa);
                for (int i = 0; i < loplist.Count; i++)
                {
                    lophoc.Items.Add(new KeyValuePair<string, string>
                        (loplist[i].Tenlop, loplist[i].Malop));
                }
                lophoc.DisplayMember = "Key";
                lophoc.ValueMember = "Value";
            }
        }
Exemplo n.º 11
0
        private void khoasv_SelectedValueChanged(object sender, EventArgs e)
        {
            //MessageBox.Show(((KeyValuePair<string, string>)khoa.SelectedItem).Value.ToString());
            if (khoasv.SelectedItem != null)
            {
                Lop lop = new Lop();
                //   MessageBox.Show( ((KeyValuePair<string, string>)khoasv).Value.ToString());
                try
                {

                    for (int i = 0; i < lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value).Count; i++)
                    {
                        //  khoa.Items.Add(new KeyValuePair<string, string>(kh.listkhoa()[i].Tenkhoa, kh.listkhoa()[i].Makhoa));
                        cmbLop.Items.Add(new KeyValuePair<string, string>(lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop, lop.listlop_khoa(((KeyValuePair<string, string>)khoasv.SelectedItem).Value.ToString())[i].Malop));
                    }
                    cmbLop.DisplayMember = "Key";
                    cmbLop.ValueMember = "Value";
                }
                catch { };
            }
        }