protected void Page_Load(object sender, EventArgs e) { //Show GroupContact: try { DataSet dsLocation = new ContacstSystem().LocationContactSelectAll(); if (dsLocation.Tables.Count > 0) { int num = dsLocation.Tables[0].Rows.Count; if (num > 0) { tableLocations = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;'>"; tableLocations += "<tr class='tlist'><td width='30'>STT</td><td width='180'>Khu vực liên hệ</td><td width='100'>Xóa bỏ</td></tr>"; for (int i = 1; i <= num; i++) { string id = dsLocation.Tables[0].Rows[i - 1]["id"].ToString(); tableLocations += "<tr><td align='center'>" + i.ToString() + "</td><td class='title1'><a href='?menu=editlocationcontact&id=" + id + "'>" + dsLocation.Tables[0].Rows[i - 1]["name"].ToString() + "</a></td><td align='center'><span class='spanbt' onclick='Dfunction(" + id + ",2);'>Xóa</span></td></tr>"; } tableLocations += "</table>"; } else { tableLocations = "Chưa có khu vực liên hệ nào"; } } } catch { } }
protected void btedit_ServerClick(object sender, EventArgs e) { try { string title = txttitle.Value.Trim(); int sort = int.Parse(slsort.Value); if (title.Length > 0) { ContacstSystem Contacts = new ContacstSystem(); DataSet ds = Contacts.GroupContactSelectIdName(id, title); if (ds.Tables[0].Rows.Count > 0) { } else { Response.Redirect("AdminWebsite.aspx?menu=groupcontact"); } if (ds.Tables[1].Rows.Count > 0 && !(id==int.Parse(ds.Tables[1].Rows[0]["id"].ToString()))) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Tiêu đề nhóm liên hễ đã tồn tại. Hãy nhập nhóm khác</div>"; return; } else { if (Contacts.GroupContactUpdate(id,title, sort)) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Nhóm liên hệ đã được chỉnh sửa</div>"; //txttitle.Value = ""; //slsort.Items[0].Selected = true; return; } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Xin bạn hãy nhập tiêu đề nhóm liên hệ</div>"; return; } } } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Xin bạn hãy nhập tiêu đề nhóm liên hệ</div>"; return; } } catch { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể thêm mới.</div>"; return; } }
protected void btedit_ServerClick(object sender, EventArgs e) { try { string title = txttitle.Value.Trim(); if (title.Length > 0) { ContacstSystem Contacts = new ContacstSystem(); DataSet ds = Contacts.LocationContactSelectIdName(id, title); if (ds.Tables[0].Rows.Count > 0) { } else { Response.Redirect("AdminWebsite.aspx?menu=locationcontact"); } if (ds.Tables[1].Rows.Count > 0 && !(id==int.Parse(ds.Tables[1].Rows[0]["id"].ToString()))) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Khu vực liên hệ đã tồn tại, hãy nhập khu vực khác.</div>"; return; } else { if (Contacts.LocationContactupdate(id,title)) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Khu vực liên hệ đã được chỉnh sửa.</div>"; txttitle.Value = ""; return; } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể chỉnh sửa, xin hãy thử lại.</div>"; return; } } } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Xin hãy nhập khu vực liên hệ.</div>"; return; } } catch { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể chỉnh sửa, xin hãy thử lại.</div>"; return; } }
protected void btadd_ServerClick(object sender, EventArgs e) { try { string title = txttitle.Value.Trim(); int sort = int.Parse(slsort.Value); if (title.Length > 0) { ContacstSystem Contacts = new ContacstSystem(); DataSet ds = Contacts.GroupContactSelectIdName(0, title); if (ds.Tables[1].Rows.Count > 0) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Tiêu đề nhóm liên hễ đã tồn tại. Hãy nhập nhóm khác</div>"; return; } else { if (Contacts.GroupContactInsert(title, sort)) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Nhóm liên hệ đã được tạo</div>"; txttitle.Value = ""; slsort.Items[0].Selected = true; return; } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể thêm mới. Xin hãy thử lại.</div>"; return; } } } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Xin bạn hãy nhập tiêu đề nhóm liên hệ</div>"; return; } } catch { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể thêm mới.</div>"; return; } }
protected void btadd_ServerClick(object sender, EventArgs e) { try { string title = txttitle.Value.Trim(); if (title.Length > 0) { ContacstSystem Contacts = new ContacstSystem(); DataSet ds = Contacts.LocationContactSelectIdName(0, title); if (ds.Tables[1].Rows.Count > 0) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Khu vực liên hệ đã tồn tại, hãy nhập khu vực khác</div>"; return; } else { if (Contacts.LocationContactInsert(title)) { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Khu vực liên hệ đã được tạo</div>"; txttitle.Value = ""; return; } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể thêm mới, xin hãy thử lại</div>"; return; } } } else { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Xin hãy nhập khu vực liên hệ</div>"; return; } } catch { diverror.Visible = true; diverror.InnerHtml = "<div class='diverror'>Lỗi kết nối SQL. Không thể thêm mới.</div>"; return; } }
protected void Page_Load(object sender, EventArgs e) { //Show Contacts: try { DataSet dscontact = new ContacstSystem().ContactsSelectAll(); if (dscontact.Tables.Count > 0) { int num = dscontact.Tables[0].Rows.Count; if (num > 0) { tablecontacts = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;' width='100%'>"; tablecontacts += "<tr class='tlist'><td width='30'>STT</td><td width='80'>Địa chỉ cho</td><td width='130'>Tiêu đề liên hệ</td><td width='160'>Nhóm liên hệ</td><td width='120'>Khu vực liên hệ</td><td width='40'>Xóa bỏ</td></tr>"; for (int i = 1; i <= num; i++) { string id = dscontact.Tables[0].Rows[i - 1]["idcontact"].ToString(); string strsupport = "máy tính"; if (dscontact.Tables[0].Rows[i - 1]["groupid"].Equals(2)) { strsupport = "Điện thoại"; } tablecontacts += "<tr><td align='center'>" + i.ToString() + "</td><td align='center'>" + strsupport + "</td><td class='title1'><a href='?menu=editcontact&id=" + id + "'>" + dscontact.Tables[0].Rows[i - 1]["name"].ToString() + "</a></td>"; tablecontacts += "<td>" + dscontact.Tables[0].Rows[i - 1]["groupcontact"].ToString() + "</td>"; tablecontacts += "<td>" + dscontact.Tables[0].Rows[i - 1]["location"].ToString() + "</td>"; tablecontacts += "<td align='center'><span class='spanbt' onclick='Dfunction(" + id + ",8);'>Xóa</span></td></tr>"; } tablecontacts += "</table>"; } else { tablecontacts = "Chưa có địa chỉ liên hệ."; } } } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { Hashtable hash = (Hashtable)Application[Session["langcurrent"].ToString()]; currentAccess = hash["currentpage"].ToString(); thome = hash["home"].ToString(); tcontact = hash["contact"].ToString(); currentAccess += ": <a href='?menu=home'>" + thome + "</a> » " + tcontact; DataSet ds = new ContacstSystem().ContactsSelectAll(); int numContact=ds.Tables[0].Rows.Count; if (numContact > 0) { string idtype = ds.Tables[0].Rows[0]["idtype"].ToString(); string idlocation = ds.Tables[0].Rows[0]["id"].ToString(); for (int i = 0; i < numContact; i++) { string nameGroup = ds.Tables[0].Rows[i]["groupcontact"].ToString(); string location = ds.Tables[0].Rows[i]["location"].ToString(); if (idtype.Equals(ds.Tables[0].Rows[i]["idtype"].ToString())) { if (i==0) { tableContacts = "<span class='text_title'>" + nameGroup + "</span>"; tableContacts += "<div class='tdborder'>"; } } else { tableContacts += "</div>"; tableContacts += "<span class='text_title'>" + nameGroup + "</span>"; tableContacts += "<div class='tdborder'>"; } if (idlocation.Equals(ds.Tables[0].Rows[i]["id"].ToString())) { if (i == 0) { tableContacts += "<div class='tgroup'>" + location + "</div>"; } } else { tableContacts += "<div class='tgroup'>" + location + "</div>"; } //Contact: tableContacts+="<table border='0' cellpadding='0' cellspacing='0' width='100%'>"; tableContacts+="<tr><td height='5' width='150'></td><td></td></tr>"; tableContacts += "<tr><td colspan='2' class='title_1' height='24'>" + ds.Tables[0].Rows[i]["name"].ToString() +"</td></tr>"; tableContacts += "<tr class='bgtr1'><td class='td1'>Địa chỉ</td><td>" + ds.Tables[0].Rows[i]["address"].ToString() + "</td></tr>"; tableContacts += "<tr class='bgtr2'><td class='td1'>Mô tả</td><td>" + ds.Tables[0].Rows[i]["des"].ToString() + "</td></tr>"; tableContacts += "<tr class='bgtr1'><td class='td1'>Thời gian phục vụ</td><td>" + ds.Tables[0].Rows[i]["timeservice"].ToString() + "</td></tr>"; tableContacts += "<tr class='bgtr2'><td class='td1'>Số điện thoại</td><td>" + ds.Tables[0].Rows[i]["phone"].ToString() + "</td></tr>"; tableContacts += "<tr class='bgtr1'><td class='td1'>Số Fax</td><td>" + ds.Tables[0].Rows[i]["fax"].ToString() + "</td></tr>"; tableContacts += "<tr class='bgtr2'><td class='td1'>Email</td><td>" + ds.Tables[0].Rows[i]["email"].ToString() + "</td></tr>"; if (ds.Tables[0].Rows[i]["delegate"].ToString().Length > 0) { tableContacts += "<tr class='bgtr1'><td class='td1'>Người đại diện</td><td>" + ds.Tables[0].Rows[i]["delegate"].ToString() + "</td></tr>"; } tableContacts += "</table>"; //string id = ds.Tables[0].Rows[i]["groupcontact"].ToString(); idtype = ds.Tables[0].Rows[i]["idtype"].ToString(); idlocation = ds.Tables[0].Rows[i]["id"].ToString(); } tableContacts += "</div>"; } } catch { } }
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 { } }