コード例 #1
0
ファイル: TrangThaiDAL.cs プロジェクト: cobaohieu/TrainManage
        public bool deleteTrangThai(Entities.tblTrangThai tt)
        {
            bool   check = false;
            string sql   = "sp_tblTrangThai_Delete";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@id", SqlDbType.Int).Value = tt.Id;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
コード例 #2
0
ファイル: TrangThaiDAL.cs プロジェクト: cobaohieu/TrainManage
        public bool insertTrangThai(Entities.tblTrangThai tt)
        {
            bool   check = false;
            string sql   = "sp_tblTrangThai_Insert";

            try
            {
                con = ds.getConnect();
                cmd = new SqlCommand(sql, con);
                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = sql;
                cmd.Connection  = con;
                cmd.Parameters.Add("@matrangthai", SqlDbType.NVarChar).Value  = tt.Matrangthai;
                cmd.Parameters.Add("@tentrangthai", SqlDbType.NVarChar).Value = tt.Tentrangthai;
                cmd.ExecuteNonQuery();
                check = true;
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            finally
            {
                cmd.Dispose();
                con.Close();
            }
            return(check);
        }
コード例 #3
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblID.Text, out _ID))
     {
     }
     if (CheckObject())
     {
         Entities.tblTrangThai kh = new Entities.tblTrangThai();
         kh.Id           = _ID;
         kh.Matrangthai  = txtMaTrangThai.Text;
         kh.Tentrangthai = txtTenTrangThai.Text;
         if (flag == "add")
         {
             bool check = bllTrangThai.insertTrangThai(kh);
             if (check)
             {
                 MessageBox.Show("Thêm thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "update")
         {
             bool check = bllTrangThai.updateTrangThai(kh);
             if (check)
             {
                 MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         else if (flag == "delete")
         {
             bool check = bllTrangThai.deleteTrangThai(kh);
             if (check)
             {
                 MessageBox.Show("Xóa thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             ReLoad();
         }
         ReLoad();
         dgvTrangThai_SelectionChanged(sender, e);
     }
 }
コード例 #4
0
 public bool deleteTrangThai(Entities.tblTrangThai tt)
 {
     return(dal.deleteTrangThai(tt));
 }
コード例 #5
0
 public bool updateTrangThai(Entities.tblTrangThai tt)
 {
     return(dal.updateTrangThai(tt));
 }
コード例 #6
0
 public bool insertTrangThai(Entities.tblTrangThai tt)
 {
     return(dal.insertTrangThai(tt));
 }
コード例 #7
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (int.TryParse(lblIdTrangThai.Text, out _Idtt))
     {
     }
     if (int.TryParse(lblsiso.Text, out _ss))
     {
     }
     if (int.TryParse(lblidtaikhoan.Text, out _Idtk))
     {
     }
     if (int.TryParse(lblidchuongtrinh.Text, out _Idct))
     {
     }
     if (int.TryParse(lblmakhoa.Text, out _Idkh))
     {
     }
     if (int.TryParse(lblidtinchi.Text, out _Idtc))
     {
     }
     if (int.TryParse(lblidsinhvien.Text, out _Idsv))
     {
     }
     if (int.TryParse(lblidnienkhoa.Text, out _Idnk))
     {
     }
     if (int.TryParse(lblidmonhoc.Text, out _Idmh))
     {
     }
     if (int.TryParse(lblidketqua.Text, out _Idkq))
     {
     }
     if (int.TryParse(lblIdLop.Text, out _Idlp))
     {
     }
     if (int.TryParse(lblIdHocKy.Text, out _Idhk))
     {
     }
     if (int.TryParse(lblidnhom.Text, out _Idnh))
     {
     }
     if (float.TryParse(lbldiemthilan1.Text, out dtl1))
     {
     }
     if (float.TryParse(lbldiemthilan2.Text, out dtl2))
     {
     }
     if (float.TryParse(lbldiemtongket.Text, out dtk))
     {
     }
     if (float.TryParse(lbldiemtrungbinh.Text, out dtb))
     {
     }
     if (DateTime.TryParse(lblnamsinh.Text, out _ns))
     {
     }
     Entities.tblTrangThai tt = new Entities.tblTrangThai();
     tt.Id           = _Idtt;
     tt.Matrangthai  = lblmatrangthai.Text;
     tt.Tentrangthai = cbTenTrangThai.Text;
     Entities.tblChuongTrinh ct = new Entities.tblChuongTrinh();
     ct.Id             = _Idct;
     ct.Idtrangthai    = _Idtt;
     ct.Machuongtrinh  = lblmachuongtrinh.Text;
     ct.Tenchuongtrinh = cbTenChuongTrinh.Text;
     Entities.tblMonHoc mh = new Entities.tblMonHoc();
     mh.Id            = _Idmh;
     mh.Idchuongtrinh = _Idct;
     mh.Idhocky       = _Idhk;
     mh.Idtinchi      = _Idtc;
     mh.Mamonhoc      = lblmamonhoc.Text;
     mh.Tenmonhoc     = lbltenmonhoc.Text;
     Entities.tblLop lp = new Entities.tblLop();
     lp.Id     = _Idlp;
     lp.Idkhoa = _Idkh;
     lp.Malop  = lblmalop.Text;
     lp.Tenlop = cbTenLop.Text;
     lp.Siso   = _ss;
     Entities.tblSinhVien sv = new Entities.tblSinhVien();
     sv.Id          = _Idsv;
     sv.Idlop       = _Idlp;
     sv.Idtaikhoan  = _Idtk;
     sv.Idtrangthai = _Idtt;
     Entities.tblKetQua kq = new Entities.tblKetQua();
     kq.Id            = _Idkq;
     kq.Idsinhvien    = _Idsv;
     kq.Idmonhoc      = _Idmh;
     kq.Diemthilan1   = dtl1;
     kq.Diemthilan2   = dtl2;
     kq.Diemtrungbinh = dtb;
     kq.Diemtongket   = dtk;
     kq.Hanhkiem      = lblhanhkiem.Text;
     kq.Ghichu        = lblghichu.Text;
     Entities.tblTaiKhoan tk = new Entities.tblTaiKhoan();
     tk.Id          = _Idtk;
     tk.Idnhom      = _Idnh;
     tk.Tentaikhoan = lbltentaikhoan.Text;
     tk.Matkhau     = lblmatkhau.Text;
     tk.Hoten       = cbHoTen.Text;
     tk.Namsinh     = _ns;
     tk.Gioitinh    = lblgioitinh.Text;
     tk.Diachi      = lbldiachi.Text;
     tk.Email       = lblemail.Text;
     tk.Dienthoai   = lbldienthoai.Text;
     Entities.tblHocKy hk = new Entities.tblHocKy();
     hk.Id       = _Idhk;
     hk.Mahocky  = lblmahocky.Text;
     hk.Tenhocky = cbTenHocKy.Text;
     Entities.tblKhoa kh = new Entities.tblKhoa();
     kh.Id      = _Idkh;
     kh.Makhoa  = lblmakhoa.Text;
     kh.Tenkhoa = cbTenKhoa.Text;
     if (flag == "update")
     {
         bool check = bllTaiKhoan.updateTaiKhoan(tk);
         bllSinhVien.updateSinhVien(sv);
         bllChuongTrinh.updateChuongTrinh(ct);
         bllTrangThai.updateTrangThai(tt);
         //bllLop.updateLop(lp);
         //bllKhoa.updateKhoa(kh);
         //bllKetQua.updateKetQua(kq);
         //bllMonHoc.updateMonHoc(mh);
         //bllHocKy.updateHocKy(hk);
         if (check)
         {
             MessageBox.Show("Cập nhật thành công.", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         ReLoad();
     }
     ReLoad();
     dgvTrangThaiSV_SelectionChanged(sender, e);
 }