protected void dtMota_UpdateCommand(object source, DataListCommandEventArgs e) { TextBox txtTen = (TextBox)e.Item.FindControl("txtTen"); TextBox txtQuocGia = (TextBox)e.Item.FindControl("txtQuocGia"); TextBox txtMota = (TextBox)e.Item.FindControl("txtMota"); string oldurl = "", newurl = ""; DataTable dt = XLDL.LayDuLieu("select tencty from congty where macty=" + int.Parse(Request.QueryString["macty"].ToString())); if (dt.Rows.Count > 0) { oldurl = "~/images/" + dt.Rows[0][0]; } try { XLDL.Chaylenh("update congty set tencty=N'" + txtTen.Text.Trim() + "',quocgia=N'" + txtQuocGia.Text.Trim() + "',mota=N'" + txtMota.Text.Trim() + "' where macty = " + Request.QueryString["macty"]); newurl = "~/images/" + txtTen.Text.Trim(); if (Directory.Exists(Server.MapPath(oldurl)) && txtTen.Text.Trim() != dt.Rows[0][0].ToString()) { Directory.Move(Server.MapPath(oldurl), Server.MapPath(newurl)); } Response.Redirect("~/congty.aspx"); } catch { Response.Write("<script>alert('Lỗi trong quá trình ghi dữ liệu, vui lòng thử lại sau')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nguoidung"] == null) { mtvThongTin.ActiveViewIndex = 1; //lblErr.Text = "Lỗi: Không tìm thấy thông tin người dùng."; } else//đã đăng nhập { mtvThongTin.ActiveViewIndex = 0; string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); int manguoidung = int.Parse(dt.Rows[0]["Ma_Nguoi_Dung"].ToString()); lblTenNguoiDung.Text = tennguoidung; lblMatKhau.Text = "******"; lblHoTen.Text = dt.Rows[0]["Ho_Ten"].ToString(); lblGioiTinh.Text = dt.Rows[0]["Gioi_Tinh"].ToString(); lblDiaChi.Text = dt.Rows[0]["Dia_Chi"].ToString(); lblCMND.Text = dt.Rows[0]["CMND"].ToString(); lblEmail.Text = dt.Rows[0]["Email"].ToString(); lblSDT.Text = dt.Rows[0]["SDT"].ToString(); hypCapNhatMK.NavigateUrl = "~/Doi_Mat_Khau.aspx?"; hypCapNhatTTCN.NavigateUrl = "~/Cap_Nhat_TT.aspx?"; } }
private void aTimKiem() { DataTable dt = XLDL.LayDuLieu("select * from DIENTHOAI where TenSP like N'%" + XLDL.Timkiem + "%'"); if (dt.Rows.Count > 0) { dlTimKiem.DataSource = XLDL.LayDuLieu("select * from DIENTHOAI where TenSP like N'%" + XLDL.Timkiem + "%'"); dlTimKiem.DataBind(); kq.Controls.Add(new LiteralControl("Kết quả tìm kiếm cho từ khóa \"<span style=\"color:#F00\">" + XLDL.Timkiem + "</span>\"")); lbThongBao.Visible = false; } else { kq.Controls.Add(new LiteralControl("Không tìm thấy kết quả nào phù hợp cho từ khóa \"<span style=\"color:#F00\">" + XLDL.Timkiem + "</span>\"")); lbThongBao.Controls.Add(new LiteralControl("<div style=\"padding-left: 20px\">")); lbThongBao.Controls.Add(new LiteralControl("<div>Để tìm được kết quả chính xác hơn, bạn vui lòng:</div>")); lbThongBao.Controls.Add(new LiteralControl("<ul style=\"font-size: 13px; padding-left: 20px\">")); lbThongBao.Controls.Add(new LiteralControl("<li>Kiểm tra lỗi chính tả của từ khóa đã nhập</li>")); lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng từ khóa khác</li>")); lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng những từ khóa tổng quát hơn</li>")); lbThongBao.Controls.Add(new LiteralControl("<li>Thử lại bằng những từ khóa ngắn gọn hơn</li>")); lbThongBao.Controls.Add(new LiteralControl("</ul>")); lbThongBao.Controls.Add(new LiteralControl("</div>")); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nguoidung"] == null) { mtvChiTietDDH.ActiveViewIndex = 1; } else { if (Request.QueryString["Ma_DDH"] == null) { mtvChiTietDDH.ActiveViewIndex = 2; } else { int maddh = int.Parse(Request.QueryString["Ma_DDH"]); string sqlctddh = "select * from Chi_Tiet_DDH CT,Xe where CT.Ma_Xe = Xe.Ma_Xe and Ma_DDH = " + maddh; lblMaDDH.Text = maddh.ToString(); DataTable dt = XLDL.docbang(sqlctddh); if (dt.Rows.Count > 0) { mtvChiTietDDH.ActiveViewIndex = 0; gdvChiTietDDH.DataSource = dt; gdvChiTietDDH.DataBind(); } else { mtvChiTietDDH.ActiveViewIndex = 2; } } } }
private int countMess() { DataTable dt = new DataTable(); dt = XLDL.GetData("select * from ThongTinLienHe where DaDuyet = 0"); return(int.Parse(dt.Rows.Count.ToString())); }
protected void btnLuu_Click(object sender, EventArgs e) { try { string thumuc = "~/images/news"; if (!Directory.Exists(thumuc)) { Directory.CreateDirectory(Server.MapPath(thumuc)); } if (FileUpload1.HasFile) { if (XLDL.CheckFileType(FileUpload1.FileName)) { string tenhinh = "~/images/news/" + DateTime.Now.ToString("ddMMyyyy_hhmmss_tt_") + FileUpload1.FileName; FileUpload1.SaveAs(Server.MapPath(tenhinh)); } } string hinh = DateTime.Now.ToString("ddMMyyyy_hhmmss_tt_") + FileUpload1.FileName; XLDL.Chaylenh("insert into tintuc(tieude,tomtat,hinh,url,ngaydang) values(N'" + txtTieuDe.Text.Trim() + "',N'" + txtTomTat.Text.Trim() + "','" + hinh + "','" + txtLink.Text.Trim() + "','" + DateTime.Today.ToShortDateString() + "')"); Response.Redirect("~/viewtintuc.aspx"); } catch { Response.Write("<script>alert('Lỗi ! Vui lòng thử lại sau')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["nguoidung"] == null) { mtvQLHX.ActiveViewIndex = 1; lblErr_admin.Text = "Bạn không được quyền truy cập trang này"; } else { string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); int manguoidung = int.Parse(dt.Rows[0][0].ToString()); int IsAdmin = int.Parse(dt.Rows[0]["Admin"].ToString()); if (IsAdmin == 1) { mtvQLHX.ActiveViewIndex = 0; MultiView1.ActiveViewIndex = 0; show_chungloai(); } else { mtvQLHX.ActiveViewIndex = 1; lblErr_admin.Text = "Bạn không được quyền truy cập trang này"; } } } }
protected void dlDonHang_ItemDataBound(object sender, DataListItemEventArgs e) { int sodh = int.Parse(dlDonHang.DataKeys[e.Item.ItemIndex].ToString()); Label lbthanhtoan = (Label)e.Item.FindControl("lbthanhtoan"); CheckBox cb = (CheckBox)e.Item.FindControl("CheckBox1"); DataTable dt = XLDL.LayDuLieu("select thanhtoan,dagiao from donhang where sodh=" + sodh); if (dt.Rows.Count > 0) { if (dt.Rows[0][0].ToString() == "True") { lbthanhtoan.Text = "Chuyển Khoản"; } else { lbthanhtoan.Text = "Tiền Mặt"; } if (dt.Rows[0][1].ToString() == "True") { cb.Checked = true; } else { cb.Checked = false; } } }
protected void gvThongTinKH_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Xoa") { try { int chiso = int.Parse(e.CommandArgument.ToString()); string ma = gvThongTinKH.Rows[chiso].Cells[0].Text; DataTable dt = XLDL.GetData("select MaKH from KhachHang where MaKH='" + ma + "'"); if (dt.Rows.Count > 1) { lbBaoLoi.Text = "Khách hàng đang có bài viết nên không thể xóa.<br/> Bạn cần xóa hết các bài viết của khách hàng này trước"; } else { string str = "delete from KhachHang where MaKH='" + ma + "'"; XLDL.Excute(str); Response.Redirect("~/AD/KhachHang.aspx"); } } catch { lbBaoLoi.Text = "Thất bại"; //Response.Write("<script>alert('Xóa Thất Bại!!!');</script>"); } } }
protected void dlTongQuat_ItemDataBound(object sender, DataListItemEventArgs e) { CheckBox cbTraGop = (CheckBox)e.Item.FindControl("cbTraGop"); DropDownList ddlHangSX = (DropDownList)e.Item.FindControl("ddlHangSX"); DataTable dt1 = XLDL.LayDuLieu("select tencty from congty"); if (dt1.Rows.Count > 0) { for (int i = 0; i < dt1.Rows.Count; i++) { ddlHangSX.Items.Add(dt1.Rows[i][0].ToString()); } } DataTable dt = XLDL.LayDuLieu("select tragop,dienthoai.macty,tencty from dienthoai,congty where congty.macty=dienthoai.macty and masp='" + Request.QueryString["MaSP"] + "'"); if (dt.Rows.Count > 0) { string bit = dt.Rows[0][0].ToString(); if (bit == "True") { cbTraGop.Checked = true; } else { cbTraGop.Checked = false; } ddlHangSX.SelectedValue = dt.Rows[0][2].ToString(); } }
protected void imgbtnCapNhat_Click(object sender, ImageClickEventArgs e) { if (Session["nguoidung"] == null) { Response.Redirect("~/Cap_Nhat_TT.aspx"); } else { string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); manguoidung = int.Parse(dt.Rows[0]["Ma_Nguoi_Dung"].ToString()); string dienthoai = txtSoDT.Text; string gioitinh = ddlGioiTinh.SelectedItem.Value.ToString(); string cmnd = txtSoCMND.Text; try { string str = "update Nguoi_Dung set Ho_Ten='" + txtHoTen.Text + "' , Dia_Chi ='" + txtDiaChi.Text + "' , SDT='" + dienthoai + "' , Email='" + txtEmail.Text + "', Gioi_Tinh='" + gioitinh + "', CMND='" + txtSoCMND.Text + "' where Ma_Nguoi_Dung=" + manguoidung; XLDL.thuchienlenh(str); Response.Redirect("Thanh_Cong.aspx?capnhattt=1&capnhatmk=&dangky=&thanhtoan="); } catch (Exception ex) { lblErrCapNhat.Visible = true; lblErrCapNhat.Text = "Lỗi: Không cập nhật được thông tin"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["nguoidung"] == null) { mtvAdmin.ActiveViewIndex = 1; } else { string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); int manguoidung = int.Parse(dt.Rows[0][0].ToString()); int IsAdmin = int.Parse(dt.Rows[0]["Admin"].ToString()); if (IsAdmin == 1) { mtvAdmin.ActiveViewIndex = 0; } else { mtvAdmin.ActiveViewIndex = 1; } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["nguoidung"] == null) { mtvCapNhatTT.ActiveViewIndex = 1; } else { mtvCapNhatTT.ActiveViewIndex = 0; if (!IsPostBack) { string tennguoidung = Session["nguoidung"].ToString(); string thongtinkh = "select * from Nguoi_Dung where Ten_Nguoi_Dung='" + tennguoidung + "'"; DataTable dt = XLDL.docbang(thongtinkh); manguoidung = int.Parse(dt.Rows[0]["Ma_Nguoi_Dung"].ToString()); txtHoTen.Text = dt.Rows[0]["Ho_Ten"].ToString(); string gioitinh = dt.Rows[0]["Gioi_Tinh"].ToString(); if (gioitinh == "Nam") { ddlGioiTinh.SelectedIndex = 0; } else { ddlGioiTinh.SelectedIndex = 1; } txtDiaChi.Text = dt.Rows[0]["Dia_Chi"].ToString(); txtSoCMND.Text = dt.Rows[0]["CMND"].ToString(); txtEmail.Text = dt.Rows[0]["Email"].ToString(); txtSoDT.Text = dt.Rows[0]["SDT"].ToString(); } } }
protected void Button2_Click(object sender, EventArgs e) { int bit = 0; foreach (DataListItem item in dlHinh.Items) { int id = int.Parse(dlHinh.DataKeys[item.ItemIndex].ToString()); CheckBox cbHinh = (CheckBox)item.FindControl("cbHinh"); if (cbHinh.Checked == true) { bit = 1; } else { bit = 0; } XLDL.Chaylenh("update bannerhome set hien=" + bit + " where id=" + id); } string tenhinh = "~/images/home/banner/"; HttpFileCollection fileCollection = Request.Files; for (int i = 0; i < fileCollection.Count; i++) { HttpPostedFile uploadfile = fileCollection[i]; string fileName = Path.GetFileName(uploadfile.FileName); if (uploadfile.ContentLength > 0) { string hinh = DateTime.Now.ToString("ddMMyyyy_hhmmss_tt_") + fileName; uploadfile.SaveAs(Server.MapPath(tenhinh) + hinh); XLDL.Chaylenh("insert into bannerhome(hinh) values('" + hinh + "')"); } } slide(); }
protected void btnGui_Click(object sender, EventArgs e) { if (taBinhLuan.Text.Trim() != "") { string tendn = XLDL.MaHoa(Session["TenDN"].ToString()); DataTable dt = XLDL.LayDuLieu("select * from khachhang where TenDN='" + tendn + "'"); if (dt.Rows.Count > 0) { int makh = int.Parse(dt.Rows[0][0].ToString()); try { SqlConnection con = new SqlConnection(XLDL.strcon); SqlCommand cmd = new SqlCommand("insert into binhluan(masp,makh,binhluan,thoigian) values('" + Request.QueryString["MaSP"] + "'," + makh + ",N'" + taBinhLuan.Text.Trim() + "',@thoigian)", con); cmd.Parameters.Add("@thoigian", SqlDbType.DateTime); cmd.Parameters["@thoigian"].Value = DateTime.Now; con.Open(); cmd.ExecuteNonQuery(); con.Close(); } catch { } taBinhLuan.Text = ""; binhluan(); slbl(); CreateBanner(); } } else { taBinhLuan.Text = ""; CreateBanner(); } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { String strSearch = txtTimKiem.Text; String sql, datenew; int luotTruyCap = 1; datenew = DateTime.Now.ToString(); DataTable dt = XLDL.GetData("select * from TimKiem where TuKhoa = '" + strSearch + "'"); if (dt.Rows.Count > 0) { luotTruyCap = int.Parse(dt.Rows[0]["LuotTruyCap"].ToString()); luotTruyCap++; sql = "UPDATE TimKiem SET LuotTruyCap = " + luotTruyCap + "" + ", NgayNhapGanNhat = '" + datenew + "' WHERE TuKhoa = '" + strSearch + "'"; XLDL.GetData(sql); } else { sql = "INSERT INTO TimKiem VALUES('" + strSearch + "'" + "," + luotTruyCap + "" + ",'" + datenew + "')"; XLDL.GetData(sql); } Response.Redirect("~/SP_Search.aspx?Search=" + strSearch + ""); }
protected void gvNhaTro_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Xoa") { try { int chiso = int.Parse(e.CommandArgument.ToString()); string ma = gvNhaTro.Rows[chiso].Cells[0].Text; DataTable dt = XLDL.GetData("select MaNhaTro from NhaTroChoThue where MaNhaTro='" + ma + "'"); if (dt.Rows.Count > 1) { lbBaoLoi.Text = "Xóa thất bại"; } else { XLDL.Excute("Delete HinhAnhChiTietNhaTro from HinhAnhChiTietNhaTro where HinhAnhChiTietNhaTro.MaNhaTro =" + ma); XLDL.Excute("Delete DanhGia from DanhGia where DanhGia.MaNhaTro=" + ma); XLDL.Excute("Delete NhaTroChoThue from NhaTroChoThue where NhaTroChoThue.MaNhaTro =" + ma); Response.Redirect("~/AD/NhaTro.aspx"); } } catch { lbBaoLoi.Text = "Thất bại"; //Response.Write("<script>alert('Xóa Thất Bại!!!');</script>"); } } }
protected void dlHang_ItemDataBound(object sender, DataListItemEventArgs e) { DataList dlDienThoai = (DataList)e.Item.FindControl("dlDienThoai"); int macty = int.Parse(dlHang.DataKeys[e.Item.ItemIndex].ToString()); dlDienThoai.DataSource = XLDL.LayDuLieu("select * from dienthoai where macty=" + macty + " order by masp desc"); dlDienThoai.DataBind(); }
protected void dlBinhLuan_ItemCommand(object source, DataListCommandEventArgs e) { Label Label35 = (Label)e.Item.FindControl("Label35"); LinkButton lThich = (LinkButton)e.Item.FindControl("lThich"); string sl = Label35.Text.Trim(); if (e.CommandName == "Thich") { string chuoi; if (Session["TenDN"] != null) { DataTable dt = XLDL.LayDuLieu("select maKH from khachhang where tendn='" + XLDL.MaHoa(Session["TenDN"].ToString()) + "'"); string[] a = sl.Split(','); if (sl.Contains(dt.Rows[0][0].ToString()) == false) { chuoi = dt.Rows[0][0].ToString(); } else { chuoi = ""; } if (a.Length > 1) { for (int i = 0; i < a.Length; i++) { if (a[i] == dt.Rows[0][0].ToString()) { continue; } if (chuoi == "") { chuoi = a[i]; continue; } chuoi = chuoi + "," + a[i]; } } else { if (a[0] != "") { if (chuoi != "") { chuoi = chuoi + "," + a[0]; } else { chuoi = ""; } } } XLDL.Chaylenh("update binhluan set thich='" + chuoi + "' where ID=" + (int)dlBinhLuan.DataKeys[e.Item.ItemIndex]); } binhluan(); CreateBanner(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Title(); motaCty(); TenCT.Text = XLDL.LayDuLieu("select tencty from congty where macty='" + Request.QueryString["MaCty"] + "'").Rows[0][0].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { int maloaixe = int.Parse(Request.QueryString["Ma_Loai_xe"]); string loaixe = "select * from Loai_Xe where Ma_Loai_Xe=" + maloaixe; DataTable dt1 = XLDL.docbang(loaixe); lblTenHang.Text = dt1.Rows[0]["Ten_Loai_Xe"].ToString(); load(Request.QueryString["Ma_Loai_xe"].ToString()); }
protected void dlThongSo_UpdateCommand(object source, DataListCommandEventArgs e) { try { string masp = dlThongSo.DataKeys[e.Item.ItemIndex].ToString(); TextBox txtManHinh = (TextBox)e.Item.FindControl("txtManHinh"); TextBox txtCPU = (TextBox)e.Item.FindControl("txtCPU"); TextBox txtRam1 = (TextBox)e.Item.FindControl("txtRam1"); TextBox txtRom = (TextBox)e.Item.FindControl("txtRom"); TextBox txtHdh1 = (TextBox)e.Item.FindControl("txtHdh1"); TextBox txtCamera = (TextBox)e.Item.FindControl("txtCamera"); TextBox txtSelfie = (TextBox)e.Item.FindControl("txtSelfie"); TextBox txtPin1 = (TextBox)e.Item.FindControl("txtPin1"); XLDL.Chaylenh("update thongso set manhinh=N'" + txtManHinh.Text.Trim() + "',cpu=N'" + txtCPU.Text.Trim() + "',ram1=N'" + txtRam1.Text.Trim() + "',rom=N'" + txtRom.Text.Trim() + "',hdh1=N'" + txtHdh1.Text.Trim() + "',camera=N'" + txtCamera.Text.Trim() + "',selfie=N'" + txtSelfie.Text.Trim() + "',pin1=N'" + txtPin1.Text.Trim() + "' where masp='" + masp + "'"); TextBox txtCNMH = (TextBox)e.Item.FindControl("txtCNMH"); TextBox txtDoPhanGiai = (TextBox)e.Item.FindControl("txtDoPhanGiai"); TextBox txtMHRong = (TextBox)e.Item.FindControl("txtMHRong"); TextBox txtCamUng = (TextBox)e.Item.FindControl("txtCamUng"); TextBox txtDoPhanGiaiSau = (TextBox)e.Item.FindControl("txtDoPhanGiaiSau"); TextBox txtQuayPhimSau = (TextBox)e.Item.FindControl("txtQuayPhimSau"); TextBox txtFlash = (TextBox)e.Item.FindControl("txtFlash"); TextBox txtChupAnhNangCao = (TextBox)e.Item.FindControl("txtChupAnhNangCao"); TextBox txtDoPhanGiaiTruoc = (TextBox)e.Item.FindControl("txtDoPhanGiaiTruoc"); TextBox txtVideoCall = (TextBox)e.Item.FindControl("txtVideoCall"); TextBox txtThongTinKhac = (TextBox)e.Item.FindControl("txtThongTinKhac"); TextBox txtHdh = (TextBox)e.Item.FindControl("txtHdh"); TextBox txtChipset = (TextBox)e.Item.FindControl("txtChipset"); TextBox txtTocDoCPU = (TextBox)e.Item.FindControl("txtTocDoCPU"); TextBox txtGpu = (TextBox)e.Item.FindControl("txtGpu"); TextBox txtRam = (TextBox)e.Item.FindControl("txtRam"); TextBox txtBoNhoTrong = (TextBox)e.Item.FindControl("txtBoNhoTrong"); TextBox txtTheNho = (TextBox)e.Item.FindControl("txtTheNho"); TextBox txtSim = (TextBox)e.Item.FindControl("txtSim"); TextBox txtSac = (TextBox)e.Item.FindControl("txtSac"); TextBox txtTainghe = (TextBox)e.Item.FindControl("txtTainghe"); TextBox txtThietKe = (TextBox)e.Item.FindControl("txtThietKe"); TextBox txtChatLieu = (TextBox)e.Item.FindControl("txtChatLieu"); TextBox txtKichThuoc = (TextBox)e.Item.FindControl("txtKichThuoc"); TextBox txtTrongLuong = (TextBox)e.Item.FindControl("txtTrongLuong"); TextBox txtPin = (TextBox)e.Item.FindControl("txtPin"); TextBox txtLoaiPin = (TextBox)e.Item.FindControl("txtLoaiPin"); TextBox txtCNPin = (TextBox)e.Item.FindControl("txtCNPin"); TextBox txtThoiDiem = (TextBox)e.Item.FindControl("txtThoiDiem"); XLDL.Chaylenh("update thongsochitiet set cnmanhinh=N'" + txtCNMH.Text.Trim() + "',dophangiaimh=N'" + txtDoPhanGiai.Text.Trim() + "',mhrong=N'" + txtMHRong.Text.Trim() + "',camung=N'" + txtCamUng.Text.Trim() + "',dophangiaicamsau=N'" + txtDoPhanGiaiSau.Text.Trim() + "',quayphimsau=N'" + txtQuayPhimSau.Text.Trim() + "',denflash=N'" + txtFlash.Text.Trim() + "',chupanhnangcao=N'" + txtChupAnhNangCao.Text.Trim() + "',dophangiaicamtruoc=N'" + txtDoPhanGiaiTruoc.Text.Trim() + "',videocall=N'" + txtVideoCall.Text.Trim() + "',thongtinkhac=N'" + txtThongTinKhac.Text.Trim() + "',hdh=N'" + txtHdh.Text.Trim() + "',chipset=N'" + txtChipset.Text.Trim() + "',tocdocpu=N'" + txtTocDoCPU.Text.Trim() + "',gpu=N'" + txtGpu.Text.Trim() + "',ram=N'" + txtRam.Text.Trim() + "',bonhotrong=N'" + txtBoNhoTrong.Text.Trim() + "',thenho=N'" + txtTheNho.Text.Trim() + "',sim=N'" + txtSim.Text.Trim() + "',sac=N'" + txtSac.Text.Trim() + "',tainghe=N'" + txtTainghe.Text.Trim() + "',chatlieu=N'" + txtChatLieu.Text.Trim() + "',kichthuoc=N'" + txtKichThuoc.Text.Trim() + "',trongluong=N'" + txtTrongLuong.Text.Trim() + "',pin=N'" + txtPin.Text.Trim() + "',loaipin=N'" + txtLoaiPin.Text.Trim() + "',congnghepin=N'" + txtCNPin.Text.Trim() + "',thoidiemramat=N'" + txtThoiDiem.Text.Trim() + "' where masp='" + masp + "'"); thongso(); alert.Visible = true; } catch { error.Visible = true; } }
private void LayThongTin(string ms) { string str = "Select S.*, TenChuDe FROM HOA S INNER JOIN CHUDE C ON S.MaCD=C.MaCD WHERE S.MaHoa=" + int.Parse(ms); DataTable dt = XLDL.GetData(str); if (dt.Rows.Count > 0) { dlChiTietHoa.DataSource = dt; dlChiTietHoa.DataBind(); } }
protected void dlAdmin_DeleteCommand(object source, DataListCommandEventArgs e) { int id = int.Parse(dlAdmin.DataKeys[e.Item.ItemIndex].ToString()); try { XLDL.Chaylenh("delete admin where id=" + id); admin(); } catch { } }
public HttpResponseMessage GetFileContent(string id) { XLDL x = new XLDL(); string sql = "select URLBaiHat from BAIHAT where Id=" + id; path = x.GetDaTaID(sql); var httpResponce = Request.CreateResponse(); httpResponce.Content = new PushStreamContent((Action <Stream, HttpContent, TransportContext>)WriteContentToStream); return(httpResponce); }
protected void ddlHangSX_Load(object sender, EventArgs e) { DataTable dt = XLDL.LayDuLieu("select tencty from congty"); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { ddlHangSX.Items.Add(dt.Rows[i][0].ToString()); } } }
protected void dlKhuyenMai_DeleteCommand(object source, DataListCommandEventArgs e) { try { int ID = int.Parse(dlKhuyenMai.DataKeys[e.Item.ItemIndex].ToString()); XLDL.Chaylenh("delete from khuyenmaisp where id=" + ID); Response.Redirect(HttpContext.Current.Request.Url.AbsoluteUri); } catch { } }
protected void btnLuu_Click(object sender, EventArgs e) { try { XLDL.Chaylenh("insert into admin(HoTen,DiaChi,sdt,email,TenDN,MatKhau) values(N'" + txtHoTen.Text.Trim() + "',N'" + txtDiaChi.Text.Trim() + "','" + txtSDT.Text.Trim() + "','" + txtEmail.Text.Trim() + "','" + XLDL.MaHoa(txtTenDN.Text.ToLower().Trim()) + "','" + XLDL.MaHoa(txtMatKhau.Text.Trim()) + "')"); Response.Redirect("~/quantrivien.aspx"); } catch { lbThongbaoloi.Text = "Tên đăng nhập đã tồn tại, vui lòng thử lại với tên khác !"; } }
protected void LuuDN() { if (cbLuu.Checked) { HttpCookie cookie = new HttpCookie("Luu", "yes"); Response.Cookies.Add(cookie); cookie = new HttpCookie("TenDNandPass"); cookie.Values.Add("TenDN", XLDL.MaHoa(txtTen.Text.Trim().ToLower())); cookie.Values.Add("Pass", XLDL.MaHoa(txtMatkhau.Text.Trim())); Response.Cookies.Add(cookie); } }
private void tendt() { DataTable dt = XLDL.LayDuLieu("select tensp from dienthoai where masp='" + Request.QueryString["MaSP"] + "'"); if (dt.Rows.Count > 0) { TenDT.Text = dt.Rows[0][0].ToString(); } else { Response.Redirect("~/dienthoai.aspx"); } }