示例#1
0
        public static Nhom SelectById(Int32 N_ID)
        {
            Nhom Item = new Nhom();

            SqlParameter[] obj = new SqlParameter[1];
            obj[0] = new SqlParameter("N_ID", N_ID);
            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssNhom_Select_SelectById_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#2
0
        public static Nhom getFromReader(IDataReader rd)
        {
            Nhom Item = new Nhom();

            docbao.entitites.DanhMuc _Item = docbao.entitites.DanhMucDal.getFromReader(rd);
            Item._DanhMuc = _Item;
            if (rd.FieldExists("N_ID"))
            {
                Item.ID = (Int32)(rd["N_ID"]);
            }
            if (rd.FieldExists("N_DM_ID"))
            {
                Item.DM_ID = (Int32)(rd["N_DM_ID"]);
            }
            if (rd.FieldExists("N_Ten"))
            {
                Item.Ten = (String)(rd["N_Ten"]);
            }
            if (rd.FieldExists("N_ThuTu"))
            {
                Item.ThuTu = (Int32)(rd["N_ThuTu"]);
            }
            if (rd.FieldExists("N_Active"))
            {
                Item.Active = (Boolean)(rd["N_Active"]);
            }
            if (rd.FieldExists("N_Hot"))
            {
                Item.Hot = (Boolean)(rd["N_Hot"]);
            }
            if (rd.FieldExists("N_Hot1"))
            {
                Item.Hot1 = (Boolean)(rd["N_Hot1"]);
            }
            if (rd.FieldExists("N_Hot2"))
            {
                Item.Hot2 = (Boolean)(rd["N_Hot2"]);
            }
            if (rd.FieldExists("N_Hot3"))
            {
                Item.Hot3 = (Boolean)(rd["N_Hot3"]);
            }
            return(Item);
        }
示例#3
0
        public static Nhom Insert(Nhom Inserted)
        {
            Nhom Item = new Nhom();

            SqlParameter[] obj = new SqlParameter[8];
            obj[0] = new SqlParameter("N_DM_ID", Inserted.DM_ID);
            obj[1] = new SqlParameter("N_Ten", Inserted.Ten);
            obj[2] = new SqlParameter("N_ThuTu", Inserted.ThuTu);
            obj[3] = new SqlParameter("N_Active", Inserted.Active);
            obj[4] = new SqlParameter("N_Hot", Inserted.Hot);
            obj[5] = new SqlParameter("N_Hot1", Inserted.Hot1);
            obj[6] = new SqlParameter("N_Hot2", Inserted.Hot2);
            obj[7] = new SqlParameter("N_Hot3", Inserted.Hot3);

            using (IDataReader rd = SqlHelper.ExecuteReader(DAL.con(), CommandType.StoredProcedure, "tblRss_sp_tblRssNhom_Insert_InsertNormal_linhnx", obj))
            {
                while (rd.Read())
                {
                    Item = getFromReader(rd);
                }
            }
            return(Item);
        }
示例#4
0
        public static Nhom Update(Int32?id, Int32?dm_id, String ten, Int32?thutu, Boolean?active, Boolean?hot, Boolean?hot1, Boolean?hot2, Boolean?hot3)
        {
            Nhom Item = new Nhom();

            SqlParameter[] obj = new SqlParameter[9];
            if (id != null)
            {
                obj[0] = new SqlParameter("N_ID", id);
            }
            else
            {
                obj[0] = new SqlParameter("N_ID", DBNull.Value);
            }
            if (dm_id != null)
            {
                obj[1] = new SqlParameter("N_DM_ID", dm_id);
            }
            else
            {
                obj[1] = new SqlParameter("N_DM_ID", DBNull.Value);
            }
            if (ten != null)
            {
                obj[2] = new SqlParameter("N_Ten", ten);
            }
            else
            {
                obj[2] = new SqlParameter("N_Ten", DBNull.Value);
            }
            if (thutu != null)
            {
                obj[3] = new SqlParameter("N_ThuTu", thutu);
            }
            else
            {
                obj[3] = new SqlParameter("N_ThuTu", DBNull.Value);
            }
            if (active != null)
            {
                obj[4] = new SqlParameter("N_Active", active);
            }
            else
            {
                obj[4] = new SqlParameter("N_Active", DBNull.Value);
            }
            if (hot != null)
            {
                obj[5] = new SqlParameter("N_Hot", hot);
            }
            else
            {
                obj[5] = new SqlParameter("N_Hot", DBNull.Value);
            }
            if (hot1 != null)
            {
                obj[6] = new SqlParameter("N_Hot1", hot1);
            }
            else
            {
                obj[6] = new SqlParameter("N_Hot1", DBNull.Value);
            }
            if (hot2 != null)
            {
                obj[7] = new SqlParameter("N_Hot2", hot2);
            }
            else
            {
                obj[7] = new SqlParameter("N_Hot2", DBNull.Value);
            }
            if (hot3 != null)
            {
                obj[8] = new SqlParameter("N_Hot3", hot3);
            }
            else
            {
                obj[8] = new SqlParameter("N_Hot3", DBNull.Value);
            }

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