示例#1
0
        public void Xoa(PhongBanEntity pb)
        {
            KetNoiCSDL.MoKetNoi();
            string     sql = @"DELETE tblPhongBan WHERE MaPB=@MaPB";
            SqlCommand cmd = new SqlCommand(sql, KetNoiCSDL.connect);

            cmd.Parameters.AddWithValue("@MaPB", pb.MaPB);
            cmd.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
 public int UpdateData(PhongBanEntity pb)
 {
     SqlParameter[] para =
     {
         new SqlParameter("MaPB",   pb.MaPB),
         new SqlParameter("TenPB",  pb.TenPB),
         new SqlParameter("MaTP",   pb.MaTP),
         new SqlParameter("DiaChi", pb.DiaChi),
         new SqlParameter("Sdt",    pb.Sdt)
     };
     return(conn.ExcuteSQL("Sua_PB ", para));
 }
示例#3
0
        public void Sua(PhongBanEntity pb)
        {
            KetNoiCSDL.MoKetNoi();
            string     themhd = @"UPDATE tblPhongBan SET TenPB =@TenPB, DiaDiem =@DiaDiem, SDT =@SDT Where MaPB=@MaPB";
            SqlCommand cdm    = new SqlCommand(themhd, KetNoiCSDL.connect);

            // cdm.CommandType = CommandType.StoredProcedure;
            cdm.Parameters.AddWithValue("@MaPB", pb.MaPB);
            cdm.Parameters.AddWithValue("@TenPB", pb.TenPB);
            cdm.Parameters.AddWithValue("@DiaDiem", pb.DiaDiem);
            cdm.Parameters.AddWithValue("@SDT", pb.SDT);

            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
示例#4
0
        public void Them(PhongBanEntity pb)
        {
            KetNoiCSDL.MoKetNoi();
            string     themhd = @"INSERT INTO tblPhongBan (MaPB, TenPB, DiaDiem, SDT) VALUES(@MaPB,@TenPB,@DiaDiem,@SDT)";
            SqlCommand cdm    = new SqlCommand(themhd, KetNoiCSDL.connect);

            // cdm.CommandType = CommandType.StoredProcedure;
            cdm.Parameters.AddWithValue("@MaPB", pb.MaPB);
            cdm.Parameters.AddWithValue("@TenPB", pb.TenPB);
            cdm.Parameters.AddWithValue("@DiaDiem", pb.DiaDiem);
            cdm.Parameters.AddWithValue("@SDT", pb.SDT);

            cdm.ExecuteNonQuery();
            KetNoiCSDL.DongKetNoi();
        }
 public int UpdateData(PhongBanEntity Pb)
 {
     return(da.UpdateData(Pb));
 }
 public int InsertData(PhongBanEntity Pb)
 {
     return(da.InsertData(Pb));
 }