public void GetNewHaveAll() { try { DataSet ds = new ProductMainPageSystem().OriginalSelectTop(); DataTable table = ds.Tables[0]; int numPro = table.Rows.Count; titlePage = string.Format(titlePage, "<u>" + numPro + "</u>"); if (numPro > 0) { Boolean iseven = true; strProMain = "<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; string id = ""; string name = ""; string url = ""; string price = ""; string warranty = ""; float rate = (float)Application["ratepromain"]; float price1 = 1; string price2 = ""; for (int i = 0; i < numPro; i++) { id = table.Rows[i][ProductMainPage_data._id].ToString(); name = table.Rows[i][ProductMainPage_data._name].ToString() + " " + table.Rows[i][ProductMainPage_data._state].ToString(); url = table.Rows[i][ProductMainPage_data._urlImage].ToString(); string namepro = table.Rows[i][ProductMainPage_data._name].ToString(); namepro = namepro.Replace("/", ""); namepro = namepro.Replace("#", ""); if (url.Length > 0) { url = "image/img_pro/" + url; } else { url = "image/common/notimgpro.png"; } price2 = table.Rows[i][ProductMainPage_data._price].ToString(); price1 = float.Parse(table.Rows[i][ProductMainPage_data._price].ToString()); price1 = price1 * rate; price = price1.ToString("N").Split('.')[0]; warranty = table.Rows[i][ProductMainPage_data._WarrantyMonth].ToString(); if (iseven) { strProMain += "<tr><td width='278'>"; strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; strProMain += "<tr><td rowspan='2' width='88' align='center' valign='top'>"; if (table.Rows[i][ProductMainPage_data._ispromotion].ToString().Length > 0) { strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />"; } strProMain += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>"; strProMain += "<td class='text_title' valign='top'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>"; strProMain += "<tr><td valign='middle' width='190' height='48'>" + tprice + ": <span class='price'>"; if (price.Equals("0")) { strProMain += tupdate + "</span><br />"; } else { if (unitPrice.Equals("$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + "</span><br />"; } else if (unitPrice.Equals("$$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + " USD</span><br />"; } else { strProMain += price + " " + unitPrice + "</span><br />"; } } strProMain += "<span class='tvat'>" + strMVAT + "</span><br />"; strProMain += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>"; strProMain += "</td></tr>"; //strProMain += "<tr><td colspan='2' height='32' align='center'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>"; strProMain += "</table></td>"; strProMain += "<td class='bg_line4'></td>"; iseven = false; if (i + 1 == numPro) { strProMain += "<td></td></tr>"; } } else { strProMain += "<td width='278'>"; strProMain += "<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; strProMain += "<tr><td rowspan='2' width='88' align='center' valign='top'>"; if (table.Rows[i][ProductMainPage_data._ispromotion].ToString().Length > 0) { strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />"; } strProMain += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img1' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>"; strProMain += "<td class='text_title' valign='top'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></td></tr>"; strProMain += "<tr><td valign='middle' width='190' height='48'>" + tprice + ": <span class='price'>"; if (price.Equals("0")) { strProMain += tupdate + "</span><br />"; } else { if (unitPrice.Equals("$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + "</span><br />"; } else if (unitPrice.Equals("$$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + " USD</span><br />"; } else { strProMain += price + " " + unitPrice + "</span><br />"; } } strProMain += "<span class='tvat'>" + strMVAT + "</span><br />"; strProMain += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>"; strProMain += "</td></tr>"; strProMain += "</table></td></tr>"; if (i + 1 < numPro) { strProMain += "<tr><td class='bg_line3'></td><td></td><td class='bg_line3'></td></tr>"; } iseven = true; } } strProMain += "</table>"; } } catch (Exception ex) { Console.Write(ex.ToString()); strProMain = ""; } }
private void GetProductMainPage1() { try { DataSet ds = new ProductMainPageSystem().MainPageSelectAll(); DataTable table = ds.Tables[0]; int numPro = table.Rows.Count; if (numPro > 0) { GetBestView(ds.Tables[1]); //GetmainpocketPc(ds.Tables[2]); currentAccess += GetListMessage(ds.Tables[2]); //currentAccess = "<marquee scrolldelay='120' width='580' onmouseout='start();' onmouseover='stop();'>" + currentAccess + ", " + currentAccess + "</marquee>"; strProMain = "<table cellpadding='0' cellspacing='0' border='1' width='100%'>"; string id = ""; string name = ""; string url = ""; string price = ""; string warranty = ""; float rate = (float)Application["ratepromain"]; float price1 = 1; string price2 = ""; string madein = ""; string isSpec = ""; for (int i = 0; i < numPro; i++) { id = table.Rows[i][ProductMainPage_data._id].ToString(); name = table.Rows[i][ProductMainPage_data._name].ToString() + " " + table.Rows[i][ProductMainPage_data._state].ToString(); url = table.Rows[i][ProductMainPage_data._urlImage].ToString(); if (url.Length > 0) { url = "image/img_pro/" + url; } else { url = "image/common/notimgpro.png"; } price2 = table.Rows[i][ProductMainPage_data._price].ToString(); price1 = float.Parse(table.Rows[i][ProductMainPage_data._price].ToString()); price1 = price1 * rate; price = price1.ToString("N").Split('.')[0]; warranty = table.Rows[i][ProductMainPage_data._WarrantyMonth].ToString(); madein = table.Rows[i][ProductMainPage_data._shortnote].ToString(); isSpec = table.Rows[i][ProductMainPage_data._isspec].ToString(); string namepro = table.Rows[i][ProductMainPage_data._name].ToString(); namepro = namepro.Replace("/", ""); namepro = namepro.Replace("#", ""); namepro = namepro.Replace(":", ""); namepro = namepro.Replace("\"", ""); if (isSpec.Equals("1")) { strProMain += "<tr>";//Có thể cho màu nền khác nếu cần.... } else { strProMain += "<tr>"; } strProMain += "<td align='center'>"; if (table.Rows[i][ProductMainPage_data._ispromotion].ToString().Length > 0) { strProMain += "<img src='image/common/khuyenmai.gif' style='cursor:pointer;' onmouseover='showDivMessage(2," + id + "," + i + ",event);' onmouseout='OnMOut(event)'/><br />"; } strProMain += "<a href='" + namepro + "-dp-" + id + ".html'><img class='img3' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)' src='" + url + "'/></a></td>"; strProMain += "<td width='7'></td>"; strProMain += "<td valign='top'><div class='text_title'><a href='" + namepro + "-dp-" + id + ".html' onmouseover='showDivMessage(1," + id + "," + i + ",event);' onmouseout='OnMOut(event)'>" + name + "</a></div>"; strProMain += tprice + ": <span class='price'>"; if (price.Equals("0")) { strProMain += tupdate + "</span><br />"; } else { if (unitPrice.Equals("$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + "</span><br />"; } else if (unitPrice.Equals("$$")) { strProMain += price + " VND</span><br />"; strProMain += "<font color='#FFFFFF'>" + tprice + ": </font><span class='price'>" + price2 + " USD</span><br />"; } else { strProMain += price + " " + unitPrice + "</span><br />"; } } strProMain += twarranty + ": <span class='price'>" + warranty + " " + tmonth + "</span>"; if (madein.Length > 0) { strProMain += "<br /><span class='text_title'>" + madein + "</span>"; } //Thêm mô tả sản phẩm ở đây: strProMain += "<div>" + table.Rows[i]["ShortDes"].ToString() + "</div>"; strProMain += "</td></tr>"; //strProMain += "<tr><td colspan='2' height='32' align='center'><div class='button3' onclick='AddCart(" + id + ",1);'>" + torder + "</div></td></tr>"; if (i + 1 < numPro) { strProMain += "<tr><td colspan='3' class='bg_line3'></td></tr>"; } } strProMain += "</table>"; } else { strProMain = "<br /><br /><div class='text_title' style='text-align:center;font-size:16px'>Dữ liệu đang được cập nhật. Xin quý khách vui lòng quay lại sau ít phút!.</div>"; } } catch (Exception ex) { Console.Write(ex.ToString()); strProMain = "<br /><br /><div class='text_title' style='text-align:center;font-size:16px'>Dữ liệu đang được cập nhật. Xin quý khách vui lòng quay lại sau ít phút!.</div>"; } }
public string GetProOriginal(string tprice, string currency) { string strBestSell = ""; try { DataTable table = new DataTable(); DataSet ds = new ProductMainPageSystem().OriginalSelectTop4(); table = ds.Tables[0]; int num = table.Rows.Count; string id = ""; string name = ""; string price = ""; string img = ""; float rate = (float)Application["ratepromain"]; float price1 = 1; string price2 = ""; for (int i = 0; i < num; i++) { id = table.Rows[i][ProductMainPage_data._id].ToString(); name = table.Rows[i][ProductMainPage_data._name].ToString() + " " + table.Rows[i][ProductMainPage_data._state].ToString(); ; price2 = table.Rows[i][ProductMainPage_data._price].ToString(); price1 = float.Parse(table.Rows[i][ProductMainPage_data._price].ToString()); price1 = price1 * rate; price = price1.ToString("N").Split('.')[0]; if (price.Equals("0")) { price = ""; price2 = ""; } img = table.Rows[i][ProductMainPage_data._urlImage].ToString(); if (img.Length > 0) { img = "image/img_pro/" + img; } else { img = "image/common/notimgpro.png"; } string namepro = table.Rows[i][ProductMainPage_data._name].ToString(); namepro = namepro.Replace("/", ""); namepro = namepro.Replace("#", ""); namepro = namepro.Replace(":", ""); namepro = namepro.Replace("\"", ""); strBestSell += "<tr><td class='div1'><a href='" + namepro + "-dp-" + id + ".html'>" + name + "</a><br />"; strBestSell += "<a href='" + namepro + "-dp-" + id + ".html'><img src='" + img + "' class='img2' /></a>"; if (currency.Equals("$")) { strBestSell += "<span class='price1'>" + price2 + "<br />(" + price + " VND)</span></td></tr>"; } else if (currency.Equals("$$")) { strBestSell += "<span class='price1'>" + price2 + " USD<br />(" + price + " VND)</span></td></tr>"; } else { strBestSell += "<span class='price1'>" + price + " " + currency + "</span></td></tr>"; } strBestSell += "<tr><td class='tvat' align='center'>" + strMVAT + "</td></tr>"; if (i + 1 < num) { strBestSell += "<tr><td class='bg_line2'></td></tr>"; } } } catch (Exception ex) { Console.Write(ex.ToString()); } return strBestSell; }
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 { } }