Пример #1
0
 void LoadComboBox()
 {
     cmBoxDSP.DataSource               = DongSanPhamBUS.GetAllDongSP();
     cmBoxDSP.DisplayMember            = "TenDong";
     cmBoxDSP.ValueMember              = "MaDSP";
     cmBoxNSX.DataSource               = HSXBUS.GetAllHSX();
     cmBoxNSX.ValueMember              = "MaHSX";
     cmBoxNSX.DisplayMember            = "TenHSX";
     cmBoxLoaiSP.DataSource            = LoaiSPBUS.GetAllLoaiSP();
     cmBoxLoaiSP.DisplayMember         = "TenLSP";
     cmBoxLoaiSP.ValueMember           = "MaLSP";
     comboBoxNoiNhapHang.DataSource    = CuaHangBUS.GetAllCuaHang();
     comboBoxNoiNhapHang.DisplayMember = "TenCuaHang";
     comboBoxNoiNhapHang.ValueMember   = "MaCuaHang";
     comboBoxNoiNhapHang.SelectedValue = "ts";
     if (IDHDNH == null)
     {
         //txtboxHSX.Visible = false;
         //txtBoxLSP.Visible = false;
         //txtBoxDSP.Visible = false;
         //txtboxGiaBan.Visible = false;
         //txtBoxKieuSP.Visible = false;
         //txtboxSP.Visible = false;
         txtBoxMaHDNH.ReadOnly = false;
         txtBoxMaNVNH.Text     = MaNV;
         groupBox2.Enabled     = false;
         //txtboxGiaBan.ReadOnly = false;
         //txtboxGiaNhap.ReadOnly = false;
         //txtboxGiaBan.Visible = true;
     }
 }
Пример #2
0
 public void LoadKhoHang()
 {
     khoHangBindingSource.DataSource = KhoHangBUS.GetAllKHoHang();
     cmBoxKhoHang.DataSource         = CuaHangBUS.GetAllCuaHang();
     cmBoxKhoHang.DisplayMember      = "TenCuaHang";
     cmBoxKhoHang.ValueMember        = "MaCuaHang";
 }
Пример #3
0
 void LoadSer()
 {
     dateTimePickerTrongNgay.Value = DateTime.Now;
     comboBoxTKSP.DataSource       = CuaHangBUS.GetCuaHangChiNhanh();
     comboBoxTKSP.DisplayMember    = "TenCuaHang";
     comboBoxTKSP.ValueMember      = "MaCuaHang";
 }
Пример #4
0
        private void btnXoaCH_Click(object sender, EventArgs e)
        {
            try
            {
                CuaHang ch = new CuaHang();


                if (txtboxDiaChiCH.Text != "" && txtboxMaCH.Text != "")
                {
                    ch.DiaChi     = txtboxDiaChiCH.Text;
                    ch.MaCuaHang  = cmBoxMaCH.SelectedValue.ToString();
                    ch.TenCuaHang = txtboxTenCuaHang.Text;
                    CuaHangBUS.XoaCH(ch);
                    MessageBox.Show("Xóa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Lỗi! Mã CH Hoặc Tên CH Không Được Điền", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch
            {
                MessageBox.Show("Lỗi! Không thể thực hiện thao tác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #5
0
 private void frmMainServer_Load(object sender, EventArgs e)
 {
     LoadKhoHang();
     PhanQuyen();
     CH        = CuaHangBUS.GetThongTinCuaHang(User.MaCuaHang);
     this.Text = CH.TenCuaHang;
 }
Пример #6
0
 private void frmMainClient_Load(object sender, EventArgs e)
 {
     // TODO: This line of code loads data into the 'galaxyMobileDataSet1.KhachHang' table. You can move, or remove it, as needed.
     //this.khachHangTableAdapter.Fill(this.galaxyMobileDataSet1.KhachHang);
     PhanQuyen();
     CH        = CuaHangBUS.GetThongTinCuaHang(User.MaCuaHang);
     this.Text = CH.TenCuaHang;
 }
Пример #7
0
 private void cmBoxKhoHang_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string  id = cmBoxKhoHang.SelectedValue.ToString();
         KhoHang kh = CuaHangBUS.GetMaKieuByMaCH(id, txtboxMaKieuSP.Text);
         txtSoLuongTonKho.Text = kh.SoLuong.ToString();
         txtboxMaKieuSP.Text   = kh.MaKieu.ToString();
     }
     catch { }
 }
Пример #8
0
        private void cmBoxMaCH_SelectedIndexChanged(object sender, EventArgs e)
        {
            var ch = CuaHangBUS.GetThongTinCuaHang(cmBoxMaCH.SelectedValue.ToString());

            if (ch != null)
            {
                txtboxTenCuaHang.Text = ch.TenCuaHang;
                txtboxDiaChiCH.Text   = ch.DiaChi;
                txtboxMaCH.Text       = ch.MaCuaHang;
            }
        }
Пример #9
0
        private void btnLuuCuaHang_Click(object sender, EventArgs e)
        {
            //try
            //{
            CuaHang ch = new CuaHang();

            if (IsNewCH)
            {
                if (txtboxDiaChiCH.Text != "" && txtboxTenCuaHang.Text != "" && txtboxTenCuaHang.Text != "")
                {
                    ch.DiaChi     = txtboxDiaChiCH.Text;
                    ch.MaCuaHang  = txtboxMaCH.Text;
                    ch.TenCuaHang = txtboxTenCuaHang.Text;
                    CuaHangBUS.ThemCH(ch);
                    MessageBox.Show("Thêm Thành Công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Lỗi! Mã CH Hoặc Tên CH Không Được Điền", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (txtboxDiaChiCH.Text != "" && txtboxMaCH.Text != "")
                {
                    ch.DiaChi     = txtboxDiaChiCH.Text;
                    ch.MaCuaHang  = cmBoxMaCH.SelectedValue.ToString();
                    ch.TenCuaHang = txtboxTenCuaHang.Text;
                    CuaHangBUS.SuaCH(ch);
                    MessageBox.Show("Chỉnh Sửa Thành Công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Lỗi! Mã CH Hoặc Tên CH Không Được Điền", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            //}
            //catch
            //{
            //    MessageBox.Show("Lỗi! Không thể thực hiện thao tác", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
            LoadCuaHang();
            txtboxTenCuaHang.ReadOnly = true;
            txtboxDiaChiCH.ReadOnly   = true;
            btnXoaCH.Visible          = true;
            btnChinhSuaCH.Visible     = true;
            btnThemCuaHang.Visible    = true;
            cmBoxMaCH.Visible         = true;

            btnLuuCuaHang.Visible    = false;
            btnHuyLuuCuaHang.Visible = false;
            IsNewCH = false;
        }
Пример #10
0
 private void frmChiTietTaiKhoan_Load(object sender, EventArgs e)
 {
     LoadChiTietTaiKhoan();
     cmBoxCuaHang.DataSource    = CuaHangBUS.GetAllCuaHang();
     cmBoxCuaHang.DisplayMember = "TenCuaHang";
     cmBoxCuaHang.ValueMember   = "MaCuaHang";
     cmBoxCuaHang.SelectedValue = User.MaCuaHang;
     cmBoxLoaiTK.DataSource     = LoaiTaiKhoanBUS.GetAllLoaiTaiKhoan();
     cmBoxLoaiTK.DisplayMember  = "TenLoaiTK";
     cmBoxLoaiTK.ValueMember    = "MaLoaiTK";
     cmBoxLoaiTK.SelectedValue  = User.MaLoaiTK;
 }
Пример #11
0
 void LoadTK()
 {
     taiKhoanBindingSource.DataSource = TaiKhoanBUS.GetAllTK();
     comboBoxUser.DataSource          = TaiKhoanBUS.GetAllTK();
     comboBoxUser.DisplayMember       = "UserName";
     comboBoxUser.ValueMember         = "UserName";
     comboBoxMaCHUser.DataSource      = CuaHangBUS.GetAllCuaHang();
     comboBoxMaCHUser.DisplayMember   = "TenCuaHang";
     comboBoxMaCHUser.ValueMember     = "MaCuaHang";
     comboBoxLoaiTK.DataSource        = LoaiTaiKhoanBUS.GetAllLoaiTaiKhoan();
     comboBoxLoaiTK.DisplayMember     = "TenLoaiTK";
     comboBoxLoaiTK.ValueMember       = "MaLoaiTK";
 }
 public ActionResult Create(LoaiSanPham lsp)
 {
     try
     {
         // TODO: Add insert logic here
         CuaHangBUS.ThemLSP(lsp);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Edit(String id, LoaiSanPham lsp)
        {
            try
            {
                // TODO: Add update logic here

                CuaHangBUS.UpdateLSP(id, lsp);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
        public ActionResult XoaTamThoiLSP(String id, LoaiSanPham lsp)
        {
            try
            {
                // TODO: Add delete logic here
                lsp.TinhTrang = "1";
                CuaHangBUS.UpdateLSP(id, lsp);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #15
0
        private void dgvNhanVien_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            cboCH.DataSource        = CuaHangBUS.GetAllCuaHang();
            cboCH.DisplayMember     = "TenCuaHang";
            cboCH.ValueMember       = "MaCuaHang";
            cboLoaiNV.DataSource    = LoaiNvBUS.GetLNV();
            cboLoaiNV.DisplayMember = "TenLoaiNV";
            cboLoaiNV.ValueMember   = "MaLoaiNV";

            // Lấy thứ tự record hiện hành
            int r = dgvNhanVien.CurrentCell.RowIndex;

            txtMaNV.Text            = dgvNhanVien.Rows[r].Cells[0].Value.ToString();
            cboCH.SelectedValue     = dgvNhanVien.Rows[r].Cells[1].Value.ToString();
            cboLoaiNV.SelectedValue = dgvNhanVien.Rows[r].Cells[2].Value.ToString();
            txtTenNV.Text           = dgvNhanVien.Rows[r].Cells[3].Value.ToString();
            cboSex.Text             = dgvNhanVien.Rows[r].Cells[4].Value.ToString();
            try
            {
                txtDiaChi.Text = dgvNhanVien.Rows[r].Cells[5].Value.ToString();
            }
            catch { txtDiaChi.Text = " "; }

            try
            {
                txtSDT.Text = dgvNhanVien.Rows[r].Cells[6].Value.ToString();
            }
            catch
            {
                txtSDT.Text = " ";
            }
            try
            {
                txtLuong.Text = dgvNhanVien.Rows[r].Cells[7].Value.ToString();
            }
            catch
            {
                txtLuong.Text = " ";
            }
        }
Пример #16
0
        public void LoadChiTietSP()
        {
            //try
            //{
            LoadSP();
            //}
            //catch
            //{

            //}
            comboBoxCHNhan.DataSource    = CuaHangBUS.GetAllCuaHang();
            comboBoxCHNhan.DisplayMember = "TenCuaHang";
            comboBoxCHNhan.ValueMember   = "MaCuaHang";
            comboBoxCHPP.DataSource      = CuaHangBUS.GetAllCuaHang();
            comboBoxCHPP.DisplayMember   = "TenCuaHang";
            comboBoxCHPP.ValueMember     = "MaCuaHang";
            comboBoxNXS.DataSource       = HSXBUS.GetAllHSX();
            comboBoxNXS.DisplayMember    = "TenHSX";
            comboBoxNXS.ValueMember      = "MaHSX";
            comboBoxNXS.SelectedValue    = DSp.MaHSX;
            comboBoxDSP.DataSource       = DongSanPhamBUS.GetAllDongSPByMaHSX(DSp.MaHSX);
            comboBoxDSP.DisplayMember    = "TenDong";
            comboBoxDSP.ValueMember      = "MaDSP";
            comboBoxDSP.SelectedValue    = DSp.MaDSP;
            comboBoxSP.DataSource        = SanPhamBUS.GetSanPhamByMaDSP(DSp.MaDSP);
            comboBoxSP.DisplayMember     = "TenSP";
            comboBoxSP.ValueMember       = "MaSP";
            comboBoxSP.SelectedValue     = Sp.MaSP;
            comboBoxMaKieu.DataSource    = ChiTietSPBUS.GetChiTietSPByIDSP(Sp.MaSP);
            comboBoxMaKieu.DisplayMember = "MaKieu";
            comboBoxMaKieu.ValueMember   = "MaKieu";
            CtSp = ChiTietSPBUS.Get1ChiTietSPByIDMaKieu(IDMaKieu);
            comboBoxMaKieu.SelectedValue    = CtSp.MaKieu;
            textBoxSLTonKieu.Text           = CtSp.SoluongSP.ToString();
            pictureBox.BackgroundImage      = ConverBinaryToImage(CtSp.Anh);
            khoHangBindingSource.DataSource = KhoHangBUS.GetAllKhoHangByMaKieu(CtSp.MaKieu);
        }
Пример #17
0
        private void frmInHoaDon_Load(object sender, EventArgs e)
        {
            InHoaDon_ResultBindingSource.DataSource = HoaDonBUS.InHD(IDHD, IDCH);
            HoaDon    hd = HoaDonBUS.Get1HD(IDHD, IDCH);
            KhachHang kh = KHBUS.GetKHByMAKH(hd.MaKH);
            CuaHang   ch = CuaHangBUS.GetThongTinCuaHang(hd.MaCuaHang);

            Microsoft.Reporting.WinForms.ReportParameter[] rParams = new Microsoft.Reporting.WinForms.ReportParameter[]
            {
                new Microsoft.Reporting.WinForms.ReportParameter("DateNhap", hd.NgayLapHD.ToShortDateString().ToString()),
                new Microsoft.Reporting.WinForms.ReportParameter("TongTien", ChiTietHoaDonBUS.TinhTien_ByMaHD(IDHD, IDCH).ToString()),
                new Microsoft.Reporting.WinForms.ReportParameter("TenCH", ch.TenCuaHang),
                new Microsoft.Reporting.WinForms.ReportParameter("DiaChi", ch.DiaChi),
                new Microsoft.Reporting.WinForms.ReportParameter("TenNguoiMua", kh.TenKH),
                new Microsoft.Reporting.WinForms.ReportParameter("DiaChiNguoiMua", kh.DiaChi),
                new Microsoft.Reporting.WinForms.ReportParameter("SDT", kh.SDT),
                new Microsoft.Reporting.WinForms.ReportParameter("HtGiaoHang", hd.HTGiaoHang),
                new Microsoft.Reporting.WinForms.ReportParameter("MaHD", IDHD)
            };


            reportInHD.LocalReport.SetParameters(rParams);
            this.reportInHD.RefreshReport();
        }
        // GET: Admin/LoaiSanPhamAdmin
        public ActionResult Index()
        {
            var db = CuaHangBUS.DanhSachLSPAdmin();

            return(View(db));
        }
Пример #19
0
 // GET: Admin/SanPham/Edit/5
 public ActionResult Edit(string id)
 {
     ViewBag.MaNSX    = new SelectList(NhaSanXuatBUS.DanhSach(), "MaNSX", "TenNSX", PetproShopBUS.ChiTiet(id).MaNSX);
     ViewBag.MaLoaiSP = new SelectList(CuaHangBUS.DanhSach(), "MaLoaiSP", "TenLoaiSP", PetproShopBUS.ChiTiet(id).MaLoaiSP);
     return(View(PetproShopBUS.ChiTiet(id)));
 }
        //------------------------------------------------------------------------------

        //public ActionResult Create()
        //{
        //    return View();
        //}

        //// POST: Admin/NhaSanXuat/Create
        //[HttpPost]
        //public ActionResult Create(LoaiSanPham lsp)
        //{
        //    try
        //    {
        //        // TODO: Add insert logic here
        //        CuaHangBUS.ThemLSP(lsp);
        //        return RedirectToAction("Index");
        //    }
        //    catch
        //    {
        //        return View();
        //    }
        //}

        //------------------------------------------------------------------------------

        // GET: Admin/LoaiSanPhamAdmin/Edit/5
        public ActionResult Edit(String id)
        {
            return(View(CuaHangBUS.ChiTietLSPAdmin(id)));
        }
 public ActionResult XoaTamThoiLSP(String id)
 {
     return(View(CuaHangBUS.ChiTietLSPAdmin(id)));
 }
Пример #22
0
 void LoadCuaHang()
 {
     cmBoxMaCH.DataSource    = CuaHangBUS.GetAllCuaHang();
     cmBoxMaCH.DisplayMember = "TenCuaHang";
     cmBoxMaCH.ValueMember   = "MaCuaHang";
 }
Пример #23
0
 // GET: Admin/SanPham/Create
 public ActionResult Create()
 {
     ViewBag.MaNSX    = new SelectList(NhaSanXuatBUS.DanhSach(), "MaNSX", "TenNSX");
     ViewBag.MaLoaiSP = new SelectList(CuaHangBUS.DanhSach(), "MaLoaiSP", "TenLoaiSP");
     return(View());
 }
Пример #24
0
        // GET: CuaHang
        public ActionResult Index(String id, int page = 1, int pagesize = 9)
        {
            var ds = CuaHangBUS.ChiTiet(id).ToPagedList(page, pagesize);

            return(View(ds));
        }