public static TaiLieu Update(TaiLieu Updated) { TaiLieu Item = new TaiLieu(); SqlParameter[] obj = new SqlParameter[19]; obj[0] = new SqlParameter("TL_ID", Updated.ID); obj[1] = new SqlParameter("TL_Ten", Updated.Ten); obj[2] = new SqlParameter("TL_ThuTu", Updated.ThuTu); obj[3] = new SqlParameter("TL_DM_ID", Updated.DM_ID); obj[4] = new SqlParameter("TL_DM_Ten", Updated.DM_Ten); obj[5] = new SqlParameter("TL_Url", Updated.Url); obj[6] = new SqlParameter("TL_RowId", Updated.RowId); obj[7] = new SqlParameter("TL_NguoiTao", Updated.NguoiTao); obj[8] = new SqlParameter("TL_NgayTao", Updated.NgayTao); obj[9] = new SqlParameter("TL_NguoiCapNhat", Updated.NguoiCapNhat); obj[10] = new SqlParameter("TL_NgayCapNhat", Updated.NgayCapNhat); obj[11] = new SqlParameter("TL_Draff", Updated.Draff); obj[12] = new SqlParameter("TL_Views", Updated.Views); obj[13] = new SqlParameter("TL_TacGia", Updated.TacGia); obj[14] = new SqlParameter("TL_NhaXuatBan", Updated.NhaXuatBan); obj[15] = new SqlParameter("TL_KichThuoc", Updated.KichThuoc); obj[16] = new SqlParameter("TL_NgonNgu", Updated.NgonNgu); obj[17] = new SqlParameter("TL_GiaBan", Updated.GiaBan); obj[18] = new SqlParameter("TL_Anh", Updated.Anh); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieu_Update_UpdateNormal_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static TaiLieu SelectById(Int32 TL_ID) { TaiLieu Item = new TaiLieu(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("TL_ID", TL_ID); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieu_Select_SelectById_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static TaiLieu SelectByIdView(Int32 VBD_ID) { TaiLieu Item = new TaiLieu(); SqlParameter[] obj = new SqlParameter[1]; obj[0] = new SqlParameter("TL_ID", VBD_ID); List <Files> filelist = new List <Files>(); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieu_Select_SelectByIdView_linhnx", obj)) { while (rd.Read()) { Item = getFromReader(rd); Files item = new Files(); if (rd.FieldExists("F_Ten")) { item.Ten = (String)(rd["F_Ten"]); } if (rd.FieldExists("F_ID")) { item.ID = (Int32)(rd["F_ID"]); } if (rd.FieldExists("F_NguoiTao")) { item.NguoiTao = (String)(rd["F_NguoiTao"]); } if (rd.FieldExists("F_Size")) { item.Size = (Int32)(rd["F_Size"]); } if (rd.FieldExists("F_MimeType")) { item.MimeType = (String)(rd["F_MimeType"]); } if (rd.FieldExists("F_Download")) { item.Download = (Int32)(rd["F_Download"]); } filelist.Add(item); } } Item.Filelist = filelist; return(Item); }
public static TaiLieu InsertDraff(TaiLieu Inserted) { TaiLieu Item = new TaiLieu(); SqlParameter[] obj = new SqlParameter[5]; obj[0] = new SqlParameter("TL_RowId", Inserted.RowId); obj[1] = new SqlParameter("TL_NguoiTao", Inserted.NguoiTao); obj[2] = new SqlParameter("TL_NguoiCapNhat", Inserted.NguoiCapNhat); obj[3] = new SqlParameter("TL_NgayTao", Inserted.NgayTao); obj[4] = new SqlParameter("TL_NgayCapNhat", Inserted.NgayCapNhat); using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblTaiLieu_Insert_InsertDraff_hungpm", obj)) { while (rd.Read()) { Item = getFromReader(rd); } } return(Item); }
public static TaiLieu getFromReader(IDataReader rd) { TaiLieu Item = new TaiLieu(); if (rd.FieldExists("TL_ID")) { Item.ID = (Int32)(rd["TL_ID"]); } if (rd.FieldExists("TL_Ten")) { Item.Ten = (String)(rd["TL_Ten"]); } if (rd.FieldExists("TL_Anh")) { Item.Anh = (String)(rd["TL_Anh"]); } if (rd.FieldExists("TL_ThuTu")) { Item.ThuTu = (Int32)(rd["TL_ThuTu"]); } if (rd.FieldExists("TL_DM_ID")) { Item.DM_ID = (Int32)(rd["TL_DM_ID"]); } if (rd.FieldExists("TL_DM_Ten")) { Item.DM_Ten = (String)(rd["TL_DM_Ten"]); } if (rd.FieldExists("TL_Url")) { Item.Url = (String)(rd["TL_Url"]); } if (rd.FieldExists("TL_RowId")) { Item.RowId = (Guid)(rd["TL_RowId"]); } if (rd.FieldExists("TL_NguoiTao")) { Item.NguoiTao = (String)(rd["TL_NguoiTao"]); } if (rd.FieldExists("TL_NgayTao")) { Item.NgayTao = (DateTime)(rd["TL_NgayTao"]); } if (rd.FieldExists("TL_NguoiCapNhat")) { Item.NguoiCapNhat = (String)(rd["TL_NguoiCapNhat"]); } if (rd.FieldExists("TL_NgayCapNhat")) { Item.NgayCapNhat = (DateTime)(rd["TL_NgayCapNhat"]); } if (rd.FieldExists("TL_TacGia")) { Item.TacGia = (String)(rd["TL_TacGia"]); } if (rd.FieldExists("TL_NhaXuatBan")) { Item.NhaXuatBan = (String)(rd["TL_NhaXuatBan"]); } if (rd.FieldExists("TL_NgonNgu")) { Item.NgonNgu = (String)(rd["TL_NgonNgu"]); } if (rd.FieldExists("TL_GiaBan")) { Item.GiaBan = (String)(rd["TL_GiaBan"]); } if (rd.FieldExists("TL_KichThuoc")) { Item.KichThuoc = (String)(rd["TL_KichThuoc"]); } if (rd.FieldExists("TL_Views")) { Item.Views = (Int32)(rd["TL_Views"]); } return(Item); }