Пример #1
0
        private void btnXem_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            showTruong show = new showTruong();
            DBConnect  db   = new DBConnect();
            int        r    = dgvTruong.CurrentCell.RowIndex;

            string        ma_truong  = dgvTruong.Rows[r].Cells[0].Value.ToString();
            DAL_Truong    dal_truong = new DAL_Truong();
            DAL_TS        tuyensinh  = new DAL_TS();
            List <string> data       = dal_Truong.getInfoTruong(ma_truong);

            show.setMatruong(data[0]);
            show.setTentruong(data[1]);
            show.setDiaChi(data[2]);
            show.setWebsite(data[3]);
            show.setTinhthanh(data[4]);
            show.setDvChuQuan(data[5]);

            List <int> data_1 = tuyensinh.getInfoTuyenSinh(ma_truong);

            show.setNb_2014((int)data_1[0]);
            show.setNb_2015((int)data_1[1]);
            show.setNb_2016((int)data_1[2]);
            show.setNb_2017((int)data_1[3]);
            show.Show();
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string ma_truong    = txtMaTruong.Text,
                   ten_truong   = txtTenTruong.Text,
                   dia_chi      = txtDiaChi.Text,
                   website      = txtWebsite.Text,
                   tinh_thanh   = txtTinhThanh.Text,
                   dv_chu_quan  = txtDvChuQuan.Text;
            string nb_2014      = txtNam2014.Text,
                   nb_2015      = txtNam2015.Text,
                   nb_2016      = txtNam2016.Text,
                   nb_2017      = txtNam2017.Text;
            List <String> ls_nb = new List <string>();

            ls_nb.Add(nb_2014);
            ls_nb.Add(nb_2015);
            ls_nb.Add(nb_2016);
            ls_nb.Add(nb_2017);

            List <DTO_TS> ls_ts  = new List <DTO_TS>();
            DAL_Truong    dal    = new DAL_Truong();
            DAL_DuBao     dubao  = new DAL_DuBao();
            DTO_Truong    truong = new DTO_Truong(ma_truong, ten_truong, dia_chi, website, tinh_thanh, dv_chu_quan);
            AC_Truong     action = new AC_Truong();
            string        token  = action.checkListString(ls_nb);

            if (token != "OK")
            {
                MessageBox.Show(token);
            }
            else
            {
                DTO_TS ts_2014 = new DTO_TS(ma_truong, 2014, Int32.Parse(nb_2014));
                DTO_TS ts_2015 = new DTO_TS(ma_truong, 2015, Int32.Parse(nb_2015));
                DTO_TS ts_2016 = new DTO_TS(ma_truong, 2016, Int32.Parse(nb_2016));
                DTO_TS ts_2017 = new DTO_TS(ma_truong, 2017, Int32.Parse(nb_2017));

                ls_ts.Add(ts_2014);
                ls_ts.Add(ts_2015);
                ls_ts.Add(ts_2016);
                ls_ts.Add(ts_2017);

                if (matruong == ma_truong)
                {
                    if (action.del_Truong(matruong) && action.add_Truong(truong, ls_ts))
                    {
                        if (checkChangeValueNam() && dubao.updateTruong_Dubaocung(ma_truong))
                        {
                            MessageBox.Show("Sửa thành công");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Có lỗi trong khi sửa");
                    }
                }
                else
                {
                    if (dal.checkMatruong(ma_truong))
                    {
                        if (action.del_Truong(matruong) && action.add_Truong(truong, ls_ts))
                        {
                            MessageBox.Show("Sửa thành công");
                        }
                        else
                        {
                            MessageBox.Show("Có lỗi trong khi sửa");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Mã trường đã tồn tại");
                    }
                }
            }
        }
Пример #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string ma_truong    = txtMaTruong.Text,
                   ten_truong   = txtTenTruong.Text,
                   dia_chi      = txtDiaChi.Text,
                   website      = txtWebsite.Text,
                   tinh_thanh   = txtTinhThanh.Text,
                   dv_chu_quan  = txtDvChuQuan.Text;
            string nb_2014      = txtNam2014.Text,
                   nb_2015      = txtNam2015.Text,
                   nb_2016      = txtNam2016.Text,
                   nb_2017      = txtNam2017.Text;
            List <String> ls_nb = new List <string>();

            ls_nb.Add(nb_2014);
            ls_nb.Add(nb_2015);
            ls_nb.Add(nb_2016);
            ls_nb.Add(nb_2017);

            List <DTO_TS> ls_ts  = new List <DTO_TS>();
            DTO_Truong    truong = new DTO_Truong(ma_truong, ten_truong, dia_chi, website, tinh_thanh, dv_chu_quan);
            AC_Truong     action = new AC_Truong();
            DAL_DuBao     dubao  = new DAL_DuBao();
            List <int>    ls_nam = dubao.getNamDuBaoCung();

            foreach (int nam in ls_nam)
            {
                DTO_DuBao db = new DTO_DuBao(ma_truong, 0, 0, nam, 0);
                dubao.addDuBaoCung(db);
            }

            string token = action.checkListString(ls_nb);

            if (token != "OK")
            {
                MessageBox.Show(token);
            }
            else
            {
                DAL_Truong dal = new DAL_Truong();
                if (dal.checkMatruong(ma_truong))
                {
                    DTO_TS ts_2014 = new DTO_TS(ma_truong, 2014, Int32.Parse(nb_2014));
                    DTO_TS ts_2015 = new DTO_TS(ma_truong, 2015, Int32.Parse(nb_2015));
                    DTO_TS ts_2016 = new DTO_TS(ma_truong, 2016, Int32.Parse(nb_2016));
                    DTO_TS ts_2017 = new DTO_TS(ma_truong, 2017, Int32.Parse(nb_2017));

                    ls_ts.Add(ts_2014);
                    ls_ts.Add(ts_2015);
                    ls_ts.Add(ts_2016);
                    ls_ts.Add(ts_2017);

                    if (action.add_Truong(truong, ls_ts))
                    {
                        MessageBox.Show("\t\t    Thêm thành công.\nVui lòng nhập tỉ lệ tốt nghiệp trong file TiLeTotNghiep.xlsx");
                        AddTruong view = new AddTruong();
                        view.Show();
                    }
                }
                else
                {
                    MessageBox.Show("Mã trường đã tồn tại");
                }
            }
        }