コード例 #1
0
        private void cbbDanhMuc_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbDanhMuc.SelectedValue.ToString() == "System.Data.DataRowView")
            {
            }
            else
            {
                var id = cbbDanhMuc.SelectedValue.ToString();
                idDanhmuc = Convert.ToInt32(id);
                FMain_Load(sender, e);
            }
            DAO_Main main = new DAO_Main();

            cbbSanPham.DataSource = main.ListSP_DanhMuc(idDanhmuc);
            if (main.ListSP_DanhMuc(idDanhmuc).Count() == 0)
            {
                cbbSanPham.Text = "";
                lbSoLuong.Text  = "0";
                lv.Items.Clear();
            }
            else
            {
                cbbSanPham.DisplayMember = "TenSanPham";
                cbbSanPham.ValueMember   = "ID";
                var id = cbbSanPham.SelectedValue.ToString();
                idSanPham = Convert.ToInt32(id);
                int soluong = main.SoLuong(idSanPham);
                lbSoLuong.Text = soluong.ToString();

                db = new QuanLyKhoHangDataContext();
                string href    = "H:\\project\\c#\\Wfrom\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\Image\\";
                var    sanpham = db.SanPhams.SingleOrDefault(x => x.ID == idSanPham);
                pictureBox1.Image = Image.FromFile(href + sanpham.HinhAnh);
            }
        }
コード例 #2
0
ファイル: DAO_Main.cs プロジェクト: ogggy4858/Store
        public List <string> ListTenDanhMuc()
        {
            QuanLyKhoHangDataContext db    = new QuanLyKhoHangDataContext();
            List <string>            listt = new List <string>();
            var list = db.DanhMucSanPhams.Where(x => x.ID != 0).ToList();

            return(listt);
        }
コード例 #3
0
        private void lv_MouseClick(object sender, MouseEventArgs e)
        {
            db = new QuanLyKhoHangDataContext();
            string href = "H:\\project\\c#\\Wfrom\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\Image\\";
            var    id   = Convert.ToInt32(lv.SelectedItems[0].SubItems[0].Text);

            var hr = db.SanPhams.SingleOrDefault(x => x.ID == id);

            pictureBox1.Image = Image.FromFile(href + hr.HinhAnh);
        }
コード例 #4
0
ファイル: DAO_DangNhap.cs プロジェクト: ogggy4858/Store
        public int DangNhap(DTO_NhanVien nhanvien)
        {
            QuanLyKhoHangDataContext db = new QuanLyKhoHangDataContext();
            var nv = db.NhanViens.SingleOrDefault(x => x.TenTaiKhoan == nhanvien.Tentaikhoan);

            if (nv != null)
            {
                if (nv.MatKhau == nhanvien.Matkhau)
                {
                    return(1);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                return(0);
            }
        }
コード例 #5
0
        private void cbbSanPham_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cbbSanPham.SelectedValue.ToString() == "System.Data.DataRowView")
            {
            }
            else if (cbbSanPham.SelectedValue.ToString() == "QuanLyKhoHnag_ChuoiCuaHangTienIch.DTO.DTO_SanPham")
            {
            }
            else
            {
                var id = cbbSanPham.SelectedValue.ToString();
                idSanPham = Convert.ToInt32(id);
                DAO_Main main    = new DAO_Main();
                int      soluong = main.SoLuong(idSanPham);
                lbSoLuong.Text = soluong.ToString();
                FMain_Load(sender, e);

                db = new QuanLyKhoHangDataContext();
                string href    = "H:\\project\\c#\\Wfrom\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\QuanLyKhoHnag_ChuoiCuaHangTienIch\\Image\\";
                var    sanpham = db.SanPhams.SingleOrDefault(x => x.ID == idSanPham);
                pictureBox1.Image = Image.FromFile(href + sanpham.HinhAnh);
            }
        }