Exemplo n.º 1
0
 public FormNhapSP()
 {
     InitializeComponent();
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     if (bus.getDataTable("SANPHAM") == null)
     {
         txtMaSP.Text = "SP001";
         return;
     }
     try
     {
         string str = bus.getThongTinSP(0, bus.getDataTable("SANPHAM").Rows.Count - 1);
         str = str.Remove(0, 2);
         int temp = str.Length;
         str = (Convert.ToInt32(str) + 1).ToString();
         while (str.Length < temp)
         {
             str = "0" + str;
         }
         string masp = "SP";
         masp        += str;
         txtMaSP.Text = masp;
     }
     catch (Exception ex) { }
 }
Exemplo n.º 2
0
        public FormCapNhatNhaCungCap(string mancc)
        {
            InitializeComponent();
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_NhaCungCap[]      NV  = bus.search_NhaCungCap(mancc);
            DTO_NhaCungCap        ncc = NV[0];

            lbl_MaDN.Text      = mancc;
            TbTenNCC.Text      = ncc.TENNCC;
            TbDiaChi.Text      = ncc.DIACHI;
            dateHT.Text        = ncc.NGHT;
            TbMucDo.Text       = ncc.MUCDOCC;
            TbTrangThai.Text   = ncc.TRANGTHAI;
            TbSdt.Text         = ncc.SDT;
            this.StartPosition = FormStartPosition.CenterScreen;

            string ma = lbl_MaDN.Text;

            if (System.IO.File.Exists(Application.StartupPath + "/HinhAnhNCC/" + ma + ".jpg"))
            {
                avatar.Image = Image.FromFile(Application.StartupPath + "/HinhAnhNCC/" + ma + ".jpg");
            }
            else
            if (System.IO.File.Exists(Application.StartupPath + "/HinhAnhNCC/" + ma + ".png"))
            {
                avatar.Image = Image.FromFile(Application.StartupPath + "/HinhAnhNCC/" + ma + ".png");
            }
            else
            {
                avatar.Image = Image.FromFile(Application.StartupPath + "/HinhAnhNCC/None.jpg");
            }
        }
Exemplo n.º 3
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            //string Ngsinh = TranDateFormat.Trans(dateNgSinh.Text);
            //string NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            string       Ngsinh   = DateChange.ToString(dateNgSinh.DateTime);
            string       NgVaoLam = DateChange.ToString(dateNgVaoLam.DateTime);
            DTO_NhanVien NV       = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, comboBoxChucVu.SelectedItem.ToString(),
                                                     NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.suaData(NV) == false)
            {
                //MessageBox.Show("Có lỗi xảy ra! Không thành công");
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra! Sửa không thành công!");
                noti.Width  = 800;
                noti.Height = 30;
                this.labelControl.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            else
            {
                PushNoti noti1 = new PushNoti("Success", "Cập nhật thông tin thành công!");
                noti1.Width  = 800;
                noti1.Height = 30;
                this.labelControl.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
            }
            //Close();
        }
Exemplo n.º 4
0
 public FormNhapNhanVien()
 {
     InitializeComponent();
     comboBoxChucVu.SelectedIndex = 3;
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     if (bus.getDataTable("NHANVIEN") == null)
     {
         txtMaNV.Text = "NV001";
         return;
     }
     try
     {
         string str = bus.getThongTinNV(0, bus.getDataTable("NHANVIEN").Rows.Count - 1);
         str = str.Remove(0, 2);
         int temp = str.Length;
         str = (Convert.ToInt32(str) + 1).ToString();
         while (str.Length < temp)
         {
             str = "0" + str;
         }
         string manv = "NV";
         manv        += str;
         txtMaNV.Text = manv;
     }
     catch (Exception ex) { }
 }
Exemplo n.º 5
0
        private void CapNhat_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_SanPham           SP  = new DTO_SanPham();

            SP.MASP      = lblMaSP.Text;
            SP.TENSP     = txtTenSP.Text;
            SP.DONGIA    = txtGiaBan.Text;
            SP.SLUONG    = txtSoLuong.Text;
            SP.MANCC     = MaNCC;
            SP.LOINHUAN  = txtLoiNhuan.Text;
            SP.TRANGTHAI = txtTrangThai.Text;
            if (!bus.suaData(SP))
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra! Sửa không thành công!");
                noti.Width  = this.Width;
                noti.Height = 30;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            else
            {
                PushNoti noti1 = new PushNoti("Success", "Cập nhật thông tin thành công!");
                noti1.Width  = this.Width;
                noti1.Height = 30;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
            }
        }
Exemplo n.º 6
0
        static public string check_Nhap(DTO_NhanVien nv)
        {
            string error = "";

            Stelia_BUS.Stelia_BUS bus      = new Stelia_BUS.Stelia_BUS();
            DTO_NhanVien[]        nhanvien = bus.search_NhanVien(nv.MANV);
            DataTable             kh       = bus.getDataTable("KHACHHANG");

            if (nhanvien[0].MANV == nv.MANV)
            {
                error += "Mã nhân viên này đã tồn tại";
            }
            foreach (DataRow row in kh.Rows)
            {
                if (nv.MANV == row[0].ToString())
                {
                    error += " Mã nhân viên này trùng với một mã khách hàng!";
                    break;
                }
            }
            if (nv.GIOITINH != "Nữ" && nv.GIOITINH != "Nam" && nv.GIOITINH != "Khác")
            {
                error += " " + "Giới tính chỉ được {Nam, Nữ, Khác}";
            }
            return(error);
        }
Exemplo n.º 7
0
        private void PictureBox9_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_NhaCungCap        NCC = new DTO_NhaCungCap();

            NCC.MANCC     = txtMa.Text;
            NCC.TENNCC    = txtTen.Text;
            NCC.NGHT      = dateNgHT.Text;
            NCC.DIACHI    = txtDiaChi.Text;
            NCC.SDT       = txtHotLine.Text;
            NCC.MUCDOCC   = txtMucDo.Text;
            NCC.TRANGTHAI = txtTrangThai.Text;

            if (bus.themData(NCC))
            {
            }
            else
            {
                MessageBox.Show("Có vấn đề xảy ra mời bạn xem lại! Không thành công");
                return;
            }
            string desAnh = Application.StartupPath + "/HinhAnhNCC/" + txtMa.Text + ".jpg";

            if (fileAnh != "")
            {
                if (File.Exists(desAnh))
                {
                    File.Delete(desAnh);
                }
                File.Copy(fileAnh, desAnh);
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 8
0
        private void TxtTimKiem_TextChanged(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_SanPham[]         SP  = bus.search_SANPHAM(txtTimKiem.Text);

            string ma = SP[0].MASP;

            if (System.IO.File.Exists(Application.StartupPath + "/HinhSanPham/" + ma + ".jpg"))
            {
                picAnhSP.Image = Image.FromFile(Application.StartupPath + "/HinhSanPham/" + ma + ".jpg");
            }
            else
            {
                picAnhSP.Image = Image.FromFile(Application.StartupPath + "/HinhSanPham/" + ma + ".png");
            }

            lblSoLuong.Text = "x" + SP[0].SLUONG;
            lblTenSP.Text   = SP[0].TENSP;
            // MessageBox.Show(SP[0].DONGIA);
            DonGia          = int.Parse(TranDateFormat.SubString(SP[0].DONGIA));
            SoLuong         = int.Parse(TranDateFormat.SubString(SP[0].SLUONG));
            MaSP            = SP[0].MASP;
            txtSoLuong.Text = "";
            lblDonGia.Text  = "0";
        }
Exemplo n.º 9
0
        private void FormKhachHang_Load(object sender, EventArgs e)
        {
            lbl1.BackColor = lbl2.BackColor = Color.FromArgb(39, 174, 96);
            lbl3.BackColor = lbl4.BackColor = Color.FromArgb(39, 174, 96);
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang[]       KH  = bus.search_KhachHang(MaKH);
            lblHoTen.Text    = KH[0].HOTEN;
            lblDiaChi.Text   = KH[0].DIACHI;
            lblDiemTL.Text   = TranDateFormat.SubString(KH[0].DIEMTL);
            lblGioiTinh.Text = KH[0].GIOITINH;
            lblLoaiThe.Text  = KH[0].LOAIKH;
            lblNgDK.Text     = TranDateFormat.SubString(KH[0].NGDK);
            lblNgSinh.Text   = TranDateFormat.SubString(KH[0].NGSINH);
            lblMaKH.Text     = KH[0].MAKH;
            string ma = MaKH;

            if (System.IO.File.Exists(Application.StartupPath + "/HinhKhachHang/" + ma + ".jpg"))
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/" + ma + ".jpg");
            }
            else
            if (System.IO.File.Exists(Application.StartupPath + "/HinhKhachHang/" + ma + ".png"))
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/" + ma + ".png");
            }
            else
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/None.jpg");
            }

            txtTimKiem.Text = " ";
            txtTimKiem.Text = "";
            XuatThongTinSP(bus.search_SANPHAM("SP001")[0]);
        }
Exemplo n.º 10
0
 public FormNhapNCC()
 {
     InitializeComponent();
     this.StartPosition = FormStartPosition.CenterScreen;
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     if (bus.getDataTable("NHACUNGCAP") == null)
     {
         txtMa.Text = "NCC001";
         return;
     }
     try
     {
         string str = bus.getThongTinNCC(0, bus.getDataTable("NHACUNGCAP").Rows.Count - 1);
         str = str.Remove(0, 3);
         int temp = str.Length;
         str = (Convert.ToInt32(str) + 1).ToString();
         while (str.Length < temp)
         {
             str = "0" + str;
         }
         string masp = "NCC";
         masp      += str;
         txtMa.Text = masp;
     }
     catch (Exception ex) { }
 }
Exemplo n.º 11
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            string       Ngsinh   = TranDateFormat.Trans(dateNgSinh.Text);
            string       NgVaoLam = TranDateFormat.Trans(dateNgVaoLam.Text);
            DTO_NhanVien NV       = new DTO_NhanVien(txtMaNV.Text, txtHoTen.Text, Ngsinh, txtChucVu.Text,
                                                     NgVaoLam, txtGioiTinh.Text, txtLuong.Text, "0", "0");

            string error = CheckThongTin.check_Nhap(NV);

            if (error != "")
            {
                MessageBox.Show(error);
                return;
            }

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.themData(NV) == false)
            {
                MessageBox.Show("Thêm nhân viên không thành công");
                return;
            }
            else
            {
                MessageBox.Show("Bạn đã thêm nhân viên thành công");
            }
            Close();
        }
Exemplo n.º 12
0
        private void picTaoHoaDon_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            string str = bus.getThongTinHD(0, bus.getDataTable("HOADON").Rows.Count - 1);

            str = str.Remove(0, 2);
            str = (Convert.ToInt32(str) + 1).ToString();
            string mahd = "HD0000000000";

            mahd  = mahd.Remove(mahd.Length - str.Length);
            mahd += str;
            DTO_HoaDon hd = new DTO_HoaDon(mahd, ThongTinDangNhap.Username, txtMaKH.Text, DateChange.ToString(dateNgHD.DateTime), lblTongTienHang.Text, txtGiamGia.Text, lblThanhTien.Text);

            bus.themData(hd);
            foreach (UserControlPanelSanPham sp in flowGioHang.Controls)
            {
                sp.ThemData(mahd);
            }
            Bill bill = new Bill();

            bill.DataSource = new Stelia_BUS.Stelia_BUS().InHoaDon(mahd);
            bill.ShowPreviewDialog();
            bill.PrintDialog();
            if (ThongTinDangNhap.Username == "admin")
            {
                return;
            }
            DTO_NhanVien[] nv = new Stelia_BUS.Stelia_BUS().search_NhanVien(ThongTinDangNhap.Username);
            nv[0].DOANHTHU += ThanhTien;
            nv[0].SLHD     += 1;
            bus.suaData(nv[0]);
        }
Exemplo n.º 13
0
        private void pictureBox4_Click(object sender, EventArgs e)
        {
            if (ThongTinDangNhap.Username != "admin")
            {
                MessageBox.Show("Chỉ admin mới có quyền thêm tài khoản cho nhân viên!");
                return;
            }
            Stelia_BUS.Stelia_BUS bus       = new Stelia_BUS.Stelia_BUS();
            DataTable             infotable = bus.getDataTable("TAIKHOAN");

            foreach (DataRow row in infotable.Rows)
            {
                if (lblMaNV.Text == row[0].ToString())
                {
                    MessageBox.Show("Đã tạo tài khoản cho nhân viên này rồi! Để thay đổi mật khẩu, truy cập danh sách tài khoản!");
                    return;
                }
            }
            FormTaoTaiKhoanNhanVien tao = new FormTaoTaiKhoanNhanVien(lblMaNV.Text);

            tao.ShowDialog();
            if (tao.DialogResult == DialogResult.OK)
            {
                PushNoti noti1 = new PushNoti("Success", "Tạo tài khoản đăng nhập cho nhân viên này thành công!");
                noti1.Width = this.Width;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
            }
        }
Exemplo n.º 14
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.MAKH     = txtMaKH.Text;
            KH.GIOITINH = cbxGioiTinh.Text;
            KH.LOAIKH   = cbxLoaiThe.Text;
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            KH.NGDK   = DateChange.ToString(dateNgDK.DateTime);
            KH.NGSINH = DateChange.ToString(dateNgSinh.DateTime);
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = txtDiemTL.Text;

            if (bus.themData(KH) == false)
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, thêm khách hàng không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            MaKH         = KH.MAKH;
            DialogResult = DialogResult.OK;
            Close();
        }
Exemplo n.º 15
0
        private void Pic_UpdateNCC_Click(object sender, EventArgs e)
        {
            string         NGHT = DateChange.ToString(dateHT.DateTime);
            DTO_NhaCungCap NCC  = new DTO_NhaCungCap(lbl_MaDN.Text, TbTenNCC.Text, NGHT, TbDiaChi.Text, TbSdt.Text, TbMucDo.Text, TbTrangThai.Text);

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.suaData(NCC) == false)
            {
                //MessageBox.Show("Có lỗi xảy ra! Không thành công");
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra! Sửa không thành công!");
                noti.Width  = this.Width;
                noti.Height = 30;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
                return;
            }
            else
            {
                PushNoti noti1 = new PushNoti("Success", "Cập nhật thông tin thành công!");
                noti1.Width  = this.Width;
                noti1.Height = 30;
                this.Controls.Add(noti1);
                noti1.Show();
                noti1.ShowNoti();
                //MessageBox.Show("Bạn đã cập nhật thành công");
            }
        }
Exemplo n.º 16
0
        public FormThemKhachHang()
        {
            InitializeComponent();
            MaKH = null;
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            if (bus.getDataTable("KHACHHANG").Rows.Count == 0)
            {
                txtMaKH.Text = "KH0001";
                return;
            }
            string str = bus.getThongTinKH(0, bus.getDataTable("KHACHHANG").Rows.Count - 1);

            str = str.Remove(0, 2);
            int temp = str.Length;

            str = (Convert.ToInt32(str) + 1).ToString();
            while (str.Length < temp)
            {
                str = "0" + str;
            }
            string makh = "KH";

            makh        += str;
            txtMaKH.Text = makh;
        }
Exemplo n.º 17
0
        private void FormCapNhatKH_Load(object sender, EventArgs e)
        {
            txtMaKH.ReadOnly = true;
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang[]       KH  = bus.search_KhachHang(MaKH);
            txtHoTen.Text    = KH[0].HOTEN;
            txtLoaiThe.Text  = KH[0].LOAIKH;
            txtGioiTinh.Text = KH[0].GIOITINH;
            txtDiaChi.Text   = KH[0].DIACHI;
            dateNgDK.Text    = TranDateFormat.SubString(KH[0].NGDK);
            dateNgSinh.Text  = TranDateFormat.SubString(KH[0].NGSINH);
            txtMaKH.Text     = KH[0].MAKH;
            DTL = KH[0].DIEMTL;

            string ma = KH[0].MAKH;

            if (System.IO.File.Exists(Application.StartupPath + "/HinhKhachHang/" + ma + ".jpg"))
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/" + ma + ".jpg");
            }
            else
            if (System.IO.File.Exists(Application.StartupPath + "/HinhKhachHang/" + ma + ".png"))
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/" + ma + ".png");
            }
            else
            {
                picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhKhachHang/" + "None.jpg");
            }
        }
Exemplo n.º 18
0
        private void CbxThoiGian_SelectedIndexChanged(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            switch (cbxThoiGian.SelectedIndex)
            {
            case 0:
                labelBangDoanhThu.Text = "DOANH THU THUẦN HÔM NAY";
                labelDoanhThuLon.Text  = bus.doanhThuTheoNgay(DateChange.ToString(DateTime.Today)) + " VND";
                break;

            case 1:
                labelBangDoanhThu.Text = "DOANH THU THUẦN HÔM QUA";
                labelDoanhThuLon.Text  = bus.doanhThuTheoNgay(DateChange.ToString(DateTime.Today.AddDays(-1))) + " VND";
                break;

            case 2:
                labelBangDoanhThu.Text = "DOANH THU THUẦN THÁNG NÀY";
                labelDoanhThuLon.Text  = bus.doanhThuTheoThang(DateTime.Today.Month.ToString(), DateTime.Today.Year.ToString()) + " VND";
                break;

            case 3:
                labelBangDoanhThu.Text = "DOANH THU THUẦN THÁNG TRƯỚC";
                labelDoanhThuLon.Text  = bus.doanhThuTheoThang(DateTime.Today.AddMonths(-1).Month.ToString(), DateTime.Today.AddMonths(-1).Year.ToString()) + " VND";
                break;
            }
        }
Exemplo n.º 19
0
        private void PictureBox3_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_KhachHang         KH  = new DTO_KhachHang();

            KH.HOTEN    = txtHoTen.Text;
            KH.GIOITINH = txtGioiTinh.Text;
            KH.LOAIKH   = txtLoaiThe.Text;
            KH.NGSINH   = DateChange.ToString(dateNgSinh.DateTime);
            KH.NGDK     = DateChange.ToString(dateNgDK.DateTime);
            //KH.NGSINH = TranDateFormat.Trans(dateNgSinh.Text);
            //KH.NGDK = TranDateFormat.Trans(dateNgDK.Text);
            KH.MAKH   = MaKH;
            KH.DIACHI = txtDiaChi.Text;
            KH.DIEMTL = DTL;

            if (bus.suaData(KH))
            {
                PushNoti noti = new PushNoti("Success", "Bạn đã cập nhật thành công");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
            }
            else
            {
                PushNoti noti = new PushNoti("Error", "Có lỗi xảy ra, cập nhật không thành công!");
                noti.Width = 800;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
            }
        }
Exemplo n.º 20
0
        private void PictureBox1_Click(object sender, EventArgs e)
        {
            DialogResult res = MessageBox.Show("Bạn có chắc ngừng kinh doanh sản phẩm " + lblTenSP.Text + " này không?",
                                               "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (res == DialogResult.No)
            {
                return;
            }

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DTO_SanPham           SP  = bus.search_SANPHAM(lblMaSP.Text)[0];

            SP.TRANGTHAI = "Ngừng kinh doanh";
            if (bus.suaData(SP))
            {
                MessageBox.Show("Bạn đã cập nhật sản phẩm thành công");
            }
            else
            {
                MessageBox.Show("Có vấn đề xảy ra! Không thành công");
            }

            string str = txtTimKiem.Text;

            txtTimKiem.Text = "a";
            txtTimKiem.Text = str;
            HienThiTrang(current_Page);
            lblPage.Text      = current_Page + "/" + number_Page;
            lblTrangThai.Text = "Ngừng kinh doanh";
        }
Exemplo n.º 21
0
        private void Xoa_Click(object sender, EventArgs e)
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DialogResult          res = MessageBox.Show("Bạn có chắc xóa sản phẩm " + lblTenSP.Text + " không",
                                                        "Hỏi", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (res == DialogResult.No)
            {
                return;
            }
            if (bus.xoaSanPham(lblMaSP.Text))
            {
                MessageBox.Show("Bạn đã xóa " + lblTenSP.Text + " thành công");
            }
            else
            {
                MessageBox.Show("Có vấn đề xảy ra! Không thành công");
                return;
            }
            string temp = txtTimKiem.Text;

            txtTimKiem.Text = " ";
            txtTimKiem.Text = temp;
            HienThiTrang(current_Page);
            lblPage.Text = current_Page + "/" + number_Page;

            DTO_SanPham[] SP = bus.search_SANPHAM(bus.getThongTinSP(0, 0));
            XuatThongTinSP(SP[0]);
        }
Exemplo n.º 22
0
        void XuatThongTinSP(DTO_SanPham SP)
        {
            lblTenSP.Text     = SP.TENSP;
            lblMaSP.Text      = SP.MASP;
            lblSoLuong.Text   = TranDateFormat.SubString(SP.SLUONG);
            lblTrangThai.Text = SP.TRANGTHAI;
            lblLoiNhuan.Text  = TranDateFormat.SubString(SP.LOINHUAN);
            lblGiaBan.Text    = TranDateFormat.SubString(SP.DONGIA);
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            lblNCC.Text = bus.getTenNCC(SP.MANCC);
            string ma = lblMaSP.Text;

            if (System.IO.File.Exists(Application.StartupPath + "/HinhSanPham/" + ma + ".jpg"))
            {
                picAnhSP.Image = Image.FromFile(Application.StartupPath + "/HinhSanPham/" + ma + ".jpg");
            }
            else
            if (System.IO.File.Exists(Application.StartupPath + "/HinhSanPham/" + ma + ".png"))
            {
                picAnhSP.Image = Image.FromFile(Application.StartupPath + "/HinhSanPham/" + ma + ".png");
            }
            else
            {
                picAnhSP.Image = Image.FromFile(Application.StartupPath + "/HinhSanPham/None" + ".png");
            }
        }
Exemplo n.º 23
0
        public void ThemData(string mahd)
        {
            DTO_CTHoaDon cthd = new DTO_CTHoaDon(mahd, Ma, SoLuong.ToString(), (DonGia / SoLuong).ToString());

            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            bus.themData(cthd);
        }
Exemplo n.º 24
0
        void XuatThongTinNguoiDau()
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            string st = bus.getThongTinKH(0, 0);

            DTO_NhaCungCap[] NCC = bus.search_NhaCungCap(st);
            XuatThongTin(NCC[0]);
        }
Exemplo n.º 25
0
 void TaoTop3NCC()
 {
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     string[] name             = bus.Top3_NCC();
     lblTop1.Text = TranDateFormat.GetLastName(name[0]);
     lblTop2.Text = TranDateFormat.GetLastName(name[1]);
     lblTop3.Text = TranDateFormat.GetLastName(name[2]);
 }
Exemplo n.º 26
0
        private void Init_Today_Panel()
        {
            Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
            DateTime dt = DateTime.Today;

            label3.Text = bus.doanhThuTheoNgay(DateChange.ToString(dt)) + " VND";
            label4.Text = bus.soLuongTheoNgay(DateChange.ToString(dt));
        }
Exemplo n.º 27
0
        private void ShowSelectedRow()
        {
            try
            {
                DataGridViewRow       currow = dataGridView1.SelectedCells[0].OwningRow;
                Stelia_BUS.Stelia_BUS bus    = new Stelia_BUS.Stelia_BUS();
                DTO_NhanVien[]        NV     = bus.search_NhanVien(currow.Cells[0].Value.ToString());
                lblHoTen.Text    = NV[0].HOTEN;
                lblChucVu.Text   = NV[0].CHUCVU;
                lblDoanhThu.Text = TranDateFormat.SubString(NV[0].DOANHTHU);
                lblGioiTinh.Text = NV[0].GIOITINH;
                lblNgSinh.Text   = TranDateFormat.SubString(NV[0].NGSINH);
                lblNgVaoLam.Text = TranDateFormat.SubString(NV[0].NGAYVL);
                lblSoHD.Text     = TranDateFormat.SubString(NV[0].SLHD);
                lblMaNV.Text     = NV[0].MANV;
                lblLuong.Text    = TranDateFormat.SubString(NV[0].LUONG);
                noti.Hide();
            }
            catch (Exception e)
            {
                lblHoTen.Text    = "";
                lblChucVu.Text   = "";
                lblDoanhThu.Text = "";
                lblGioiTinh.Text = "";
                lblNgSinh.Text   = "";
                lblNgVaoLam.Text = "";
                lblSoHD.Text     = "";
                lblMaNV.Text     = "";
                lblLuong.Text    = "";
                noti             = new PushNoti("Error", "Không tìm thấy tên này");
                noti.Width       = this.Width;
                this.Controls.Add(noti);
                noti.Show();
                noti.ShowNoti();
            }
            finally
            {
                DataGridViewRow       currow = dataGridView1.SelectedCells[0].OwningRow;
                Stelia_BUS.Stelia_BUS bus    = new Stelia_BUS.Stelia_BUS();
                DTO_NhanVien[]        NV     = bus.search_NhanVien(currow.Cells[0].Value.ToString());
                string ma = NV[0].MANV;

                if (System.IO.File.Exists(Application.StartupPath + "/HinhNhanVien/" + ma + ".jpg"))
                {
                    picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhNhanVien/" + ma + ".jpg");
                }
                else
                if (System.IO.File.Exists(Application.StartupPath + "/HinhNhanVien/" + ma + ".png"))
                {
                    picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhNhanVien/" + ma + ".png");
                }
                else
                {
                    picAnh.Image = Image.FromFile(Application.StartupPath + "/HinhNhanVien/" + "None.jpg");
                }
            }
        }
Exemplo n.º 28
0
 private void UserControlHangHoa_Load(object sender, EventArgs e)
 {
     Init_Color();
     txtTimKiem.Text = " ";
     txtTimKiem.Text = "";
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     DTO_SanPham[]         SP  = bus.search_SANPHAM("a");
     XuatThongTinSP(SP[0]);
 }
Exemplo n.º 29
0
 private void TxtTimKiem_TextChanged(object sender, EventArgs e)
 {
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     list_SP = bus.search_SANPHAM(txtTimKiem.Text);
     HienThiTrang(1);
     current_Page = 1;
     number_Page  = list_SP.Length / 12 + 1;
     lblPage.Text = "1/" + number_Page;
 }
Exemplo n.º 30
0
 public void Xoa()
 {
     Stelia_BUS.Stelia_BUS bus = new Stelia_BUS.Stelia_BUS();
     DTO_SanPham[]         sp  = bus.search_SANPHAM(Ma);
     TangGiamSoLuongSP(sp[0], SoLuong);
     UserControlThuNgan.TongTienHang -= DonGia;
     UserControlThuNgan.txtTemp.Text  = "a";
     UserControlThuNgan.txtTemp.Text  = "b";
 }