public static TaiLieuVanBan getFromReader(IDataReader rd) { TaiLieuVanBan Item = new TaiLieuVanBan(); if (rd.FieldExists("TLVB_ID")) { Item.ID = (Int32)(rd["TLVB_ID"]); } if (rd.FieldExists("TLVB_VB_ID")) { Item.VB_ID = (Int32)(rd["TLVB_VB_ID"]); } if (rd.FieldExists("TLVB_Ten")) { Item.Ten = (String)(rd["TLVB_Ten"]); } if (rd.FieldExists("TLVB_Loai")) { Item.Loai = (Int32)(rd["TLVB_Loai"]); } if (rd.FieldExists("TLVB_NgayTao")) { Item.NgayTao = (DateTime)(rd["TLVB_NgayTao"]); } if (rd.FieldExists("TLVB_NguoiTao")) { Item.NguoiTao = (String)(rd["TLVB_NguoiTao"]); } if (rd.FieldExists("TLVB_RowId")) { Item.RowId = (Guid)(rd["TLVB_RowId"]); } return(Item); }
public static TaiLieuVanBan SelectById(Int32 TLVB_ID) { TaiLieuVanBan Item = new TaiLieuVanBan(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("TLVB_ID", TLVB_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieuVanBan_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static TaiLieuVanBan Insert(TaiLieuVanBan Inserted) { TaiLieuVanBan Item = new TaiLieuVanBan(); SqlParameter[] obj = new SqlParameter[6]; obj[0] = new SqlParameter("TLVB_VB_ID", Inserted.VB_ID); obj[1] = new SqlParameter("TLVB_Ten", Inserted.Ten); obj[2] = new SqlParameter("TLVB_Loai", Inserted.Loai); obj[3] = new SqlParameter("TLVB_NgayTao", Inserted.NgayTao); obj[4] = new SqlParameter("TLVB_NguoiTao", Inserted.NguoiTao); obj[5] = new SqlParameter("TLVB_RowId", Inserted.RowId); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieuVanBan_Insert_InsertNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }