/// <summary> /// updates the specified Ads /// </summary> /// <param name="obj">Ads</param> /// <returns></returns> public void Update(Ads obj) { SqlHelper.ExecuteNonQuery(Data.ConnectionString, CommandType.StoredProcedure, "sproc_Ads_Update" , Data.CreateParameter("Id", obj.Id) , Data.CreateParameter("Name", obj.Name) , Data.CreateParameter("Image", obj.Image) , Data.CreateParameter("Link", obj.Link) , Data.CreateParameter("Location", obj.Location) , Data.CreateParameter("Type", obj.Type) , Data.CreateParameter("Width", obj.Width) , Data.CreateParameter("Height", obj.Height) , Data.CreateParameter("Status", obj.Status) , Data.CreateParameter("Item", obj.Item) ); }
/// <summary> /// /// </summary> /// <returns></returns> public Ads Populate(IDataReader myReader) { Ads obj = new Ads(); obj.Id = (int)myReader["Id"]; obj.Name = (string)myReader["Name"]; obj.Image = (string)myReader["Image"]; obj.Link = (string)myReader["Link"]; obj.Location = (string)myReader["Location"]; obj.Type = (string)myReader["Type"]; obj.Width = (int)myReader["Width"]; obj.Height = (int)myReader["Height"]; obj.View = (int)myReader["View"]; obj.Status = (bool)myReader["Status"]; obj.Item = (int)myReader["Item"]; return(obj); }
/// <summary> /// Add a new Ads within Ads database table /// </summary> /// <param name="obj">Ads</param> /// <returns>key of table</returns> public int Add(Ads obj) { DbParameter parameterItemID = Data.CreateParameter("Id", obj.Id); parameterItemID.Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(Data.ConnectionString, CommandType.StoredProcedure, "sproc_Ads_Add" , parameterItemID , Data.CreateParameter("Name", obj.Name) , Data.CreateParameter("Image", obj.Image) , Data.CreateParameter("Link", obj.Link) , Data.CreateParameter("Location", obj.Location) , Data.CreateParameter("Type", obj.Type) , Data.CreateParameter("Width", obj.Width) , Data.CreateParameter("Height", obj.Height) , Data.CreateParameter("View", obj.View) , Data.CreateParameter("Status", obj.Status) , Data.CreateParameter("Item", obj.Item) ); return((int)parameterItemID.Value); }