private Link ReceiveHtml() { int thumb_w = Convert.ToInt32(txtLinkWidth.Text); int thumb_h = Convert.ToInt32(txtLinkHeight.Text); string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Link/"; commonBSO commonBSO = new commonBSO(); string image_thumb = commonBSO.UploadImage(file_image_thumb, path, thumb_w, thumb_h); Link link = new Link(); link.LinkID = (hddLinkID.Value != "") ? Convert.ToInt32(hddLinkID.Value) : 0; link.LinkUrl = txtLinkUrl.Text; link.LinkImage = (image_thumb != "") ? image_thumb : hddLinkImageThumb.Value; link.LinkWidth = Convert.ToInt32(txtLinkWidth.Text); link.LinkHeight = Convert.ToInt32(txtLinkHeight.Text); link.LinkType = 1; link.LinkStatus = Convert.ToBoolean(rdbLinkStatus.SelectedValue); return link; }
public void CreateLink(Link link) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_LinkUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@LinkID", 0); command.Parameters.AddWithValue("@LinkUrl", link.LinkUrl); command.Parameters.AddWithValue("@LinkImage", link.LinkImage); command.Parameters.AddWithValue("@LinkWidth", link.LinkWidth); command.Parameters.AddWithValue("@LinkHeight", link.LinkHeight); command.Parameters.AddWithValue("@LinkStatus", link.LinkStatus); command.Parameters.AddWithValue("@LinkType", link.LinkType); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Khong them duoc quang cao"); } command.Dispose(); } }
public void CreateLink(Link link) { new LinkDAO().CreateLink(link); }
public void UpdateLink(Link link) { new LinkDAO().UpdateLink(link); }