protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); if (!IsPostBack) { if (Session["GioHang"] != null) { dt = Session["GioHang"] as DataTable; grvsanpham.DataSource = dt; grvsanpham.DataBind(); string strTongTien = dt.Compute("Sum(TongGia)", "").ToString(); Session["slspgiohang"] = dt.Compute("Sum(SoLuong)", "").ToString(); if (strTongTien != "") { lbltongtien.Text = "Tổng giá: " + string.Format("{0:#.000}", Convert.ToDecimal(strTongTien) / 1000) + " VNĐ"; } else { lbltongtien.Text = "Tổng giá: 0 VNĐ"; } } else { lblgiohang.Text = "Hiện tại không có sản phẩm nào trong giỏ hàng"; } } }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); if (!IsPostBack) { TenDangNhap = Request.QueryString["TenDangNhap"]; //load tỉnh ddlthanhpho.DataSource = from tp in db.devvn_tinhthanhphos select new { tp.name, tp.matp }; ddlthanhpho.DataTextField = "name"; ddlthanhpho.DataValueField = "matp"; ddlthanhpho.DataBind(); List <Entity.KhachHang> lst = new List <Entity.KhachHang>(); lst = KhachHangService.KhachHang_GetByTop("", " TaiKhoan='" + TenDangNhap + "' ", ""); devvn_quanhuyen qh = new devvn_quanhuyen(); // var id = from tps in db.devvn_tinhthanhphos where tps.name == lst[0].Tinh.ToString() select new { tps.matp }; lbltendangnhap.Text = lst[0].TaiKhoan; txthovaten.Text = lst[0].TenKH; string gt = lst[0].GioiTinh; if (String.Compare(gt, "True") == 0) { rdobtnNam.Checked = true; } else { rdobtnNu.Checked = true; } txtngaysinh.Text = lst[0].NgaySinh; txtemail.Text = lst[0].Email; txtdienthoai.Text = lst[0].SDT; if (lst[0].Quan != "") { ddlthanhpho.Items.FindByText(lst[0].Tinh).Selected = true; } txtdiachi.Text = lst[0].DiaChi; MatKhau = lst[0].MatKhau; string id = ddlthanhpho.SelectedValue; var q = from x in db.devvn_quanhuyens where (x.matp == id)select new { x.maqh, x.name }; ddlquan.DataSource = q; ddlquan.DataTextField = "name"; ddlquan.DataValueField = "maqh"; ddlquan.DataBind(); if (lst[0].Tinh != "") { ddlquan.Items.FindByText(lst[0].Quan).Selected = true; } } }
void LoadDropDowlist() { List <Entity.NhomHang> lst = new List <Entity.NhomHang>(); lst = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); ddltennhomhang.DataSource = lst; ddltennhomhang.DataTextField = "TenNhomHang"; ddltennhomhang.DataValueField = "id"; ddltennhomhang.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); if (!IsPostBack) { LoadData(3); //rptcontent.DataSource = TinTucService.TinTuc_GetByTop("", "", " id DESC"); //rptcontent.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string TenspSearch = Request.QueryString["TenSanPham"]; List <Entity.SanPham> lst = new List <Entity.SanPham>(); lst = SanPhamService.SanPham_GetByTop("", " [dbo].[fuChuyenCoDauThanhKhongDau](TenHang) like N'%' +dbo.fuChuyenCoDauThanhKhongDau('" + TenspSearch + "')+'%' AND Active='True'", ""); dtltimkiem.DataSource = lst; dtltimkiem.DataBind(); remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); int?so = null; int id = Convert.ToInt32(Request["Id"]); List <Entity.TinTuc> lst = new List <Entity.TinTuc>(); TinTucService.TinTucView_Update(id.ToString()); rptbantin.DataSource = TinTucService.TinTuc_GetByTop("", " id='" + id + "'", ""); rptbantin.DataBind(); rptcacbaikhac.DataSource = TinTucService.TinTuc_GetByTop("2", "", " NEWID()"); rptcacbaikhac.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); txtusername.Focus(); loader.Visible = false; if (!IsPostBack) { //load tỉnh ddlthanhpho.DataSource = from tp in db.devvn_tinhthanhphos select new { tp.name, tp.matp }; ddlthanhpho.DataTextField = "name"; ddlthanhpho.DataValueField = "matp"; ddlthanhpho.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); if (!IsPostBack) { if (Request.QueryString["IDSanPham"] != null) { tbGioHang = (DataTable)Session["GioHang"]; } grvsanpham.DataSource = tbGioHang; grvsanpham.DataBind(); string strTongTien = tbGioHang.Compute("Sum(TongGia)", "").ToString(); //string strTongTien = Session["tongtien"].ToString(); lbltongtien.Text = "Tổng giá: " + string.Format("{0:#.000}", Convert.ToDecimal(strTongTien) / 1000) + " VNĐ"; lblsl = (Label)Master.FindControl("lblslgiohang"); Session["slspgiohang"] = tbGioHang.Compute("Sum(SoLuong)", "").ToString(); lblsl.Text = Session["slspgiohang"].ToString(); //load tỉnh ddlthanhpho.DataSource = from tp in db.devvn_tinhthanhphos select new { tp.name, tp.matp }; ddlthanhpho.DataTextField = "name"; ddlthanhpho.DataValueField = "matp"; ddlthanhpho.DataBind(); //load hình thức thanh toán ddlhinhthucthanhtoan.DataSource = from x in db.PayMeThods select new { x.HinhThucThanhToan, x.IdPay }; ddlhinhthucthanhtoan.DataTextField = "HinhThucThanhToan"; ddlhinhthucthanhtoan.DataValueField = "IdPay"; ddlhinhthucthanhtoan.DataBind(); if (Session["display_name"] != null && Session["email"] != null) { txtemail.Text = Session["email"].ToString(); txthovaten.Text = Session["display_name"].ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); List <Entity.SanPham> lst = new List <Entity.SanPham>(); string ID_Menu = Request.QueryString["IDMenu"]; if (String.Compare(ID_Menu, "1") == 0) { lst = SanPhamService.SanPham_GetByTop("", " id_Menu=1", ""); lblsanpham.Text = "ÁO KHOÁC"; } else if (String.Compare(ID_Menu, "2") == 0) { lst = SanPhamService.SanPham_GetByTop("", " id_Menu=2", ""); lblsanpham.Text = "ÁO SƠ MI"; } else if (String.Compare(ID_Menu, "3") == 0) { lst = SanPhamService.SanPham_GetByTop("", " id_Menu=3", ""); lblsanpham.Text = "QUẦN JEANS"; } else if (String.Compare(ID_Menu, "4") == 0) { lst = SanPhamService.SanPham_GetByTop("", " id_Menu=4", ""); lblsanpham.Text = "QUẦN DÀI"; } else if (String.Compare(ID_Menu, "5") == 0) { lst = SanPhamService.SanPham_GetByTop("", " id_Menu=5", ""); lblsanpham.Text = "QUẦN SHORTS"; } dtlsanpham.DataSource = lst; dtlsanpham.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { bind_SanPham(); string link_fb = Request.QueryString["s"]; rptQuangCao.DataSource = QuangCaoService.QuangCao_GetByTop("", " Active='True'", ""); rptQuangCao.DataBind(); remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); if (link_fb != null) { Session["link_fb"] = link_fb; List <Entity.KhachHang> lstKh = new List <Entity.KhachHang>(); lstKh = KhachHangService.KhachHang_GetByTop("", " Link_Fb='" + Session["link_fb"].ToString() + "' ", ""); if (lstKh.Count == 0) { KhachHang objkh = new KhachHang(); objkh.TenKH = ""; objkh.GioiTinh = "true"; objkh.NgaySinh = ""; objkh.MatKhau = ""; objkh.Email = ""; objkh.TaiKhoan = Session["TenDangNhap"].ToString(); objkh.SDT = ""; objkh.Tinh = ""; objkh.Quan = ""; objkh.DiaChi = ""; objkh.Link_Fb = Session["Link_Fb"].ToString(); KhachHangService.KhachHang_Insert(objkh); } } }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); tbl_KhachHang kh = new tbl_KhachHang(); GoogleConnect.ClientId = "520808312902-5al7h79mvjmk9jil2du85jenb6stla5q.apps.googleusercontent.com"; GoogleConnect.ClientSecret = "QF8LkNiAPNTvAvbJJvQqTR9E"; GoogleConnect.RedirectUri = Request.Url.AbsoluteUri.Split('?')[0]; if (!string.IsNullOrEmpty(Request.QueryString["code"])) { string code = Request.QueryString["code"]; string json = GoogleConnect.Fetch("me", code); GoogleProfile profile = new JavaScriptSerializer().Deserialize <GoogleProfile>(json); Session["TenDangNhap"] = profile.Id; Session["display_name"] = profile.DisplayName; Session["email"] = profile.Emails.Find(email => email.Type == "account").Value; kh.TaiKhoan = profile.Id; kh.Email = profile.Emails.Find(email => email.Type == "account").Value.ToString(); kh.tenKH = profile.DisplayName; var a = from i in db.tbl_KhachHangs where i.TaiKhoan == profile.Id select i; if (a.Count() <= 0) { db.tbl_KhachHangs.InsertOnSubmit(kh); db.SubmitChanges(); } Response.Redirect("TrangChu.aspx"); } if (Request.QueryString["error"] == "access_denied") { ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('Access denied.')", true); } }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { remenu.DataSource = NhomHangService.NhomHang_GetByTop("", " Active='True'", ""); remenu.DataBind(); //Khoi tao gio hang if (Session["GioHang"] != null) { tbGioHang = Session["GioHang"] as DataTable; } else { tbGioHang.Rows.Clear(); tbGioHang.Columns.Clear(); tbGioHang.Columns.Add("TenSP", typeof(string)); tbGioHang.Columns.Add("Size", typeof(string)); tbGioHang.Columns.Add("UrlImage", typeof(string)); tbGioHang.Columns.Add("Gia", typeof(double)); tbGioHang.Columns.Add("SoLuong", typeof(int)); tbGioHang.Columns.Add("TongGia", typeof(double), "SoLuong*Gia"); Session["GioHang"] = tbGioHang; } string Id = Request.QueryString["Id"]; SanPhamService.SanPhamView_Update(Id); lst = SanPhamService.SanPham_GetByTop("", " id=N'" + Id + "'", ""); rptlarge.DataSource = lst; rptlarge.DataBind(); imganhsp.ImageUrl = lst[0].Image; string s; s = "<div>"; s += "<h1>" + lst[0].TenHang + "</h1>"; s += "<p>"; s += " <strong style='font-weight:bold;'> Giá bán:</strong>"; s += "</p>"; s += "<div class='giamoi'>"; s += " <span>" + string.Format("{0:#,0.#}", float.Parse(lst[0].GiaMoi)) + "</span>"; s += "</div>"; s += " <div class='giacu'>"; s += " <span >Giá cũ:"; s += " <span style='color:#F00;text-decoration:line-through;font-size:16px; font-weight:normal;'> " + string.Format("{0:#,0.#}", float.Parse(lst[0].GiaCu)) + "</span>"; s += "</span>"; s += "</div>"; s += "<div>"; s += "<span>Chất liệu:"; s += "<span style='font-weight:normal;'>" + lst[0].ChatLieu + "</span>"; s += " </span>"; s += " </div>"; s += "<div>"; s += "<span>"; s += "<span style='font-weight:normal;'>" + lst[0].TomTat + "</span>"; s += "</div>"; s += "</div>"; ltrctsp.Text = s; frmviewChitiet.DataSource = lst; frmviewChitiet.DataBind(); lblluotxem.Text = lst[0].LuotXem; ltr_ChiTiet.Text = lst[0].Mota; List <Entity.SanPham> lst_CungLoai = new List <Entity.SanPham>(); lst_CungLoai = SanPhamService.SanPham_GetByTop("", "id_Menu=" + lst[0].Id_Menu + " and Active='True' and id !=" + lst[0].Id + "", ""); rptSanPhamCungloai.DataSource = lst_CungLoai; rptSanPhamCungloai.DataBind(); }