csdl.aspx

public List<Advertise> Advertise_GetById(string Id)

  {

  List<Data.Advertise> list = new List<Data.Advertise>();

  using (SqlCommand dbCmd = new SqlCommand("sp_Advertise_GetById", GetConnection()))

  {

Data.Advertise obj = new Data.Advertise();

dbCmd.CommandType = CommandType.StoredProcedure;

dbCmd.Parameters.Add(new SqlParameter("@Id", Id));

  SqlDataReader dr = dbCmd.ExecuteReader();

if (dr.HasRows)

  {

while (dr.Read())

{

  list.Add(obj.AdvertiseIDataReader(dr));

  }

}

dr.Close();

obj = null;

  }

  return list;

  }

public DataTable Advertise_GetById_DataTable(string Id)

  {

  using (SqlCommand dbCmd = new SqlCommand("sp_Advertise_GetById", GetConnection()))

{

dbCmd.CommandType = CommandType.StoredProcedure;

dbCmd.Parameters.Add(new SqlParameter("@Id", Id));

  return GetData(dbCmd);

  }

  }

public bool Advertise_Insert(Advertise data)

 {

using (SqlCommand dbCmd = new SqlCommand("sp_Advertise_Insert", GetConnection()))

 {

 dbCmd.CommandType = CommandType.StoredProcedure;

dbCmd.Parameters.Add(new SqlParameter("@Name", data.Name));

 dbCmd.Parameters.Add(new SqlParameter("@Image", data.Image));

 dbCmd.Parameters.Add(new SqlParameter("@Width", data.Width));

 dbCmd.Parameters.Add(new SqlParameter("@Height", data.Height));

dbCmd.Parameters.Add(new SqlParameter("@Link", data.Link));

 dbCmd.Parameters.Add(new SqlParameter("@Target", data.Target));

dbCmd.Parameters.Add(new SqlParameter("@Content", data.Content));

  dbCmd.Parameters.Add(new SqlParameter("@Position", data.Position));

 dbCmd.Parameters.Add(new SqlParameter("@PageId", data.PageId == "" || data.PageId == "0" ? DBNull.Value : (object)data.PageId));

  dbCmd.Parameters.Add(new SqlParameter("@Click", data.Click));

 dbCmd.Parameters.Add(new SqlParameter("@Ord", data.Ord));

dbCmd.Parameters.Add(new SqlParameter("@Active", data.Active));

dbCmd.Parameters.Add(new SqlParameter("@Lang", data.Lang));

 dbCmd.ExecuteNonQuery();

}

 System.Web.HttpContext.Current.Cache.Remove("Advertise");

return true;

        }

public List<Advertise> Advertise_Paging(string CurentPage, string PageSize, string Lang)

{

List<Data.Advertise> list = new List<Data.Advertise>();

using (SqlCommand dbCmd = new SqlCommand("sp_Advertise_Paging", GetConnection()))

 {

Data.Advertise obj = new Data.Advertise();

dbCmd.CommandType = CommandType.StoredProcedure;

dbCmd.Parameters.Add(new SqlParameter("@CurentPage", CurentPage));

 dbCmd.Parameters.Add(new SqlParameter("@PageSize", PageSize));

dbCmd.Parameters.Add(new SqlParameter("@Lang", Lang));

 SqlDataReader dr = dbCmd.ExecuteReader();

 if (dr.HasRows)

{

while (dr.Read())

 {

 list.Add(obj.AdvertiseIDataReader(dr));

 }

 }

dr.Close();

obj = null;

}

 return list;

 }

Bạn đang đọc truyện trên: AzTruyen.Top

Tags: