Exemplo n.º 1
0
        public static Thuvien Insert(Thuvien Inserted)
        {
            Thuvien Item = new Thuvien();

            SqlParameter[] obj = new SqlParameter[13];
            obj[0]  = new SqlParameter("TV_Ten", Inserted.Ten);
            obj[1]  = new SqlParameter("TV_Mota", Inserted.Mota);
            obj[2]  = new SqlParameter("TV_Keyword", Inserted.Keyword);
            obj[3]  = new SqlParameter("TV_UrlImage", Inserted.UrlImage);
            obj[4]  = new SqlParameter("TV_Url", Inserted.Url);
            obj[5]  = new SqlParameter("TV_Thutu", Inserted.Thutu);
            obj[6]  = new SqlParameter("TV_Loai", Inserted.Loai);
            obj[7]  = new SqlParameter("TV_Ngaytao", Inserted.Ngaytao);
            obj[8]  = new SqlParameter("TV_Active", Inserted.Active);
            obj[9]  = new SqlParameter("TV_RowId", Inserted.RowId);
            obj[10] = new SqlParameter("TV_CateID", Inserted.CateID);
            obj[11] = new SqlParameter("TV_NguoiTao", Inserted.NguoiTao);
            obj[12] = new SqlParameter("TV_GH_ID", Inserted.GH_ID);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblThuvien_Insert_InsertNormal_dtm", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Exemplo n.º 2
0
        public static Thuvien SelectById(Int32 TV_ID)
        {
            Thuvien Item = new Thuvien();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("TV_ID", TV_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "sp_tblThuvien_Select_SelectById_dtm", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Exemplo n.º 3
0
        public static Thuvien getFromReader(IDataReader rd)
        {
            Thuvien Item = new Thuvien();

            if (rd.FieldExists("TV_ID"))
            {
                Item.ID = (Int32)(rd["TV_ID"]);
            }
            if (rd.FieldExists("TV_GH_ID"))
            {
                Item.GH_ID = (Int32)(rd["TV_GH_ID"]);
            }
            if (rd.FieldExists("TV_Ten"))
            {
                Item.Ten = (String)(rd["TV_Ten"]);
            }
            if (rd.FieldExists("TV_Mota"))
            {
                Item.Mota = (String)(rd["TV_Mota"]);
            }
            if (rd.FieldExists("TV_Keyword"))
            {
                Item.Keyword = (String)(rd["TV_Keyword"]);
            }
            if (rd.FieldExists("TV_UrlImage"))
            {
                Item.UrlImage = (String)(rd["TV_UrlImage"]);
            }
            if (rd.FieldExists("TV_Url"))
            {
                Item.Url = (String)(rd["TV_Url"]);
            }
            if (rd.FieldExists("TV_Thutu"))
            {
                Item.Thutu = (Int16)(rd["TV_Thutu"]);
            }
            if (rd.FieldExists("TV_Loai"))
            {
                Item.Loai = (Int16)(rd["TV_Loai"]);
            }
            if (rd.FieldExists("TV_Ngaytao"))
            {
                Item.Ngaytao = (DateTime)(rd["TV_Ngaytao"]);
            }
            if (rd.FieldExists("TV_Active"))
            {
                Item.Active = (Boolean)(rd["TV_Active"]);
            }
            if (rd.FieldExists("TV_RowId"))
            {
                Item.RowId = (Guid)(rd["TV_RowId"]);
            }
            if (rd.FieldExists("TV_CateID"))
            {
                Item.CateID = (Int16)(rd["TV_CateID"]);
            }
            if (rd.FieldExists("TV_NguoiTao"))
            {
                Item.NguoiTao = (String)(rd["TV_NguoiTao"]);
            }
            return(Item);
        }