private void LoadData(string Id) { try { HoTroTrucTuyen ht = new HoTroTrucTuyen(); DataSet ds = ht.SelectByID(Convert.ToInt32(Id)); if (ds.Tables[0].Rows.Count > 0) { txtHoTro.Text = ds.Tables[0].Rows[0]["TenHoTro"].ToString(); txtHoVaTen.Text = ds.Tables[0].Rows[0]["HoVaTen"].ToString(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); txtYM.Text = ds.Tables[0].Rows[0]["YM"].ToString(); txtDienThoai.Text = ds.Tables[0].Rows[0]["DienThoai"].ToString(); } } catch (Exception ex) { Response.Write(ex.ToString()); } }
protected void btnLuu_Click(object sender, EventArgs e) { try { HoTroTrucTuyen ht = new HoTroTrucTuyen(); if (Request.QueryString["hid"] == null) { ht.InsertFields(int.Parse(Request.QueryString["sid"]), txtHoTro.Text, txtYM.Text, txtHoVaTen.Text, txtDienThoai.Text, txtEmail.Text); } else { ht.UpdateFields(Convert.ToInt32(Request.QueryString["hid"]), int.Parse(Request.QueryString["sid"]), txtHoTro.Text, txtYM.Text, txtHoVaTen.Text, txtDienThoai.Text, txtEmail.Text); } string strScript = "<script language='JavaScript'>" + "window.parent.RefreshStoreInfo();</script>"; ClientScript.RegisterStartupScript(GetType(), "Refresh", strScript); } catch (Exception ex) { Response.Write(ex.ToString()); } }
private void LoadHoTroTrucTuyen() { HoTroTrucTuyen ht = new HoTroTrucTuyen(); DataSet ds = ht.SelectByCuaHangID(0); string content = ""; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; content += "<img border='0' style=\"cursor:hand\" src='../images/edit.gif' onclick='EditHTTT(" + dr["HoTroTrucTuyenID"] + ");' ><img border='0' style=\"cursor:hand\" src='../images/delete.gif' onclick='DeleteHTTT(" + dr["HoTroTrucTuyenID"] + ");'><a href=\"ymsgr:sendIM?" + dr["YM"] + "\"><img src=\"http://opi.yahoo.com/online?u=" + dr["YM"] + "&t=1\" border=\"0\"></a>" + dr["TenHoTro"] + "<br>"; } supporters.InnerHtml = content; } }
private void LoadHoTroTrucTuyen() { HoTroTrucTuyen ht = new HoTroTrucTuyen(); DataSet ds = ht.SelectByCuaHangID(0); string content = ""; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; content += "<a href=\"ymsgr:sendIM?" + dr["YM"] + "\"><img src=\"http://opi.yahoo.com/online?u=" + dr["YM"] + "&t=1\" border=\"0\">" + dr["TenHoTro"] + "</a><br>"; } supporters.InnerHtml = content; } }
protected void btnXoa_Click(object sender, EventArgs e) { try { switch (ViewState["TYPE"].ToString()) { case "thuoctinh": if (Common.LoaiNguoiDungID() == 3) { ThuocTinh tt = new ThuocTinh(); tt.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhomsanpham": if (Common.LoaiNguoiDungID() == 3) { NhomSanPham nhomsanpham = new NhomSanPham(); nhomsanpham.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "vitrisanpham": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { ViTriSanPham vtsp = new ViTriSanPham(); vtsp.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "cuahangnhomsanpham": if (Common.LoaiNguoiDungID() == 2) { deleteCuaHangNhomSanPham(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhomsanphamcuahang": if (Common.LoaiNguoiDungID() == 2) { deleteNhomSanPhamCuaHang(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nhanxetsanpham": if (Common.LoaiNguoiDungID() != 1) { NhanXetSanPham nhanxet = new NhanXetSanPham(); nhanxet.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "tintuc": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { TinTuc tt = new TinTuc(); tt.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hotrotructuyen": if ((Common.LoaiNguoiDungID() == 3) || (Common.LoaiNguoiDungID() == 2)) { HoTroTrucTuyen ht = new HoTroTrucTuyen(); ht.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hoidapsanpham": if (Common.LoaiNguoiDungID() != 1) { HoiDapSanPham hoidap = new HoiDapSanPham(); hoidap.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "nguoidung": if (Common.LoaiNguoiDungID() == 3) { if (CheckExistCuaHang(id) != true) { NguoiDung nguoidung = new NguoiDung(); nguoidung.Delete(id); } else { Response.Redirect("../message.aspx?msg=Không thể xóa người dùng đã có cửa hàng", false); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "hangsanxuat": if (Common.LoaiNguoiDungID() == 3) { HangSanXuat hsx = new HangSanXuat(); hsx.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "khuvuc": if (Common.LoaiNguoiDungID() == 3) { KhuVuc kv = new KhuVuc(); kv.Delete(id); } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "quangcao": if (Common.LoaiNguoiDungID() == 2 || Common.LoaiNguoiDungID() == 3) { QuangCao qcao = new QuangCao(); DataSet ds = qcao.SelectByQuangCaoID(id); if (ds.Tables[0].Rows.Count == 1) { if (Common.LoaiNguoiDungID() == 3) { //Administrator if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "3") qcao.Delete(id); } else { //e-Store if (ds.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == "2" && ds.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString()) qcao.Delete(id); } } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; case "sanpham": { SanPham sanpham = new SanPham(); DataSet dssp = sanpham.SelectBySanPhamID(id); if (Common.LoaiNguoiDungID() == 2) { if (dssp.Tables[0].Rows.Count == 1) { //e-Store if (dssp.Tables[0].Rows[0]["LoaiNguoiDungID"].ToString() == Common.LoaiNguoiDungID().ToString() && dssp.Tables[0].Rows[0]["NguoiDungID"].ToString() == Common.NguoiDungID().ToString()) { sanpham.Delete(id); } } } else if (Common.LoaiNguoiDungID() == 3) { if (dssp.Tables[0].Rows.Count == 1) { sanpham.Delete(id); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } } break; case "sanphammau": { SanPhamMau sanpham = new SanPhamMau(); DataSet dssp = sanpham.SelectByID(id); if (Common.LoaiNguoiDungID() == 3) { if (dssp.Tables[0].Rows.Count == 1) { sanpham.Delete(id); } } else { Response.Redirect("../message.aspx?msg=Access denied"); } } break; case "anhsanpham": if ((Common.LoaiNguoiDungID() == 2) || (Common.LoaiNguoiDungID() == 3)) { Anh anhsanpham = new Anh(); DataSet dssp = anhsanpham.SelectByID(id); if (dssp.Tables[0].Rows.Count == 1) { anhsanpham.Delete(id); if (File.Exists(Server.MapPath(Request.QueryString["src"]))) { File.Delete(Server.MapPath(Request.QueryString["src"])); } } } else { Response.Redirect("../message.aspx?msg=Access denied"); } break; } string strScript = "<script language='JavaScript'>" + "window.parent.Refresh();</script>"; ClientScript.RegisterStartupScript(Type.GetType("System.String"), "Refresh", strScript); } catch (Exception ex) { Response.Write(ex.ToString()); } }
//private void LoadGianHang() //{ // CuaHang ch = new CuaHang(); // DataSet ds = ch.SelectCuaHangAtViTriCuaHangByNguoiDungID(Common.NguoiDungID(), 51); // int n = ds.Tables[0].Rows.Count; // for (int i = 0; i < n; i++) // { // TableRow tr = new TableRow(); // TableCell td = new TableCell(); // string content = ""; // content += " <img src=\"." + ds.Tables[0].Rows[i]["Anh"] // + // "\" width=\"110\" height=\"73\" hspace=\"4\" vspace=\"4\" style=\"border:#ece2a4 1px solid\" />"; // td.Text = content; // td.HorizontalAlign = HorizontalAlign.Center; // tr.Cells.Add(td); // tblGianHang.Rows.Add(tr); // } //} private void LoadHoTroTrucTuyen() { HoTroTrucTuyen ht = new HoTroTrucTuyen(); DataSet ds = ht.SelectByCuaHangID(CuaHangID); string content = ""; if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; content += "<img border='0' style=\"cursor:hand\" src='../images/edit.gif' onclick='EditHTTT(" + dr["HoTroTrucTuyenID"] + ");' ><img border='0' style=\"cursor:hand\" src='../images/delete.gif' onclick='DeleteHTTT(" + dr["HoTroTrucTuyenID"] + ");'><a href=\"ymsgr:sendIM?" + dr["YM"] + "\"><img src=\"http://opi.yahoo.com/online?u=" + dr["YM"] + "&t=1\" border=\"0\"></a>" + dr["TenHoTro"] + "<br>"; } spnHoTroTrucTuyen.InnerHtml = content; } //if (ds.Tables[0].Rows.Count != 1) //{ // Response.Redirect("../message.aspx?msg=You haven't got a store yet"); //} //else //{ // DataRow dr = ds.Tables[0].Rows[0]; // lblTenCuaHang.Text = dr["TenCuaHang"].ToString(); // CuaHangID = int.Parse(dr["CuaHangID"].ToString()); //} }