protected void Page_Load(object sender, EventArgs e)
    {
        LopHoc lh = new LopHoc();
        if (Request.QueryString["action"] == "nhapdiem")
        {
            string action = Request.QueryString["nhapdiem"];
            string malop = Request.QueryString["malop"];
            Session["malop"] = malop;
            
            lh.MaLop = Session["malop"].ToString();
            
        }

        if (Request.QueryString["action"] == "nhapdiem1")
        {
            string action = Request.QueryString["nhapdiem1"];
            string mahs = Request.QueryString["mahs"];
            Session["mahs"] = mahs;
            lophoc = Session["malop"].ToString();
            lbMaHS.Text = mahs;
        }
        Session["malop"] = lophoc;
        lh.MaLop = Session["malop"].ToString();
        GiaoVien gv = new GiaoVien();
        int magv = int.Parse(Session["MaGV"].ToString());
        gv.MaGV = magv;
      
        DSHocSinh.DataBind();
       
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LopHoc lh = new LopHoc();
            if (Request.QueryString["action"] == "nhapdiem")
            {
                string action = Request.QueryString["nhapdiem"];
                string malop = Request.QueryString["malop"];
                Session["malop"] = malop;

                lh.MaLop = Session["malop"].ToString();

            }
            lh.MaLop = Session["malop"].ToString();
            GiaoVien gv = new GiaoVien();
            int magv = int.Parse(Session["magv"].ToString());
            monhoc = gvDAL.GetMaMonHoc(magv, lh.MaLop);   
            gv.MaGV = magv;           
            DSHocSinh.DataSource = gvDAL.GetDanhSachHSLopNhapDiem(Session["malop"].ToString(), magv,monhoc);
            DSHocSinh.DataBind();
            kiemtratb();
        }
        lbTenLop.Text = gvDAL.LayTenLop(Session["malop"].ToString());
        lbMonHoc.Text=gvDAL.LayTenMonHoc(monhoc);

    }
    public void HienThiLop()
    {
       
        GiaoVien gv = new GiaoVien();
        int ma = int.Parse(Session["MaGV"].ToString());
        gv.MaGV = ma;
        gridDSHocSinh.DataSource = gvBLL.LayLopHocTheoGV(gv);
        gridDSHocSinh.DataBind();

    }
 public void HienThiLop()
 {
     int khoi = int.Parse(DrKhoiLop.Text);
     KhoiLop kl = new KhoiLop();
     GiaoVien gv = new GiaoVien();
     kl.MaKhoi = khoi;
     int magv = int.Parse(Session["MaGV"].ToString());
     gv.MaGV = magv;
     GridDSLop.DataSource = gvBLL.LayLopHocTheoKhoi_GV(kl,gv);
     GridDSLop.DataBind();
 }
Example #5
0
 private void btnSua_Click(object sender, EventArgs e)
 {
     if (gridDSGV.SelectedRows.Count > 0)
     {
         int      maGV = (int)gridDSGV.Rows[gridDSGV.SelectedRows[0].Index].Cells[1].Value;
         GiaoVien gv   = GiaoVienBUS.Instance.GetGiaoVienByMaGV(maGV);
         frmSuaGV fsua = new frmSuaGV(gv);
         fsua.ShowDialog();
         LoadDSGVtodtgv();
     }
     else
     {
         MessageBox.Show("Hãy chọn giáo viên muốn sửa!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
        // GET: GiaoViens/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GiaoVien giaoVien = db.GiaoViens.Find(id);

            if (giaoVien == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ChuyenNganhId = new SelectList(db.ChuyenNganhs, "Id", "NameCN");
            return(View(giaoVien));
        }
        public ActionResult XacnhanxoaGV(int id)
        {
            //Lấy ra đối tượng sách cần xóa theo mã
            GiaoVien gv = db.GiaoViens.SingleOrDefault(n => n.MaGiaoVien == id);

            ViewBag.MaGiaoVien = gv.MaGiaoVien;
            if (gv == null)
            {
                Response.StatusCode = 404;
                return(null);
            }
            db.GiaoViens.DeleteOnSubmit(gv);
            db.SubmitChanges();
            return(RedirectToAction("Teacher"));
        }
Example #8
0
        public HttpResponseMessage Post(FormDataCollection form)
        {
            var values = form.Get("values");

            var giaoVien = new GiaoVien();

            JsonConvert.PopulateObject(values, giaoVien);

            if (_giaoVIenService.Add(giaoVien))
            {
                return(Request.CreateResponse(HttpStatusCode.Created));
            }

            return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Mã giáo viên đã tồn tại"));
        }
Example #9
0
        // GET: Admin/Teachers/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GiaoVien giaoVien = db.GiaoViens.Find(id);

            if (giaoVien == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ma = new SelectList(db.TaiKhoans, "tai_khoan", "mat_khau", giaoVien.ma);
            return(View(giaoVien));
        }
Example #10
0
        private void dtgDanhSachGV_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            GiaoVien gv = new GiaoVien();

            gv.Ma       = dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[0].Value.ToString().Trim();
            gv.Ten      = dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[1].Value.ToString().Trim();
            gv.NgaySinh = DateTime.Parse(dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[3].Value.ToString().Trim());
            gv.GioiTinh = int.Parse(dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[2].Value.ToString().Trim());
            gv.Email    = dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[4].Value.ToString().Trim();
            gv.VaiTro   = dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[5].Value.ToString().Trim();
            gv.Luong    = float.Parse(dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[6].Value.ToString().Trim());
            gv.BoMonMa  = dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[7].Value.ToString().Trim();
            //  gv.TrangThai = int.Parse(dtgDanhSachGV.Rows[dtgDanhSachGV.CurrentRow.Index].Cells[8].Value.ToString().Trim());
            st = gv.Ma + gv.Ten + gv.GioiTinh + gv.NgaySinh + gv.Email + gv.VaiTro + gv.Luong + gv.BoMonMa;
        }
Example #11
0
        public static List <GiaoVien> DSGiaoVien()
        {
            var lqq = new List <GiaoVien>();
            var cm  = CreateCommand();

            cm.CommandText = @"Select MAND,MANGANH,TENGV,CHUCVU,MAIL,NGAYBDCT from GiaoVien";
            var reader = cm.ExecuteReader();

            while (reader.Read())
            {
                lqq.Add(GiaoVien.ReadGiaoVien(reader));
            }
            cn.Close();
            return(lqq);
        }
Example #12
0
 public static bool AddGV(GiaoVien gv)
 {
     try
     {
         using (var _context = new ManagementTopicStudentEntities())
         {
             _context.GiaoViens.Add(gv);
             _context.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (giaoVien.Quyen == 1)
     {
         // lay dong hien hanh
         int r = dataGridView1.CurrentCell.RowIndex;
         // lấy giao vien
         GiaoVien fv = bALGV.getGVien(dataGridView1.Rows[r].Cells[0].ToString());
         bALGV.Delte(fv);
         MessageBox.Show("Bạn đã xóa thành công");
     }
     else
     {
         MessageBox.Show("Bạn không có quyền chỉnh sửa thông tin giáo viên");
     }
 }
        private void txtMaGV_TextChanged(object sender, EventArgs e)
        {
            int      ma  = int.Parse(txtMaGV.Text.ToString());
            GiaoVien gvv = db.GiaoVien.Where(m => m.maGV == ma).FirstOrDefault();

            if (gvv != null)
            {
                txtTenDangNhap.Enabled = false;
                txtMatKhau.Enabled     = false;
            }
            else
            {
                txtTenDangNhap.Enabled = true;
                txtMatKhau.Enabled     = true;
            }
        }
Example #15
0
 private void datagrid_SelectedCellsChanged(object sender, SelectedCellsChangedEventArgs e)
 {
     if (datagrid.SelectedItem != null)
     {
         try
         {
             object   item = datagrid.SelectedItem;
             GiaoVien gv   = item as GiaoVien;
             txtMaGV.Text        = gv.MaGV;
             txtTenGV.Text       = gv.TenGV;
             cbbLop.SelectedItem = gv.Lop;
         }
         catch (Exception ex)
         { }
     }
 }
        public IHttpActionResult GetById(long id)
        {
            IHttpActionResult httpActionResult;
            GiaoVien          giaoVien = db.GiaoViens.FirstOrDefault(x => x.Id == id);

            if (giaoVien == null)
            {
                err.Add("Không tìm thấy giáo viên");
                httpActionResult = Ok(err);
            }
            else
            {
                httpActionResult = Ok(new GiaoVienModel(giaoVien));
            }
            return(httpActionResult);
        }
Example #17
0
        public ActionResult SuaGV(GiaoVien GV)
        {
            ViewBag.MaMon = new SelectList(db.MonHocs.ToList().OrderBy(n => n.TenMon), "MaMon", "TenMon");
            var gv = db.GiaoViens.SingleOrDefault(n => n.MaGiaoVien == GV.MaGiaoVien);

            // Lưu vào CSDL
            if (ModelState.IsValid)
            {
                gv.TenGiaoVien = GV.TenGiaoVien;
                gv.DiaChi      = GV.DiaChi;
                gv.DienThoai   = GV.DienThoai;
                gv.MaMon       = GV.MaMon;
                db.SubmitChanges();
            }
            return(RedirectToAction("Teacher"));
        }
Example #18
0
        public IHttpActionResult GVTheoId(long id)
        {
            IHttpActionResult httpActionResult;
            GiaoVien          giaoVien = db.GiaoViens.FirstOrDefault(x => x.Id == id);

            if (giaoVien == null)
            {
                err.Add("Không tìm thấy giáo viên");
                httpActionResult = new ErrorActionResult(Request, System.Net.HttpStatusCode.NotFound, err);
            }
            else
            {
                httpActionResult = Ok(new GiaoVienModel(giaoVien));
            }
            return(httpActionResult);
        }
Example #19
0
 public static bool ThemGV(GiaoVien giaovien)
 {
     try
     {
         using (var _context = new DBQuanLyDeAnEntities())
         {
             _context.GiaoViens.Add(giaovien);
             _context.SaveChanges();
             return(true);
         }
     }
     catch
     {
         return(false);
     }
 }
Example #20
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (this.dataGridView1.SelectedRows.Count <= 0)
            {
                MessageBox.Show("Hãy chọn dòng cần xóa!");
                return;
            }

            GiaoVien giaoVien = GiaoVienController.getGV(this.dataGridView1.SelectedRows[0].Cells[0].Value.ToString());

            GiaoVienController.DeleteGV(giaoVien);
            //Hiển thị
            BindingSource source = new BindingSource();

            source.DataSource             = GiaoVienController.GetGV();
            this.dataGridView1.DataSource = source;
        }
Example #21
0
        public void update_gv(GiaoVien gv)
        {
            SqlParameter[] para =
            {
                new SqlParameter("ma",       gv.Ma),
                new SqlParameter("ten",      gv.Ten),
                new SqlParameter("gioitinh", gv.GioiTinh),
                new SqlParameter("ngaysinh", gv.NgaySinh),
                new SqlParameter("email",    gv.Email),
                new SqlParameter("luong",    gv.Luong),
                new SqlParameter("nhiemvu",  gv.NhiemVu),
                new SqlParameter("vaitro",   gv.VaiTro),
                new SqlParameter("bomonma",  gv.BoMonMa),
            };

            da.Query("updateGV", para);
        }
 private void btnOK_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtMKMoi.Text.Trim() == "")
         {
             MessageBox.Show(" Mật khẩu không thể rỗng ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtMKMoi.Text    = "";
             txtConfimMk.Text = "";
             return;
         }
         else if (!GiaoVienController.checkExistGiaoVien(txtTaiKhoan.Text, txtMKCu.Text))
         {
             MessageBox.Show(" Bạn nhập sai mật khẩu cũ hoặc tên đăng nhập không tồn tại", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtMKCu.Text     = "";
             txtMKMoi.Text    = "";
             txtConfimMk.Text = "";
             return;
         }
         else if (txtMKCu.Text == txtMKMoi.Text)
         {
             MessageBox.Show(" Mật khẩu mới trùng mật khẩu cũ", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtMKCu.Text     = "";
             txtMKMoi.Text    = "";
             txtConfimMk.Text = "";
             return;
         }
         else if (txtConfimMk.Text != txtMKMoi.Text)
         {
             MessageBox.Show(" xác nhận mật khẩu mới không trùng khớp với mật khẩu mới", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtConfimMk.Text = "";
             return;
         }
         GiaoVien giaovien1 = new GiaoVien();
         giaovien1.MatKhau  = txtMKMoi.Text;
         giaovien1.MaGV     = giaovien.MaGV;
         giaovien1.HoTen    = giaovien.HoTen;
         giaovien1.GioiTinh = giaovien.GioiTinh;
         giaovien1.SDT      = giaovien.SDT;
         giaovien1.Email    = giaovien.Email;
         giaovien1.DeTais   = GiaoVienController.danhsach(giaovien.MaGV);
         GiaoVienController.UpdateGiaoVien(giaovien1);
         MessageBox.Show("Đổi mật khẩu Thành Công");
     }
     catch { }
 }
        private void cbGiaoVien_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int ma = Convert.ToInt16(cbGiaoVien.SelectedValue.ToString());

                GiaoVienDAL gvDAL = new GiaoVienDAL();
                GiaoVien    gv    = gvDAL.getGiaoVien(ma);
                lbMaGV.Text      = gv.MaGiaoVien.ToString();
                lbName.Text      = gv.HoTen;
                lbChuyenMon.Text = gv.ChuyenMon;
                this.magv        = ma;
            }
            catch
            {
            }
        }
Example #24
0
        public ActionResult GetDiemDanhHocSinh_Ngay(DateTime thoigian, string trangthai, int?Lop)
        {
            List <DiemDanhHocSinh> d      = new List <DiemDanhHocSinh>();
            List <Lop>             lops   = new List <Lop>();
            List <int>             idlops = new List <int>();

            if (User.IsInRole("Giáo viên"))
            {
                string   getid    = User.Identity.GetUserId();
                GiaoVien giaoVien = db.GiaoViens.Find(getid);
                foreach (var item in giaoVien.GiaoVien_Lops.Where(x => x.TrangThai == "Đang phụ trách").ToList())
                {
                    lops.Add(item.Lop1);
                }
            }
            if (User.IsInRole("Quản trị viên"))
            {
                lops = db.Lops.ToList();
            }
            if (Lop.HasValue)
            {
                if (trangthai != null)
                {
                    d = db.DiemDanhHocSinhs.Where(x => x.HocSinh.LopHoc == Lop && x.DenVe.Trim() == trangthai.Trim() && EntityFunctions.TruncateTime(x.ThoiGian) == EntityFunctions.TruncateTime(thoigian)).ToList();
                }
                else
                {
                    d = db.DiemDanhHocSinhs.Where(x => x.HocSinh.LopHoc == Lop && EntityFunctions.TruncateTime(x.ThoiGian) == EntityFunctions.TruncateTime(thoigian)).ToList();
                }
            }
            else
            {
                idlops = lops.Select(x => x.Id).Distinct().ToList();
                if (trangthai != null)
                {
                    d = db.DiemDanhHocSinhs.Where(x => idlops.Contains(x.HocSinh.LopHoc) && x.DenVe.Trim() == trangthai.Trim() && EntityFunctions.TruncateTime(x.ThoiGian) == EntityFunctions.TruncateTime(thoigian)).ToList();
                }
                else
                {
                    d = db.DiemDanhHocSinhs.Where(x => idlops.Contains(x.HocSinh.LopHoc) && EntityFunctions.TruncateTime(x.ThoiGian) == EntityFunctions.TruncateTime(thoigian)).ToList();
                }
            }


            return(View(d));
        }
        private void btnXoa_Click(object sender, EventArgs e)
        {
            int          index  = dgvData.CurrentRow.Index;
            int          magv   = int.Parse(dgvData.Rows[index].Cells[0].Value.ToString());
            GiaoVien     gv     = db.GiaoVien.Where(m => m.maGV == magv).FirstOrDefault();
            DialogResult result = MessageBox.Show("Bạn có muốn xóa giáo viên " + gv.ten, "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
            {
                GiaoVien giaovien = db.GiaoVien.Where(m => m.maGV == gv.maGV).FirstOrDefault();
                giaovien.trangThai = false;
                db.SaveChanges();
                MessageBox.Show("Xóa thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                QuanlyGiaoVien_Load(sender, e);
                return;
            }
        }
Example #26
0
        private void btndangnhap_Click(object sender, EventArgs e)
        {
            GiaoVien gv = new GiaoVien();

            gv.username = txttk.Text.Trim();
            gv.pass     = txtmk.Text.Trim();
            if (GiaoVienController.DangNhap(gv) == null)
            {
                MessageBox.Show("Vui long kiem tra tai khoan va mat khau");
                return;
            }
            gv = GiaoVienController.DangNhap(gv);
            frmMain mf = new frmMain(gv.IDGiaoVien, (int)gv.ad);

            mf.Show();
            this.Hide();
        }
Example #27
0
        public void Them(GiaoVien themGiaoVien)
        {
            XmlNode    teacher = doc.CreateElement("teacher");
            XmlElement Mgv     = doc.CreateElement("MGV");

            Mgv.InnerText = themGiaoVien.Mgv.ToString();
            teacher.AppendChild(Mgv);

            XmlElement ten = doc.CreateElement("Ten");

            ten.InnerText = themGiaoVien.Hoten;
            teacher.AppendChild(ten);

            XmlElement ngaysinh = doc.CreateElement("NgaySinh");

            ngaysinh.InnerText = themGiaoVien.Ngaysinh;
            teacher.AppendChild(ngaysinh);

            XmlElement gioitinh = doc.CreateElement("GioiTinh");

            gioitinh.InnerText = themGiaoVien.Gioitinh;
            teacher.AppendChild(gioitinh);

            XmlElement que = doc.CreateElement("Que");

            que.InnerText = themGiaoVien.Que;
            teacher.AppendChild(que);

            XmlElement diachi = doc.CreateElement("DiaChi");

            diachi.InnerText = themGiaoVien.Diachi;
            teacher.AppendChild(diachi);

            XmlElement email = doc.CreateElement("Email");

            email.InnerText = themGiaoVien.Email;
            teacher.AppendChild(email);

            XmlElement sdt = doc.CreateElement("SDT");

            sdt.InnerText = themGiaoVien.Sdt;
            teacher.AppendChild(sdt);
            //tạo xong nút user thêm vào gốc
            goc.AppendChild(teacher);
            doc.Save(fileName);
        }
Example #28
0
 public fGiaovien(GiaoVien obj)
 {
     InitializeComponent();
     bindingSourceGiaovien.DataSource = obj;
     if (ckbNam.CheckState == CheckState.Checked)
     {
         ckbNam.Text = "Nam";
     }
     else if (ckbNam.CheckState == CheckState.Unchecked)
     {
         ckbNam.Text = "Nữ";
     }
     else
     {
         ckbNam.Text = "???";
     }
 }
Example #29
0
        private void GiaoVien_Load(object sender, EventArgs e)
        {
            dgvData.Rows.Clear();

            cbbGVDay.DataSource    = db.GiaoVien.Where(m => m.trangThai == true).ToList();
            cbbGVDay.ValueMember   = "maGV";
            cbbGVDay.DisplayMember = "ten";

            cbbHocKy.DataSource    = db.HocKy.ToList();
            cbbHocKy.DisplayMember = "tenHK";
            cbbHocKy.ValueMember   = "maHK";

            cbbLop.DataSource    = db.Lop.ToList();
            cbbLop.DisplayMember = "tenLop";
            cbbLop.ValueMember   = "maLop";

            cbbLop.SelectedIndex   = -1;
            cbbHocKy.SelectedIndex = -1;
            cbbGVDay.SelectedIndex = -1;

            cbbGVDay.SelectedText = "Chọn giáo viên dạy";
            cbbHocKy.SelectedText = "Chọn học kỳ";
            cbbLop.SelectedText   = "Chọn lớp";

            if (db.Mon.Count() > 0)
            {
                txtMaMonHoc.Text = (db.Mon.Select(m => m.maMon).Max() + 1).ToString();
            }
            else
            {
                txtMaMonHoc.Text = "1";
            }
            txtMaMonHoc.Enabled = false;
            txtTenMonHoc.Text   = "";

            List <Mon> list = db.Mon.Where(m => m.trangThai == true).ToList();

            foreach (Mon i in list)
            {
                HocKy    hk = db.HocKy.Where(m => m.maHK == i.maHK).FirstOrDefault();
                GiaoVien gv = db.GiaoVien.Where(m => m.maGV == i.gvDay).FirstOrDefault();
                Lop      l  = db.Lop.Where(m => m.maLop == i.maLop).FirstOrDefault();
                dgvData.Rows.Add(i.maMon, i.tenMon, gv.ten, hk.tenHK, l.tenLop, l.nam);
            }
        }
Example #30
0
 private void TTCaNhan_Load(object sender, EventArgs e)
 {
     dtpNgaySinh.Text = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString();
     hs = this.Tag as HocSinh;
     gv = this.Tag as GiaoVien;
     if (hs != null)
     {
         lbTaiKhoan.Text     = hs.taiKhoan.ToString();
         lbTenNguoiDung.Text = hs.ten;
         lbGioiTinh.Text     = hs.gioiTinh;
         if (hs.gioiTinh == "Nam")
         {
             rdbNam.Checked = true;
         }
         else
         {
             rdbNu.Checked = true;
         }
         lbDiaChi.Text          = hs.diaChi;
         lbSDT.Text             = "0" + hs.sdt.ToString();
         lbBangCap.Visible      = false;
         lbTieDeBangCap.Visible = false;
         txtBanCap.Visible      = false;
     }
     else
     {
         lbTaiKhoan.Text     = gv.taiKhoan;
         lbTenNguoiDung.Text = gv.ten;
         lbGioiTinh.Text     = gv.gioiTinh;
         if (gv.gioiTinh == "Nam")
         {
             rdbNam.Checked = true;
         }
         else
         {
             rdbNu.Checked = true;
         }
         lbDiaChi.Text          = gv.diaChi;
         lbSDT.Text             = "0" + gv.sdt.ToString();
         lbBangCap.Visible      = true;
         lbTieDeBangCap.Visible = true;
         txtBanCap.Visible      = true;
         lbBangCap.Text         = gv.bangCap;
     }
 }
        public GiaoVien[] getListGiaoVienTheoBoMon(string bomon)
        {
            DataTable table = da.Query("select gv.*,"
                                       + " bm.ten as BoMonTen from GiaoVien gv inner join Bomon bm on gv.Bomonma  = bm.ma where (bm.Ten LIKE N'%" + bomon + "%' OR '" + bomon + "' = '')");
            int n = table.Rows.Count;
            int i;

            if (n == 0)
            {
                return(new GiaoVien[0]);
            }
            GiaoVien[] list = new GiaoVien[n];
            for (i = 0; i < n; i++)
            {
                list[i] = getGiaoVien(table.Rows[i]);
            }
            return(list);
        }
        private void dgvTeacher_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvTeacher.CurrentCell.ColumnIndex != 0)
            {
                return;
            }
            this.currentIDGV = Int32.Parse(dgvTeacher.CurrentRow.Cells[0].Value.ToString());
            GiaoVien task = GiaoVienController.GetGV(this.currentIDGV);

            this.txtEmail.Text        = task.Email.Trim();
            this.txtName.Text         = task.HoTen.Trim();
            this.Birthday.Value       = DateTime.Parse(task.NgaySinh.ToString());
            this.txtSDT.Text          = task.SDT.Trim();
            this.cbBomon.SelectedItem = task.BoMon.Trim();
            this.cbSex.SelectedItem   = task.GioiTinh.Trim();
            this.txtusername.Text     = task.username.Trim();
            this.txtpass.Text         = task.pass.Trim();
        }
        private void dgvLopMon_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int numrow = e.RowIndex;

            if (dgvLopMon.Rows[numrow].Cells[4].Value.ToString() != "")
            {
                int maGV = Convert.ToInt32(dgvLopMon.Rows[numrow].Cells[4].Value.ToString());
                cbGiaoVien.SelectedValue = maGV;
                GiaoVienDAL gvDAL = new GiaoVienDAL();
                GiaoVien    gv    = gvDAL.getGiaoVien(maGV);
                lbMaGV.Text      = gv.MaGiaoVien.ToString();
                lbName.Text      = gv.HoTen;
                lbChuyenMon.Text = gv.ChuyenMon;
            }
            //textBox1.Text = dgvLopMon.Rows[numrow].Cells[0].Value.ToString();
            this.mamon = Convert.ToInt16(dgvLopMon.Rows[numrow].Cells[2].Value.ToString());
            this.malop = Convert.ToInt16(dgvLopMon.Rows[numrow].Cells[0].Value.ToString());
        }
Example #34
0
 public bool ThemGV(GiaoVien gv)
 {
     SqlParameter[] paraGV =
     {
         new SqlParameter("ten",      gv.Ten),
         new SqlParameter("gioitinh", gv.GioiTinh),
         new SqlParameter("ngaysinh", gv.NgaySinh),
         new SqlParameter("email",    gv.Email),
         // new SqlParameter("anh" , gv.Anh),
         new SqlParameter("luong",    gv.Luong),
         new SqlParameter("nhiemvu",  gv.NhiemVu),
         new SqlParameter("vaitro",   gv.VaiTro),
         new SqlParameter("bomonma",  gv.BoMonMa),
         // new SqlParameter("trangthai" , gv.TrangThai)
     };
     da.Query("proc_insertGV", paraGV);
     return(true);
 }
Example #35
0
 public DataTable LayLopHocTheoKhoi_GV(KhoiLop kl, GiaoVien gv){
     return kn.GetLopTheoKhoi_GV(kl.MaKhoi,gv.MaGV);
 }
Example #36
0
 public DataTable LayLopHocTheoGV(GiaoVien gv)
 {
     return kn.GetDanhSachLopDay(gv.MaGV);
 }
Example #37
0
 public static GiaoVien CreateGiaoVien(int maGiaoVien)
 {
     GiaoVien giaoVien = new GiaoVien();
     giaoVien.MaGiaoVien = maGiaoVien;
     return giaoVien;
 }
Example #38
0
 public void AddToGiaoViens(GiaoVien giaoVien)
 {
     base.AddObject("GiaoViens", giaoVien);
 }