Ejemplo n.º 1
0
 public static bool Update(BEL_LoaiDocGia LoaiDocGia)
 {
     try
     {
         GetConnection();
         string     Query   = string.Format("update LOAIDOCGIA set TenLoai = N'{0}' where MaLoai = '{1}'", LoaiDocGia.Ten, LoaiDocGia.Ma);
         SqlCommand Command = new SqlCommand(Query, Connection);
         int        Result  = Command.ExecuteNonQuery();
         return(Result == 1);
     }
     catch (Exception Err)
     {
         throw;
     }
     finally
     {
         Connection.Close();
     }
 }
Ejemplo n.º 2
0
 public static bool Add(BEL_LoaiDocGia LoaiDocGia)
 {
     try
     {
         GetConnection();
         string     Query   = string.Format("insert into LOAIDOCGIA(MaLoai, TenLoai, TrangThai) values('{0}', N'{1}', N'{2}')", LoaiDocGia.Ma, LoaiDocGia.Ten, LoaiDocGia.TrangThai);
         SqlCommand Command = new SqlCommand(Query, Connection);
         int        Result  = Command.ExecuteNonQuery();
         return(Result == 1);
     }
     catch (Exception Err)
     {
         throw;
     }
     finally
     {
         Connection.Close();
     }
 }
Ejemplo n.º 3
0
 public static bool Update(BEL_LoaiDocGia LoaiDocGia)
 {
     if (LoaiDocGia.Ma == "")
     {
         throw new Exception("Mã loại không được rỗng!");
     }
     if (LoaiDocGia.Ten == "")
     {
         throw new Exception("Tên loại không được rỗng!");
     }
     if (LoaiDocGia.TrangThai == "")
     {
         throw new Exception("Trạng thái không được rỗng!");
     }
     try
     {
         return(DAL_LoaiDocGia.Update(LoaiDocGia));
     }
     catch (Exception Err)
     {
         throw;
     }
 }
Ejemplo n.º 4
0
 public static BEL_LoaiDocGia GetObjectById(string Id)
 {
     try
     {
         GetConnection();
         string        Query      = string.Format("select* from LOAIDOCGIA where MaLoai = '{0}'", Id);
         SqlCommand    Command    = new SqlCommand(Query, Connection);
         SqlDataReader DataReader = Command.ExecuteReader();
         DataReader.Read();
         string         MaLoai     = (string)DataReader["MaLoai"];
         string         TenLoai    = (string)DataReader["TenLoai"];
         string         TrangThai  = (string)DataReader["TrangThai"];
         BEL_LoaiDocGia LoaiDocGia = new BEL_LoaiDocGia(MaLoai, TenLoai, TrangThai);
         return(LoaiDocGia);
     }
     catch (Exception Err)
     {
         throw;
     }
     finally
     {
         Connection.Close();
     }
 }
Ejemplo n.º 5
0
 public BEL_LoaiDocGia(BEL_LoaiDocGia LoaiDocGia)
 {
     _Ma        = LoaiDocGia._Ma;
     _Ten       = LoaiDocGia._Ten;
     _TrangThai = LoaiDocGia._TrangThai;
 }