Exemplo n.º 1
0
        public static Adv Update(Adv Updated)
        {
            Adv Item = new Adv();

            SqlParameter[] obj = new SqlParameter[11];
            obj[0]  = new SqlParameter("A_ID", Updated.ID);
            obj[1]  = new SqlParameter("A_Loai", Updated.Loai);
            obj[2]  = new SqlParameter("A_Ten", Updated.Ten);
            obj[3]  = new SqlParameter("A_NoiDung", Updated.NoiDung);
            obj[4]  = new SqlParameter("A_MaViTri", Updated.MaViTri);
            obj[5]  = new SqlParameter("A_ThuTu", Updated.ThuTu);
            obj[6]  = new SqlParameter("A_Active", Updated.Active);
            obj[7]  = new SqlParameter("A_Files", Updated.Files);
            obj[8]  = new SqlParameter("A_FilesMime", Updated.FilesMime);
            obj[9]  = new SqlParameter("A_Urls", Updated.Urls);
            obj[10] = new SqlParameter("A_Clicks", Updated.Clicks);

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

            if (rd.FieldExists("A_ID"))
            {
                Item.ID = (Int32)(rd["A_ID"]);
            }
            if (rd.FieldExists("A_Loai"))
            {
                Item.Loai = (Int32)(rd["A_Loai"]);
            }
            if (rd.FieldExists("A_Ten"))
            {
                Item.Ten = (String)(rd["A_Ten"]);
            }
            if (rd.FieldExists("A_NoiDung"))
            {
                Item.NoiDung = (String)(rd["A_NoiDung"]);
            }
            if (rd.FieldExists("A_MaViTri"))
            {
                Item.MaViTri = (String)(rd["A_MaViTri"]);
            }
            if (rd.FieldExists("A_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["A_ThuTu"]);
            }
            if (rd.FieldExists("A_Active"))
            {
                Item.Active = (Boolean)(rd["A_Active"]);
            }
            if (rd.FieldExists("A_Files"))
            {
                Item.Files = (String)(rd["A_Files"]);
            }
            if (rd.FieldExists("A_FilesMime"))
            {
                Item.FilesMime = (String)(rd["A_FilesMime"]);
            }
            if (rd.FieldExists("A_Urls"))
            {
                Item.Urls = (String)(rd["A_Urls"]);
            }
            if (rd.FieldExists("A_Clicks"))
            {
                Item.Clicks = (Int32)(rd["A_Clicks"]);
            }
            return(Item);
        }
Exemplo n.º 3
0
        public static Adv SelectById(Int32 A_ID)
        {
            Adv Item = new Adv();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("A_ID", A_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssAdv_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
Exemplo n.º 4
0
        public static Adv Update(Int32?id, Int32?loai, String ten, String noidung, String mavitri, Int32?thutu, Boolean?active, String files, String filesmime, String urls, Int32?clicks)
        {
            Adv Item = new Adv();

            SqlParameter[] obj = new SqlParameter[11];
            if (id != null)
            {
                obj[0] = new SqlParameter("A_ID", id);
            }
            else
            {
                obj[0] = new SqlParameter("A_ID", DBNull.Value);
            }
            if (loai != null)
            {
                obj[1] = new SqlParameter("A_Loai", loai);
            }
            else
            {
                obj[1] = new SqlParameter("A_Loai", DBNull.Value);
            }
            if (ten != null)
            {
                obj[2] = new SqlParameter("A_Ten", ten);
            }
            else
            {
                obj[2] = new SqlParameter("A_Ten", DBNull.Value);
            }
            if (noidung != null)
            {
                obj[3] = new SqlParameter("A_NoiDung", noidung);
            }
            else
            {
                obj[3] = new SqlParameter("A_NoiDung", DBNull.Value);
            }
            if (mavitri != null)
            {
                obj[4] = new SqlParameter("A_MaViTri", mavitri);
            }
            else
            {
                obj[4] = new SqlParameter("A_MaViTri", DBNull.Value);
            }
            if (thutu != null)
            {
                obj[5] = new SqlParameter("A_ThuTu", thutu);
            }
            else
            {
                obj[5] = new SqlParameter("A_ThuTu", DBNull.Value);
            }
            if (active != null)
            {
                obj[6] = new SqlParameter("A_Active", active);
            }
            else
            {
                obj[6] = new SqlParameter("A_Active", DBNull.Value);
            }
            if (files != null)
            {
                obj[7] = new SqlParameter("A_Files", files);
            }
            else
            {
                obj[7] = new SqlParameter("A_Files", DBNull.Value);
            }
            if (filesmime != null)
            {
                obj[8] = new SqlParameter("A_FilesMime", filesmime);
            }
            else
            {
                obj[8] = new SqlParameter("A_FilesMime", DBNull.Value);
            }
            if (urls != null)
            {
                obj[9] = new SqlParameter("A_Urls", urls);
            }
            else
            {
                obj[9] = new SqlParameter("A_Urls", DBNull.Value);
            }
            if (clicks != null)
            {
                obj[10] = new SqlParameter("A_Clicks", clicks);
            }
            else
            {
                obj[10] = new SqlParameter("A_Clicks", DBNull.Value);
            }

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssAdv_Update_UpdateNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }