Exemple #1
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <CauHinh>        data = db.CauHinh.ToList <CauHinh>();

            dgvCauHinh.DataSource = data;
            dgvCauHinh.DataBind();
        }
Exemple #2
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <Multimedia>     data = db.Multimedia.ToList <Multimedia>();

            dgvAnhHH.DataSource = data;
            dgvAnhHH.DataBind();
        }
Exemple #3
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <NhanVien>       data = db.NhanVien.ToList <NhanVien>();

            dgvNhanVien.DataSource = data;
            dgvNhanVien.DataBind();
        }
Exemple #4
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <NguonHang>      data = db.NguonHang.ToList <NguonHang>();

            dgvNguonHang.DataSource = data;
            dgvNguonHang.DataBind();
        }
Exemple #5
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <CTHoaDonBan>    data = db.CTHoaDonBan.ToList <CTHoaDonBan>();

            dgvCTHoaDonBan.DataSource = data;
            dgvCTHoaDonBan.DataBind();
        }
Exemple #6
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <HangHoa>        data = db.HangHoa.ToList <HangHoa>();

            dgvHangHoa.DataSource = data;
            dgvHangHoa.DataBind();
        }
Exemple #7
0
        void getData()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <HangHoa>        data = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Take(4).ToList <HangHoa>();

            rpBanner.DataSource = data;
            rpBanner.DataBind();

            List <HangHoa> data_2 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(4).Take(1).ToList <HangHoa>();

            rpVanPhongPham.DataSource = data_2;
            rpVanPhongPham.DataBind();

            List <HangHoa> data_3 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(5).Take(1).ToList <HangHoa>();

            rpPhuKien.DataSource = data_3;
            rpPhuKien.DataBind();

            List <HangHoa> data_4 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(6).Take(1).ToList <HangHoa>();

            rpTrangSuc.DataSource = data_4;
            rpTrangSuc.DataBind();

            List <HangHoa> data_5 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(7).Take(1).ToList <HangHoa>();

            rpTrangTri.DataSource = data_5;
            rpTrangTri.DataBind();

            List <HangHoa> data_6 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(8).Take(4).ToList <HangHoa>();

            rpSanPhamNoiBat.DataSource = data_6;
            rpSanPhamNoiBat.DataBind();

            List <HangHoa> data_7 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(12).Take(4).ToList <HangHoa>();

            rpSanPhamMoi_1.DataSource = data_7;
            rpSanPhamMoi_1.DataBind();

            List <HangHoa> data_8 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(16).Take(4).ToList <HangHoa>();

            rpSanPhamMoi_2.DataSource = data_8;
            rpSanPhamMoi_2.DataBind();

            List <HangHoa> data_9 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(20).Take(4).ToList <HangHoa>();

            rpSanPhamBanChay.DataSource = data_9;
            rpSanPhamBanChay.DataBind();

            //List<HangHoa> data_10 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(26).Take(3).ToList<HangHoa>();
            //rpXuHuong_1.DataSource = data_10;
            //rpXuHuong_1.DataBind();

            //List<HangHoa> data_11 = db.HangHoa.OrderByDescending(x => x.SoLuongTon).Skip(29).Take(3).ToList<HangHoa>();
            //rpXuHuong_2.DataSource = data_11;
            //rpXuHuong_2.DataBind();
        }
Exemple #8
0
        public void getTenCTKM()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <CTKM>           data = db.CTKM.ToList <CTKM>();

            //Hien thi len combobox
            cmbMaCTKM.DataSource     = data;
            cmbMaCTKM.DataTextField  = "TenCTKM";
            cmbMaCTKM.DataValueField = "MaCTKM";
            //Render ma html
            cmbMaCTKM.DataBind();
        }
        public void getMaHoaDonBan()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <HoaDonBan>      data = db.HoaDonBan.ToList <HoaDonBan>();

            //Hien thi len combobox
            cmbMaHoaDonBan.DataSource     = data;
            cmbMaHoaDonBan.DataTextField  = "MaHoaDonBan";
            cmbMaHoaDonBan.DataValueField = "MaHoaDonBan";
            //Render ma html
            cmbMaHoaDonBan.DataBind();
        }
Exemple #10
0
        public void getTenNhanVien()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <NhanVien>       data = db.NhanVien.ToList <NhanVien>();

            //Hien thi len combobox
            cmbMaNhanVien.DataSource     = data;
            cmbMaNhanVien.DataTextField  = "TenNhanVien";
            cmbMaNhanVien.DataValueField = "MaNhanVien";
            //Render ma html
            cmbMaNhanVien.DataBind();
        }
Exemple #11
0
        public void getTenKhachHang()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <KhachHang>      data = db.KhachHang.ToList <KhachHang>();

            //Hien thi len combobox
            cmbMaKhachHang.DataSource     = data;
            cmbMaKhachHang.DataTextField  = "TenKhachHang";
            cmbMaKhachHang.DataValueField = "MaKhachHang";
            //Render ma html
            cmbMaKhachHang.DataBind();
        }
Exemple #12
0
        public void getLoaiHangHoa()
        {
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            List <LoaiHangHoa>    data = db.LoaiHangHoa.ToList <LoaiHangHoa>();

            //Hien thi len combobox
            cmbMaLoai.DataSource     = data;
            cmbMaLoai.DataTextField  = "TenLoai";
            cmbMaLoai.DataValueField = "MaLoai";
            //Render ma html
            cmbMaLoai.DataBind();
        }
Exemple #13
0
 public string getTenNhanVien(object MaNhanVien)
 {
     try
     {
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         NhanVien data            = db.NhanVien.FirstOrDefault(x => x.MaNhanVien == MaNhanVien.ToString());
         return(data.TenNhanVien);
     }
     catch
     {
         return("");
     }
 }
Exemple #14
0
 public string getTenHangHoa(object MaHangHoa)
 {
     try
     {
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         HangHoa data             = db.HangHoa.FirstOrDefault(x => x.MaHangHoa == MaHangHoa.ToString());
         return(data.TenHangHoa);
     }
     catch
     {
         return("");
     }
 }
Exemple #15
0
 public string getMaHoaDonNhap(object MaHoaDonNhap)
 {
     try
     {
         QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
         HoaDonNhap            data = db.HoaDonNhap.FirstOrDefault(x => x.MaHoaDonNhap == MaHoaDonNhap.ToString());
         return(data.MaHoaDonNhap);
     }
     catch
     {
         return("");
     }
 }
Exemple #16
0
 public string getTenNguonHang(object MaNguonHang)
 {
     try
     {
         QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
         NguonHang             data = db.NguonHang.FirstOrDefault(x => x.MaNguonHang == MaNguonHang.ToString());
         return(data.TenNguonHang);
     }
     catch
     {
         return("");
     }
 }
Exemple #17
0
 public string getTenCTKM(object MaCTKM)
 {
     try
     {
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         CTKM data = db.CTKM.FirstOrDefault(x => x.MaCTKM == MaCTKM.ToString());
         return(data.TenCTKM);
     }
     catch
     {
         return("");
     }
 }
Exemple #18
0
 public string getTenLoai(object MaLoai)
 {
     try
     {
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         int         maloai       = Convert.ToInt32(MaLoai.ToString());
         LoaiHangHoa data         = db.LoaiHangHoa.FirstOrDefault(x => x.MaLoai == maloai);
         return(data.TenLoai);
     }
     catch
     {
         return("");
     }
 }
Exemple #19
0
        public string getAnhDaiDien(string MaHangHoa)
        {
            QLBH_D12TMDTEntities1 db  = new QLBH_D12TMDTEntities1();
            Multimedia            obj = db.Multimedia.FirstOrDefault(x => x.MaHangHoa == MaHangHoa);

            if (obj == null)
            {
                return("");
            }
            else
            {
                return(obj.Url);
            }
        }
Exemple #20
0
        protected void btnXoa_Command(object sender, CommandEventArgs e)
        {
            //code de xoa du lieu voi ma lop nien che luu trong commandArgument
            string MaCTKM = e.CommandArgument.ToString();
            //xoa du lieu trong database
            //tao doi tuong truy van
            QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
            CTKM data = db.CTKM.FirstOrDefault(x => x.MaCTKM == MaCTKM);

            if (data != null)
            {
                db.CTKM.Remove(data);
                db.SaveChanges();
                getData();
            }
        }
Exemple #21
0
        protected void btnXoa_Command(object sender, CommandEventArgs e)
        {
            //code de xoa du lieu voi ma lop nien che luu trong commandArgument

            int ID = Convert.ToInt32(e.CommandArgument.ToString());
            //xoa du lieu trong database
            //tao doi tuong truy van
            QLBH_D12TMDTEntities1 db   = new QLBH_D12TMDTEntities1();
            Multimedia            data = db.Multimedia.FirstOrDefault(x => x.ID == ID);

            if (data != null)
            {
                db.Multimedia.Remove(data);
                db.SaveChanges();
                getData();
            }
        }
Exemple #22
0
        protected void btnDangNhap_Click(object sender, EventArgs e)
        {
            QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
            string MaNhanVien        = txtTaiKhoan.Text;
            string MatKhau           = txtMatKhau.Text;
            int    soluong           = db.NhanVien.Count(x => x.MaNhanVien == MaNhanVien && x.MatKhau == MatKhau);

            if (soluong == 1)
            {
                // luu trang thai dang nhap vao sesion
                Session["MaNhanVien"] = MaNhanVien;
                Response.Redirect("QLHangHoa.aspx");
            }
            else
            {
                lbThongBao.Text = "Đăng nhập thất bại!";
            }
        }
Exemple #23
0
 protected void btnThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         //Trường hợp thêm mới
         CTKM obj = new CTKM();
         obj.MaCTKM   = txtMaCTKM.Text;
         obj.TenCTKM  = txtTenCTKM.Text;
         obj.GiaTriKM = Convert.ToInt32(txtGiaTriKM.Text);
         obj.LoaiKM   = Convert.ToInt32(txtLoaiKM.Text);
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         db.CTKM.Add(obj);
         db.SaveChanges();
         Response.Redirect("QLCTKM.aspx");
     }
     catch
     {
         pnError.Visible = true;
     }
 }
Exemple #24
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                string MaCTKM            = txtMaCTKM.Text;
                CTKM   obj = db.CTKM.FirstOrDefault(x => x.MaCTKM == MaCTKM);
                obj.MaCTKM   = txtMaCTKM.Text;
                obj.TenCTKM  = txtTenCTKM.Text;
                obj.GiaTriKM = Convert.ToInt32(txtGiaTriKM.Text);
                obj.LoaiKM   = Convert.ToInt32(txtLoaiKM.Text);

                db.SaveChanges();
                Response.Redirect("QLCTKM.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
Exemple #25
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                string   MaNhanVien      = txtMaNhanVien.Text;
                NhanVien obj             = db.NhanVien.FirstOrDefault(x => x.MaNhanVien == MaNhanVien);
                obj.MaNhanVien  = txtMaNhanVien.Text;
                obj.TenNhanVien = txtTenNhanVien.Text;
                obj.MatKhau     = txtMatKhau.Text;
                obj.SoDienThoai = txtSoDienThoai.Text;

                db.SaveChanges();
                Response.Redirect("QLNhanVien.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
Exemple #26
0
        protected void btnThemMoi_Click(object sender, EventArgs e)
        {
            try
            {
                //Trường hợp thêm mới
                HangHoa obj = new HangHoa();
                obj.MaHangHoa  = txtMaHangHoa.Text;
                obj.TenHangHoa = txtTenHangHoa.Text;
                obj.SoLuongTon = Convert.ToInt32(txtSoLuongTon.Text);
                obj.DonGia     = Convert.ToInt32(txtDonGia.Text);
                obj.DonViTinh  = txtDonViTinh.Text;
                obj.MaLoai     = Convert.ToInt32(cmbMaLoai.SelectedValue);
                obj.MoTa       = txtMoTa.Text;
                //lưu dữ liệu vào db
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                db.HangHoa.Add(obj);
                db.SaveChanges();
                //Upload file về sever
                string filename = "";
                if (fuAnhHH.HasFile)
                {
                    string ext = Path.GetFileName(fuAnhHH.FileName);
                    ext = ext.Split('.')[ext.Split('.').Length - 1];
                    // Tự sinh tên file đảm bảo tính duy nhất => Dùng thời gian upload file để sinh tên file
                    filename = DateTime.Now.ToString("yyyyMMddhhmmssffff") + "." + ext;
                    fuAnhHH.SaveAs(Server.MapPath("~/UpLoads/") + filename);
                    Multimedia newobj = new Multimedia();
                    newobj.MaHangHoa = obj.MaHangHoa;
                    newobj.Alt       = obj.TenHangHoa;
                    newobj.Url       = filename;
                    db.Multimedia.Add(newobj);
                    db.SaveChanges();
                }

                Response.Redirect("QLHangHoa.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
Exemple #27
0
 protected void btnThemMoi_Click(object sender, EventArgs e)
 {
     try
     {
         //Trường hợp thêm mới
         NhanVien obj = new NhanVien();
         obj.MaNhanVien  = txtMaNhanVien.Text;
         obj.TenNhanVien = txtTenNhanVien.Text;
         obj.MatKhau     = txtMatKhau.Text;
         obj.SoDienThoai = txtSoDienThoai.Text;
         //lưu dữ liệu vào db
         QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
         db.NhanVien.Add(obj);
         db.SaveChanges();
         Response.Redirect("QLNhanVien.aspx");
     }
     catch
     {
         pnError.Visible = true;
     }
 }
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                string     MaHoaDonNhap  = txtMaHoaDonNhap.Text;
                HoaDonNhap obj           = db.HoaDonNhap.FirstOrDefault(x => x.MaHoaDonNhap == MaHoaDonNhap);
                obj.MaHoaDonNhap = txtMaHoaDonNhap.Text;
                obj.NgayNhap     = Convert.ToDateTime(txtNgayNhap.Text);
                obj.MaNhanVien   = cmbMaNhanVien.SelectedValue;
                obj.TongGiaTri   = Convert.ToInt32(txtTongGiaTri.Text);
                obj.MaNguonHang  = cmbMaNguonHang.SelectedValue;
                db.SaveChanges();

                Response.Redirect("QLPhieuNhap.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
Exemple #29
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                string       MaCTHDNhap  = txtMaCTHDNhap.Text;
                CTHoaDonNhap obj         = db.CTHoaDonNhap.FirstOrDefault(x => x.MaCTHDNhap == MaCTHDNhap);
                obj.MaCTHDNhap   = txtMaCTHDNhap.Text;
                obj.MaHangHoa    = cmbMaHangHoa.SelectedValue;
                obj.SoLuong      = Convert.ToInt32(txtSoLuong.Text);
                obj.DonGiaNhap   = Convert.ToInt32(txtDonGiaNhap.Text);
                obj.MaHoaDonNhap = cmbMaHoaDonNhap.SelectedValue;
                db.SaveChanges();

                Response.Redirect("QLCTPhieuNhap.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }
Exemple #30
0
        protected void btnLuu_Click(object sender, EventArgs e)
        {
            try
            {
                QLBH_D12TMDTEntities1 db = new QLBH_D12TMDTEntities1();
                string    MaHoaDonBan    = txtMaHoaDonBan.Text;
                HoaDonBan obj            = db.HoaDonBan.FirstOrDefault(x => x.MaHoaDonBan == MaHoaDonBan);
                obj.MaHoaDonBan = txtMaHoaDonBan.Text;
                obj.MaNhanVien  = cmbMaNhanVien.SelectedValue;
                obj.MaKhachHang = cmbMaKhachHang.SelectedValue;
                obj.NgayBan     = Convert.ToDateTime(txtNgayBan.Text);
                obj.MaCTKM      = cmbMaCTKM.SelectedValue;

                db.SaveChanges();

                Response.Redirect("QLHoaDonBan.aspx");
            }
            catch
            {
                pnError.Visible = true;
            }
        }