private Adv ReceiveHtml() { int thumb_w = Convert.ToInt32(txtAdvWidth.Text); int thumb_h = Convert.ToInt32(txtAdvHeight.Text); string path = Request.PhysicalApplicationPath.Replace(@"\", "/") + "/Upload/Advertising/"; commonBSO commonBSO = new commonBSO(); string image_thumb = commonBSO.UploadImage(file_image_thumb, path, thumb_w, thumb_h); Adv adv = new Adv(); adv.AdvID = (hddAdvID.Value != "") ? Convert.ToInt32(hddAdvID.Value) : 0; adv.AdvUrl = txtAdvUrl.Text; adv.AdvImage = (image_thumb != "") ? image_thumb : hddAdvImageThumb.Value; adv.AdvWidth = Convert.ToInt32(txtAdvWidth.Text); adv.AdvHeight = Convert.ToInt32(txtAdvHeight.Text); adv.AdvPostDate = DateTime.Now; adv.AdvEndDate = DateTime.Now; adv.AdvStatus = Convert.ToBoolean(rdbAdvStatus.SelectedValue); return adv; }
public void CreateAdv(Adv adv) { using (SqlConnection connection = base.GetConnection()) { SqlCommand command = new SqlCommand("_AdvUpdate", connection) { CommandType = CommandType.StoredProcedure }; command.Parameters.AddWithValue("@Type", 0); command.Parameters.AddWithValue("@AdvID", 0); command.Parameters.AddWithValue("@AdvUrl", adv.AdvUrl); command.Parameters.AddWithValue("@AdvImage", adv.AdvImage); command.Parameters.AddWithValue("@AdvWidth", adv.AdvWidth); command.Parameters.AddWithValue("@AdvHeight", adv.AdvHeight); command.Parameters.AddWithValue("@AdvPostDate", adv.AdvPostDate); command.Parameters.AddWithValue("@AdvEndDate", adv.AdvEndDate); command.Parameters.AddWithValue("@AdvStatus", adv.AdvStatus); connection.Open(); if (command.ExecuteNonQuery() <= 0) { throw new DataAccessException("Khong them duoc quang cao"); } command.Dispose(); } }
public void CreateAdv(Adv adv) { new AdvDAO().CreateAdv(adv); }
public void UpdateAdv(Adv adv) { new AdvDAO().UpdateAdv(adv); }