public string Advertise() { string list_Advertise = ""; try { if (Application["appAdvertiset"] == null) { DataSet ds = new AdvertiseSystem().AdvertiseSelectAllShow(); if (ds.Tables.Count > 0) { int num = ds.Tables[0].Rows.Count; for (int i = 0; i < num; i++) { string image = ds.Tables[0].Rows[i]["urlImage"].ToString(); string[] array = image.Split('.'); if (array[1].Equals("swf")) { list_Advertise += "<object width='175'><embed src='image/advertise/" + image + "' width='160' height='86' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object><br />"; } else { list_Advertise += "<a href='" + ds.Tables[0].Rows[i]["link"].ToString() + "' title='" + ds.Tables[0].Rows[i]["title"].ToString() + "' target='_blank'><img src='image/advertise/" + image + "' class='imga'/></a><br />"; } } Application["appAdvertiset"] = list_Advertise; } } else { list_Advertise = Application["appAdvertiset"].ToString(); } } catch { list_Advertise=""; } return list_Advertise; }
public string GetAdvertiseSpecial() { string advertise = ""; try { DataSet dsAdvertise = new AdvertiseSystem().SpecialSelectWhere("where idBrand=0 and type=1"); int num = dsAdvertise.Tables[0].Rows.Count; if (num > 0) { advertise = "<table border=0 width='100%' cellpadding='0' cellspacing='0'>"; for (int i = 0; i < num; i++) { advertise += "<tr><td align='center' width='574'>"; string img2 = dsAdvertise.Tables[0].Rows[i]["UrlImage2"].ToString(); if (img2.Length > 0) { string[] extension = img2.Split('.'); if (extension[1].Equals("swf")) { advertise += "<object width='574' height='90'><embed src='image/advertise/" + img2 + "' width='574' height='90' quality='high' scale='noscale' wmode='transparent' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>"; } else { advertise += "<a href='" + dsAdvertise.Tables[0].Rows[i]["link"].ToString() + "'><img src='image/advertise/" + img2 + "' border='0'/></a>"; } } advertise += "</td></tr>"; advertise += "<tr><td height='7'></td></tr>"; } advertise += "<tr><td height='7'></td></tr>"; advertise += "</table>"; } } catch { advertise = ""; } return advertise; }
protected void btadd_ServerClick(object sender, EventArgs e) { try { string title = txttitle.Value.Trim(); int idBrand = int.Parse(slBrand.Value); content = Request.Form["txtContent"].ToString().Trim(); string link = txtlink.Value.Trim(); string Url1 = nameurl1; string Url2 = nameurl2; int sort = int.Parse(slsort.Value.ToString().Trim()); if (title.Length > 0) { DateTime time = new DateTime(); time = DateTime.Now; CvalidateImageForPost manageImage = new CvalidateImageForPost(); AdvertiseSystem Advertise = new AdvertiseSystem(); if (ImageArticle1.PostedFile.FileName.Length > 0) { Url1 = "special_1" + time.Ticks + "." + manageImage.GetExtension(ImageArticle1.PostedFile.FileName); } if (ImageArticle2.PostedFile.FileName.Length > 0) { Url2 = "special_2" + time.Ticks + "." + manageImage.GetExtension(ImageArticle2.PostedFile.FileName); } Boolean test = Advertise.SpecialUpdate(id, idBrand, title, content, Url1, Url2, link, sort); if (test) { diverror.Visible = true; diverror.InnerHtml = "Quảng cáo đặc biệt đã được chỉnh sửa"; string path = Server.MapPath("../image/advertise/"); if (ImageArticle1.PostedFile.FileName.Length > 0) { if (manageImage.TestTypeFile(ImageArticle1)) { if (manageImage.TestMaxSizeImage(ImageArticle1, 84280)) { diverror.InnerHtml += "<br />Ảnh nhỏ không quá 70KB"; } else { manageImage.UploadFile_server(ImageArticle1, path + Url1); manageImage.DeleteFile(path + nameurl1); urlOld1 = "../image/advertise/" + Url1; } } else { diverror.InnerHtml += "<br />Chỉ hỗ trợ file dạng: gif, png, jpg, bmp, swf"; } } if (ImageArticle2.PostedFile.FileName.Length > 0) { if (manageImage.TestTypeFile(ImageArticle2)) { if (manageImage.TestMaxSizeImage(ImageArticle2, 122880)) { diverror.InnerHtml += "<br />Ảnh to không quá 120KB"; } else { manageImage.UploadFile_server(ImageArticle2, path + Url2); manageImage.DeleteFile(path + nameurl2); urlOld2 = "../image/advertise/" + Url2; } } else { diverror.InnerHtml += "<br />Chỉ hỗ trợ file dạng: gif, png, jpg, bmp, swf"; } } } else { diverror.Visible = true; diverror.InnerHtml = "Lỗi kết nối, xin hãy thử lại"; } } else { diverror.Visible = true; diverror.InnerHtml = "Xin hãy nhập tiêu đề"; } } catch { diverror.Visible = true; diverror.InnerHtml = "Xin hãy nhập tiêu đề"; } }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["id"] != null) { try { id = int.Parse(Request.QueryString["id"].ToString()); DataSet dsAdvertise = new AdvertiseSystem().SpecialSelectId(id); if (dsAdvertise.Tables.Count > 0 && dsAdvertise.Tables[0].Rows.Count > 0) { txttitle.Value = dsAdvertise.Tables[0].Rows[0]["title"].ToString(); content = dsAdvertise.Tables[0].Rows[0]["content"].ToString(); txtlink.Value = dsAdvertise.Tables[0].Rows[0]["link"].ToString(); idbrand = dsAdvertise.Tables[0].Rows[0]["idbrand"].ToString(); sort = dsAdvertise.Tables[0].Rows[0]["sort"].ToString(); nameurl1 = dsAdvertise.Tables[0].Rows[0]["urlimage1"].ToString(); nameurl2 = dsAdvertise.Tables[0].Rows[0]["urlimage2"].ToString(); if (nameurl1.Length > 0) { urlOld1 = "../image/advertise/" + nameurl1; } else { urlOld1 = "../image/common/notimgpro.png"; } if (nameurl2.Length > 0) { urlOld2 = "../image/advertise/" + nameurl2; } else { urlOld2 = "../image/common/notimgpro.png"; } } } catch { Response.Redirect("?menu=advertisespecial"); } } if (!IsPostBack) { //Adbrand: try { BrandProduct_data dsBrand = new BrandProductSystem().BrandProAllType(int.Parse(Application["idtypeproduct"].ToString())); ListItem Item = new ListItem("Chọn nhãn hiệu", "0"); slBrand.Items.Add(Item); if (dsBrand.Tables.Count > 0 && dsBrand.Tables[0].Rows.Count > 0) { int num = dsBrand.Tables[0].Rows.Count; for (int i = 0; i < num; i++) { Item = new ListItem(dsBrand.Tables[0].Rows[i]["name"].ToString(), dsBrand.Tables[0].Rows[i]["id"].ToString()); slBrand.Items.Add(Item); if (idbrand == dsBrand.Tables[0].Rows[i]["id"].ToString()) { slBrand.Items[i + 1].Selected = true; } } } Item = new ListItem("1", "1"); slsort.Items.Add(Item); for (int i = 2; i <= 14; i++) { Item = new ListItem(i + "", i + ""); slsort.Items.Add(Item); if (i + "" == sort) { slsort.Items[i - 1].Selected = true; } } } catch { } } }
private string GetAdvertiseWithBrand(string idBrand) { string str = ""; try { DataSet dsAdvertise = new AdvertiseSystem().SpecialIdbrandTop(idBrand,2); int num = dsAdvertise.Tables[0].Rows.Count; if (num > 0) { for (int i = 0; i < num; i++) { string img2 = dsAdvertise.Tables[0].Rows[i]["UrlImage1"].ToString(); if (img2.Length > 0) { string[] extension = img2.Split('.'); if (extension[1].Equals("swf")) { str += "<object width='574' height='90'><embed src='image/advertise/" + img2 + "' width='574' height='90' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object><br /><br />"; } else { str += "<a href='" + dsAdvertise.Tables[0].Rows[0]["link"].ToString() + "'><img src='image/advertise/" + img2 + "' width='574' height='90' border='0'/></a><br />"; } } } } } catch { } return str; }
protected void Page_Load(object sender, EventArgs e) { try { string menu=Request.QueryString["menu"].ToString(); string strmobile=""; switch (menu) { case ("imgpro"): { try { string id = Request.QueryString["id"].ToString(); string name = Request.QueryString["name"].ToString(); string namepro = Request.QueryString["namepro"].ToString(); string subName = ""; int leng = namepro.Length; for (int i = 0; i < leng; i++) { if(namepro[i].Equals('(')) break; if(!namepro[i].Equals(',')) { subName += namepro[i]; } } subName = subName.Trim(); Session["SSIdProUpload"] = id + "," + name + "," + subName; } catch { } Response.Write("ok"); break; } case ("bestsell"): { string strreturn = ""; try { string type=Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); ProductBestSellSystem products = new ProductBestSellSystem(); Boolean test = products.ProductBestUpdate(int.Parse(id), int.Parse(type)); if (!test) { strreturn = "err"; } else { //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll(); //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table]; } } catch { strreturn = "err"; } Response.Write(strreturn); } break; case ("justhave"): { string strreturn = ""; try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); ProductBestSellSystem products = new ProductBestSellSystem(); Boolean test = products.ProductJustHaveUpdate(int.Parse(id), int.Parse(type)); if (!test) { strreturn = "err"; } else { //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll(); //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table]; } } catch { strreturn = "err"; } Response.Write(strreturn); } break; //prepare out: case ("prepareout"): { string PrepareStr = ""; try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); ProductBestSellSystem products = new ProductBestSellSystem(); Boolean test = products.ProductPrepareoutUpdate(int.Parse(id), int.Parse(type)); if (!test) { PrepareStr = "err"; } else { //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll(); //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table]; } } catch { PrepareStr = "err"; } Response.Write(PrepareStr); } break; //proselloff: case ("proselloff"): { string strselloff = ""; try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); float price = float.Parse(Request.QueryString["price"].ToString()); ProductBestSellSystem products = new ProductBestSellSystem(); Boolean test = products.ProductSelloffUpdate(int.Parse(id), int.Parse(type),price); if (!test) { strselloff = "err"; } else { //ProductMainPage_data ds = new ProductBestSellSystem().ProductBestSellAll(); //Application["appProductBestsell"] = ds.Tables[ProductMainPage_data._table]; } } catch { strselloff = "err"; } Response.Write(strselloff); } break; case ("mainpage"): string strmain = ""; try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); string sort = Request.QueryString["sort"].ToString(); ProductMainPageSystem products = new ProductMainPageSystem(); Boolean test = products.ProductMainpageUpdate(int.Parse(id), int.Parse(type),int.Parse(sort)); if (!test) { strmain = "err"; } } catch { strmain = "err"; } Response.Write(strmain); break; case ("original"): string stroriginal = ""; try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); string sort = Request.QueryString["sort"].ToString(); ProductMainPageSystem products = new ProductMainPageSystem(); Boolean test = products.ProductOriginalUpdate(int.Parse(id), int.Parse(type), int.Parse(sort)); if (!test) { stroriginal = "err"; } } catch { strmain = "err"; } Response.Write(stroriginal); break; case ("dgroup"): string strdelete = ""; try { string id=Request.QueryString["id"].ToString(); ArticleManagerSystem Articles = new ArticleManagerSystem(); if (Articles.AdminGroupDeleteId(id)) { strdelete = "1"; } else { strdelete = "0"; } }catch { strdelete = "0"; } Response.Write(strdelete); break; case ("dgcontact"): string strdcontact = ""; try { string id = Request.QueryString["id"].ToString(); ContacstSystem Contacts = new ContacstSystem(); if (Contacts.GroupContactDeleteId(id)) { strdcontact = "1"; } else { strdcontact = "0"; } } catch { strdcontact = "0"; } Response.Write(strdcontact); break; case ("dglocation"): string strdlocation = ""; try { string id = Request.QueryString["id"].ToString(); ContacstSystem Contacts = new ContacstSystem(); if (Contacts.LocationContactDelete(id)) { strdlocation = "1"; } else { strdlocation = "0"; } } catch { strdlocation = "0"; } Response.Write(strdlocation); break; case ("dhelp"): string strdhelp = "0"; try { string id = Request.QueryString["id"].ToString(); HelpsSystem helps = new HelpsSystem(); if (helps.HelpsDelete(id)) { strdhelp = "1"; } } catch { strdhelp = "0"; } Response.Write(strdhelp); break; case ("donline"): string stronline = "0"; try { string id = Request.QueryString["id"].ToString(); SupportOnlineSystem Support = new SupportOnlineSystem(); if (Support.OnlineDelete(id)) { stronline = "1"; Application["appOnline"] = null; } } catch { stronline = "0"; } Response.Write(stronline); break; case ("dadvertise"): string strdadvertise = "0"; try { string id = Request.QueryString["id"].ToString(); AdvertiseSystem advertise = new AdvertiseSystem(); DataSet ds = advertise.AdvertiseSelectId(id); if (ds.Tables[0].Rows.Count > 0) { string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString(); string path = Server.MapPath("../image/advertise/"); CvalidateImageForPost manageImage = new CvalidateImageForPost(); if (url1.Length > 0) { manageImage.DeleteFile(path + url1); } } if (advertise.AdvertiseDelete(id)) { strdadvertise = "1"; Application["appAdvertiset"] = null; } } catch { strdadvertise = "0"; } Response.Write(strdadvertise); break; case ("dadvertisespecial"): string strspecial = "0"; try { string id = Request.QueryString["id"].ToString(); AdvertiseSystem advertise = new AdvertiseSystem(); DataSet ds = advertise.SpecialSelectId(int.Parse(id)); if (ds.Tables[0].Rows.Count > 0) { string url1 = ds.Tables[0].Rows[0]["urlimage1"].ToString(); string url2 = ds.Tables[0].Rows[0]["urlimage2"].ToString(); string path = Server.MapPath("../image/advertise/"); CvalidateImageForPost manageImage = new CvalidateImageForPost(); if (url1.Length > 0) { manageImage.DeleteFile(path + url1); } if (url2.Length > 0) { manageImage.DeleteFile(path + url2); } } if (advertise.SpecialDelete(id)) { strspecial = "1"; } } catch { strspecial = "0"; } Response.Write(strspecial); break; case "darticle": string strdarticle = "0"; try { string id = Request.QueryString["id"].ToString(); ArticleManagerSystem article = new ArticleManagerSystem(); DataSet ds = article.ArticleSelectDetail(int.Parse(id)); if (ds.Tables[0].Rows.Count > 0) { string url1 = ds.Tables[0].Rows[0]["urlimage"].ToString(); string path = Server.MapPath("../image/img_article/"); CvalidateImageForPost manageImage = new CvalidateImageForPost(); if (url1.Length > 0) { manageImage.DeleteFile(path + url1); } } if (article.AdminArticleDelete(id)) { strdarticle = "1"; } } catch { strdarticle = "0"; } Response.Write(strdarticle); break; //for mobile: case "mobile1": try { string type = Request.QueryString["type"].ToString(); string id = Request.QueryString["id"].ToString(); string sort = Request.QueryString["sort"].ToString(); string insert = Request.QueryString["insert"].ToString(); Mobilesystem Mobile = new Mobilesystem(); Boolean test = Mobile.MobileUpdate(int.Parse(id), int.Parse(insert), int.Parse(type), int.Parse(sort)); if (!test) { strmobile= "err"; } } catch { strmobile = "err"; } Response.Write(strmobile); break; } } catch { } }