public bool KiemTraGoiHang(Entities.ChiTietDonDatHang chitietdonhang)
        {
            bool kiemtra = false;
            Entities.GoiHang[] goihang = new BizLogic.GoiHang().Select();
            for (int i = 0; i < goihang.Length; i++)
            {
                if (goihang[i].MaGoiHang == chitietdonhang.MaHangHoa)
                {
                    Entities.HienThi_ChiTiet_DonDatHang row = new Entities.HienThi_ChiTiet_DonDatHang();
                    row.MaHangHoa = chitietdonhang.MaHangHoa;
                    row.TenHangHoa = goihang[i].TenGoiHang;
                    row.SoLuongDat = chitietdonhang.SoLuong;
                    row.GiaGoc = chitietdonhang.DonGia;
                    row.Giabanbuon = goihang[i].GiaBanBuon;
                    row.Giabanle = goihang[i].GiaBanLe;
                    row.PhanTramChietKhau = chitietdonhang.PhanTramChietKhau;
                    row.Thuegiatrigiatang = "0";
                    ar.Add(row);
                    kiemtra = true;
                    break;
                }

            }
            return kiemtra;
        }
        public bool KiemTraGoiHang(Entities.ChiTietDonDatHang chitietdonhang)
        {
            bool kiemtra = false;

            Entities.GoiHang[] goihang = new BizLogic.GoiHang().Select();
            for (int i = 0; i < goihang.Length; i++)
            {
                if (goihang[i].MaGoiHang == chitietdonhang.MaHangHoa)
                {
                    Entities.HienThi_ChiTiet_DonDatHang row = new Entities.HienThi_ChiTiet_DonDatHang();
                    row.MaHangHoa         = chitietdonhang.MaHangHoa;
                    row.TenHangHoa        = goihang[i].TenGoiHang;
                    row.SoLuongDat        = chitietdonhang.SoLuong;
                    row.GiaGoc            = chitietdonhang.DonGia;
                    row.Giabanbuon        = goihang[i].GiaBanBuon;
                    row.Giabanle          = goihang[i].GiaBanLe;
                    row.PhanTramChietKhau = chitietdonhang.PhanTramChietKhau;
                    row.Thuegiatrigiatang = "0";
                    ar.Add(row);
                    kiemtra = true;
                    break;
                }
            }
            return(kiemtra);
        }
Exemplo n.º 3
0
 public Entities.HienThi_ChiTiet_DonDatHang Select(string mahang)
 {
     Entities.HienThi_ChiTiet_DonDatHang data = null;
     try
     {
         Entities.GoiHang[] goi     = new BizLogic.GoiHang().Select();
         Entities.HangHoa[] hanghoa = new BizLogic.HangHoa().Select();
         if (goi != null)
         {
             for (int k = 0; k < goi.Length; k++)
             {
                 if (goi[k].MaGoiHang.ToUpper() == mahang.ToUpper())
                 {
                     data                   = new Entities.HienThi_ChiTiet_DonDatHang();
                     data.MaHangHoa         = goi[k].MaGoiHang;
                     data.TenHangHoa        = goi[k].TenGoiHang;
                     data.SoLuongDat        = 1;
                     data.GiaGoc            = goi[k].GiaNhap;
                     data.GiaNhap           = goi[k].GiaNhap;
                     data.Giabanbuon        = goi[k].GiaBanBuon;
                     data.Giabanle          = goi[k].GiaBanLe;
                     data.PhanTramChietKhau = "0";
                     data.Thuegiatrigiatang = "0";
                     data.ChietKhau         = "0";
                     break;
                 }
             }
         }
         if (hanghoa != null)
         {
             for (int k = 0; k < hanghoa.Length; k++)
             {
                 if (hanghoa[k].MaHangHoa.ToUpper() == mahang.ToUpper())
                 {
                     data                   = new Entities.HienThi_ChiTiet_DonDatHang();
                     data.MaHangHoa         = hanghoa[k].MaHangHoa;
                     data.TenHangHoa        = hanghoa[k].TenHangHoa;
                     data.SoLuongDat        = 1;
                     data.GiaGoc            = hanghoa[k].GiaNhap;
                     data.GiaNhap           = hanghoa[k].GiaNhap;
                     data.Giabanbuon        = hanghoa[k].GiaBanBuon;
                     data.Giabanle          = hanghoa[k].GiaBanLe;
                     data.PhanTramChietKhau = "0";
                     data.Thuegiatrigiatang = Thue(hanghoa[k].MaThueGiaTriGiaTang);
                     data.ChietKhau         = "0";
                     break;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         data = null;
     }
     return(data);
 }
Exemplo n.º 4
0
 public Entities.GoiHang[] GoiHang()
 {
     Entities.GoiHang[] nkh1 = new BizLogic.GoiHang().Select();
     if (nkh1 == null)
     {
         nkh1 = new Entities.GoiHang[0];
     }
     return(nkh1);
 }
Exemplo n.º 5
0
 public Entities.HangHoaGoiHang[] Select()
 {
     Entities.HangHoaGoiHang[] data = null;
     try
     {
         ArrayList          list    = new ArrayList();
         Entities.GoiHang[] goi     = new BizLogic.GoiHang().Select();
         Entities.HangHoa[] hanghoa = new BizLogic.HangHoa().Select();
         if (goi != null)
         {
             for (int k = 0; k < goi.Length; k++)
             {
                 Entities.HangHoaGoiHang row = new Entities.HangHoaGoiHang();
                 row.TenHang    = goi[k].TenGoiHang;
                 row.MaHang     = goi[k].MaGoiHang;
                 row.GiaNhap    = goi[k].GiaNhap;
                 row.GiaBanBuon = goi[k].GiaBanBuon;
                 row.GiaBanLe   = goi[k].GiaBanLe;
                 row.Thue       = "0";
                 list.Add(row);
             }
         }
         if (hanghoa != null)
         {
             for (int k = 0; k < hanghoa.Length; k++)
             {
                 Entities.HangHoaGoiHang row = new Entities.HangHoaGoiHang();
                 row.TenHang    = hanghoa[k].TenHangHoa;
                 row.MaHang     = hanghoa[k].MaHangHoa;
                 row.GiaNhap    = hanghoa[k].GiaNhap;
                 row.GiaBanBuon = hanghoa[k].GiaBanBuon;
                 row.GiaBanLe   = hanghoa[k].GiaBanLe;
                 row.Thue       = Thue(hanghoa[k].MaThueGiaTriGiaTang);
                 list.Add(row);
             }
         }
         int n = list.Count;
         if (n == 0)
         {
             data = null;
         }
         data = new Entities.HangHoaGoiHang[n];
         for (int i = 0; i < n; i++)
         {
             data[i] = (Entities.HangHoaGoiHang)list[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         data = null;
     }
     return(data);
 }
Exemplo n.º 6
0
 public Entities.HangHoaGoiHang[] Select()
 {
     Entities.HangHoaGoiHang[] data = null;
     try
     {
         ArrayList list = new ArrayList();
         Entities.GoiHang[] goi = new BizLogic.GoiHang().Select();
         Entities.HangHoa[] hanghoa = new BizLogic.HangHoa().Select();
         if (goi!= null)
         {
             for (int k = 0; k < goi.Length; k++)
             {
                 Entities.HangHoaGoiHang row = new Entities.HangHoaGoiHang();
                 row.TenHang = goi[k].TenGoiHang;
                 row.MaHang = goi[k].MaGoiHang;
                 row.GiaNhap = goi[k].GiaNhap;
                 row.GiaBanBuon = goi[k].GiaBanBuon;
                 row.GiaBanLe = goi[k].GiaBanLe;
                 row.Thue = "0";
                 list.Add(row);
             }
         }
         if (hanghoa!=null)
         {
             for (int k = 0; k < hanghoa.Length; k++)
             {
                 Entities.HangHoaGoiHang row = new Entities.HangHoaGoiHang();
                 row.TenHang = hanghoa[k].TenHangHoa;
                 row.MaHang = hanghoa[k].MaHangHoa;
                 row.GiaNhap = hanghoa[k].GiaNhap;
                 row.GiaBanBuon = hanghoa[k].GiaBanBuon;
                 row.GiaBanLe = hanghoa[k].GiaBanLe;
                 row.Thue =Thue(hanghoa[k].MaThueGiaTriGiaTang);
                 list.Add(row);
             }
         }
         int n = list.Count;
         if (n == 0) { data = null; }
         data = new Entities.HangHoaGoiHang[n];
         for (int i = 0; i < n; i++)
         {
             data[i] = (Entities.HangHoaGoiHang)list[i];
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         data = null;
     }
     return data;
 }
Exemplo n.º 7
0
        private void tsslbl_Click(object sender, EventArgs e)
        {
            string maKH = dgvHienThi.Rows[i].Cells["MaGoiHang"].Value.ToString();



            if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 3))
            {
                MessageBox.Show("Bạn Không có quyền vào chức năng này.");
                return;
            }
            if (new Check().CheckReference("GH", maKH))
            {
                DialogResult dlgResult = MessageBox.Show("Bạn Có Chắc Chắn muốn Xóa Gói Hàng này không?", "Đồng ý?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlgResult == DialogResult.Yes)
                {
                    try
                    {
                        cl           = new Server_Client.Client();
                        this.client1 = cl.Connect(Luu.IP, Luu.Ports);

                        Entities.GoiHang kh = new Entities.GoiHang();
                        kh          = new Entities.GoiHang("Delete", int.Parse(dgvHienThi.Rows[i].Cells["GoiHangID"].Value.ToString()), Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                        clientstrem = cl.SerializeObj(this.client1, "GoiHang", kh);
                        bool kt = false;
                        kt = (bool)cl.DeserializeHepper(clientstrem, kt);
                        if (kt == true)
                        {
                        }
                        //}
                        else
                        {
                            MessageBox.Show("Mã Gói Hàng này đã bị xóa");
                        }
                        SelectData();
                    }
                    catch (Exception ex)
                    {
                    }
                }
            }
            else
            {
                MessageBox.Show("mã gói hàng này này không  thể xóa! Hiện tại đang có giao dịch");
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {
                i = 0;
                dgvHienThi.RowHeadersVisible = false;
                cl = new Server_Client.Client();
                // gán TCPclient
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                Entities.GoiHang kh = new Entities.GoiHang();
                // truyền HanhDong
                kh = new Entities.GoiHang("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                kh1         = new Entities.GoiHang[1];
                clientstrem = cl.SerializeObj(this.client1, "GoiHang", kh);
                // đổ mảng đối tượng vào datagripview
                kh1 = (Entities.GoiHang[])cl.DeserializeHepper1(clientstrem, kh1);
                // lbltongs.Text = kh1.Length.ToString();
                if (kh1 == null)
                {
                    toolStripStatus_Xoa.Enabled = false;
                    hienthi = new Entities.GoiHang[0];
                    dgvHienThi.DataSource = new Entities.GoiHang[0];
                    return;
                }
                toolStripStatus_Xoa.Enabled = true;

                Entities.GoiHang[] pt2 = new Entities.GoiHang[kh1.Length];
                int sotang             = 0;
                for (int j = 0; j < kh1.Length; j++)
                {
                    if (kh1[j].Deleted == false)
                    {
                        pt2[sotang] = kh1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.GoiHang[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = pt2[j];
                    }
                }
                else
                {
                    dgvHienThi.DataSource = new Entities.GoiHang[0];
                    return;
                }
                dgvHienThi.DataSource = hienthi;
                new Common.Utilities().CountDatagridview(dgvHienThi);

                dgvHienThi.Rows[0].Selected = true;
            }
            finally
            {
                try
                {
                    for (int j = 1; j < dgvHienThi.ColumnCount; j++)
                    {
                        dgvHienThi.Columns[j].Visible = false;
                    }

                    dgvHienThi.Columns[0].Visible               = true;
                    dgvHienThi.Columns[0].HeaderText            = "STT";
                    dgvHienThi.Columns["MaGoiHang"].HeaderText  = "Mã Gói Hàng";
                    dgvHienThi.Columns["TenGoiHang"].HeaderText = "Tên Gói Hàng";
                    dgvHienThi.Columns["GiaNhap"].HeaderText    = "Giá Nhập";
                    dgvHienThi.Columns["GiaBanBuon"].HeaderText = "Giá Bán Buôn";
                    dgvHienThi.Columns["GiaBanLe"].HeaderText   = "Giá Bán Lẻ";
                    dgvHienThi.Columns["MaGoiHang"].Visible     = true;
                    dgvHienThi.Columns["TenGoiHang"].Visible    = true;
                    dgvHienThi.Columns["GiaNhap"].Visible       = true;
                    dgvHienThi.Columns["GiaBanBuon"].Visible    = true;
                    dgvHienThi.Columns["GiaBanLe"].Visible      = true;
                    dgvHienThi.AutoSizeColumnsMode              = DataGridViewAutoSizeColumnsMode.Fill;
                    dgvHienThi.AllowUserToAddRows               = false;
                    dgvHienThi.AllowUserToDeleteRows            = false;
                    dgvHienThi.AllowUserToResizeRows            = false;
                    dgvHienThi.RowHeadersVisible = false;
                }
                catch
                { }
            }
        }
Exemplo n.º 9
0
 public Entities.HienThi_ChiTiet_DonDatHang Select(string mahang)
 {
     Entities.HienThi_ChiTiet_DonDatHang data = null;
     try
     {
         Entities.GoiHang[] goi = new BizLogic.GoiHang().Select();
         Entities.HangHoa[] hanghoa = new BizLogic.HangHoa().Select();
         if (goi!=null)
         {
             for (int k = 0; k < goi.Length; k++)
             {
                 if (goi[k].MaGoiHang.ToUpper() == mahang.ToUpper())
                 {
                     data = new Entities.HienThi_ChiTiet_DonDatHang();
                     data.MaHangHoa = goi[k].MaGoiHang;
                     data.TenHangHoa = goi[k].TenGoiHang;
                     data.SoLuongDat = 1;
                     data.GiaGoc = goi[k].GiaNhap;
                     data.GiaNhap = goi[k].GiaNhap;
                     data.Giabanbuon = goi[k].GiaBanBuon;
                     data.Giabanle = goi[k].GiaBanLe;
                     data.PhanTramChietKhau = "0";
                     data.Thuegiatrigiatang = "0";
                     data.ChietKhau = "0";
                     break;
                 }
             }
         }
         if (hanghoa!=null)
         {
             for (int k = 0; k < hanghoa.Length; k++)
             {
                 if (hanghoa[k].MaHangHoa.ToUpper() == mahang.ToUpper())
                 {
                     data = new Entities.HienThi_ChiTiet_DonDatHang();
                     data.MaHangHoa = hanghoa[k].MaHangHoa;
                     data.TenHangHoa = hanghoa[k].TenHangHoa;
                     data.SoLuongDat = 1;
                     data.GiaGoc = hanghoa[k].GiaNhap;
                     data.GiaNhap = hanghoa[k].GiaNhap;
                     data.Giabanbuon = hanghoa[k].GiaBanBuon;
                     data.Giabanle = hanghoa[k].GiaBanLe;
                     data.PhanTramChietKhau = "0";
                     data.Thuegiatrigiatang = Thue(hanghoa[k].MaThueGiaTriGiaTang);
                     data.ChietKhau = "0";
                     break;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         data = null;
     }
     return data;
 }
Exemplo n.º 10
0
        /// <summary>
        /// đơn hàng
        /// </summary>
        /// <param name="clientStream"></param>
        public void XuLy_BCChiTietHangHoa(NetworkStream clientStream)
        {
            try
            {
                Entities.rptBCChiTietHangHoa lsgd = (Entities.rptBCChiTietHangHoa)formatter.Deserialize(clientStream);
                switch (lsgd.HanhDong)
                {

                    case "Select":
                        {

                            List<Entities.rptBCChiTietHangHoa> ctHangHoaList = new List<Entities.rptBCChiTietHangHoa>();
                            Entities.rptBCChiTietHangHoa temp = null;
                            Entities.GoiHang[] goihang = new BizLogic.GoiHang().Select();
                            // nhet goi hang vao List
                            foreach (Entities.GoiHang item in goihang)
                            {
                                temp = new Entities.rptBCChiTietHangHoa();
                                temp.MaHangHoa = item.MaGoiHang;
                                temp.TenHangHoa = item.TenGoiHang;
                                temp.TenNhomHang = item.TenNhomHang;
                                temp.GiaNhap = double.Parse(item.GiaNhap);
                                temp.GiaBanBuon = double.Parse(item.GiaBanBuon);
                                temp.GiaBanLe = double.Parse(item.GiaBanLe);
                                ctHangHoaList.Add(temp);
                            }

                            Entities.rptBCChiTietHangHoa[] lsgd1 = new BizLogic.BCChiTietHangHoa().Select();
                            foreach (Entities.rptBCChiTietHangHoa item in lsgd1)
                            {
                                ctHangHoaList.Add(item);
                            }
                            formatter.Serialize(clientStream, ctHangHoaList.ToArray());
                            break;

                        }
                    default:
                        break;
                }
            }
            catch (Exception)
            { }
        }
Exemplo n.º 11
0
        public void Xuly_Select(NetworkStream clientStream)
        {
            Entities.CheckRefer nv = (Entities.CheckRefer)formatter.Deserialize(clientStream);
            switch (nv.TenTruong)
            {
                case "BCTraLaiNCC":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCTraLaiNCC(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCXuatHuyHangHoa":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCXuatHuyHangHoa(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCKhachHangTraHang":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCKhachHangTraHang(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCXuatNhapTonNhomHang":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCXuatNhapTonNhomHang(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "frmBCXuatHangTheoTungKho":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().frmBCXuatHangTheoTungKho(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "SoQuy":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().SoQuy();
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCDoanhThuMatHang":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCDoanhThuMatHang(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCDoanhThuNhomHang":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCDoanhThuNhomHang(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "TimKiemChungTu":
                    {

                        Entities.SelectAll temp = new BizLogic.SelectAll().TimKiemChungTu();
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCCongNoNhaCungCap":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCCongNoNhaCungCap();
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BanBuon":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BanBuon();
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCCongNoKhachHang":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCCongNoKhachHang();
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "BCThue":
                    {
                        Entities.SelectAll temp = new BizLogic.SelectAll().BCThue(nv.MaTruong);
                        formatter.Serialize(clientStream, temp);
                        break;
                    }
                case "PXH":
                    {
                        Entities.PhieuXuatHuy[] nv1 = new BizLogic.CheckRefer().PhieuXuatHuy();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTPXH":
                    {
                        Entities.ChiTietXuatHuy[] nv1 = new BizLogic.CheckRefer().ChiTietXuatHuy();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "DDH":
                    {
                        Entities.DonDatHang[] nv1 = new BizLogic.CheckRefer().DonDatHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "PT":
                    {
                        Entities.PhieuThu[] nv1 = new BizLogic.CheckRefer().PhieuThu();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "PTTCKH":
                    {
                        Entities.PhieuTTCuaKH[] nv1 = new BizLogic.CheckRefer().PhieuTTCuaKH();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTPTTCKH":
                    {
                        Entities.ChiTietPhieuTTCuaKH[] nv1 = new BizLogic.CheckRefer().ChiTietPhieuTTCuaKH();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "PTTNCC":
                    {
                        Entities.PhieuTTNCC[] nv1 = new BizLogic.CheckRefer().PhieuTTNCC();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTPTTNCC":
                    {
                        Entities.ChiTietPhieuTTNCC[] nv1 = new BizLogic.CheckRefer().ChiTietPhieuTTNCC();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTDDH":
                    {
                        Entities.ChiTietDonDatHang[] nv1 = new BizLogic.CheckRefer().ChiTietDonDatHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "HDBH":
                    {
                        Entities.HDBanHang[] nv1 = new BizLogic.CheckRefer().HDBanHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTHDBH":
                    {
                        Entities.ChiTietHDBanHang[] nv1 = new BizLogic.CheckRefer().ChiTietHDBanHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "PDCKNB":
                    {
                        Entities.PhieuDieuChuyenKhoNoiBo[] nv1 = new BizLogic.CheckRefer().PhieuDieuChuyenKhoNoiBo();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTPDCKNB":
                    {
                        Entities.ChiTietPhieuDieuChuyenKho[] nv1 = new BizLogic.CheckRefer().ChiTietPhieuDieuChuyenKho();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "TLNCC":
                    {
                        Entities.TraLaiNCC[] nv1 = new BizLogic.CheckRefer().TraLaiNCC();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTTLNCC":
                    {
                        Entities.ChiTietTraLaiNhaCungCap[] nv1 = new BizLogic.CheckRefer().ChiTietTraLaiNCC();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "HDN":
                    {
                        Entities.HoaDonNhap[] nv1 = new BizLogic.CheckRefer().HoaDonNhap();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTHDN":
                    {
                        Entities.ChiTietHoaDonNhap[] nv1 = new BizLogic.CheckRefer().ChiTietHoaDonNhap();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "KHTL":
                    {
                        Entities.KhachHangTraLai[] nv1 = new BizLogic.CheckRefer().KhachHangTraLai();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTKHTL":
                    {
                        Entities.ChiTietKhachHangTraLai[] nv1 = new BizLogic.CheckRefer().ChiTietKhachHangTraLai();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "LH":
                    {
                        Entities.LoaiHangHoa[] nv1 = new BizLogic.CheckRefer().LoaiHangHoa();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "HH":
                    {
                        Entities.HangHoa[] nv1 = new BizLogic.CheckRefer().HangHoa();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "NH":
                    {
                        Entities.NhomHang[] nv1 = new BizLogic.CheckRefer().NhomHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "KH":
                    {
                        Entities.KhoHang[] nv1 = new BizLogic.CheckRefer().KhoHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTKH":
                    {
                        Entities.ChiTietKhoHangTheoHoaHonNhap[] nv1 = new BizLogic.CheckRefer().ChiTietKhoHang();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "GH":
                    {
                        Entities.GoiHang[] nv1 = new BizLogic.GoiHang().Select();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "CTGH":
                    {
                        Entities.ChiTietGoiHang[] nv1 = new BizLogic.ChiTietGoiHang().Select();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                case "QD":
                    {
                        Entities.QuyDoiDonViTinh[] nv1 = new BizLogic.QuyDoiDonViTinh().Select();
                        formatter.Serialize(clientStream, nv1);
                        break;
                    }
                default:
                    break;
            }
        }
Exemplo n.º 12
0
 public void XuLy_GoiHang(NetworkStream clientStream)
 {
     Entities.GoiHang nkh = (Entities.GoiHang)formatter.Deserialize(clientStream);
     switch (nkh.HanhDong)
     {
         case "Insert":
             {
                 int msg = new BizLogic.GoiHang().InsertUpdate(nkh);
                 if (msg == 1)
                 {
                     new BizLogic.LogFile().GhiFile(new Entities.LogFile(nkh.MaNhanVien, nkh.TenDangNhap, nkh.HanhDong, DateTime.Now.ToString(), "Thêm gói hàng: " + nkh.MaGoiHang));
                 }
                 formatter.Serialize(clientStream, msg);
                 break;
             }
         case "Update":
             {
                 int msg = new BizLogic.GoiHang().InsertUpdate(nkh);
                 if (msg == 1)
                 {
                     new BizLogic.LogFile().GhiFile(new Entities.LogFile(nkh.MaNhanVien, nkh.TenDangNhap, nkh.HanhDong, DateTime.Now.ToString(), "Sửa gói hàng: " + nkh.MaGoiHang));
                 }
                 formatter.Serialize(clientStream, msg);
                 break;
             }
         case "Delete":
             {
                 new BizLogic.GoiHang().Delete(nkh);
                 bool kt = true;
                 formatter.Serialize(clientStream, kt);
                 break;
             }
         case "Select":
             {
                 Entities.GoiHang[] nkh1 = new BizLogic.GoiHang().Select();
                 formatter.Serialize(clientStream, nkh1);
                 break;
             }
         default:
             break;
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {

                i = 0;
                dgvHienThi.RowHeadersVisible = false;
                cl = new Server_Client.Client();
                // gán TCPclient
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                // khởi tạo biến truyền vào với hàm khởi tạo
                Entities.GoiHang kh = new Entities.GoiHang();
                // truyền HanhDong
                kh = new Entities.GoiHang("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                kh1 = new Entities.GoiHang[1];
                clientstrem = cl.SerializeObj(this.client1, "GoiHang", kh);
                // đổ mảng đối tượng vào datagripview
                kh1 = (Entities.GoiHang[])cl.DeserializeHepper1(clientstrem, kh1);
                // lbltongs.Text = kh1.Length.ToString();
                if (kh1 == null)
                {
                    toolStripStatus_Xoa.Enabled = false;
                    hienthi = new Entities.GoiHang[0];
                    dgvHienThi.DataSource = new Entities.GoiHang[0];
                    return;
                }
                toolStripStatus_Xoa.Enabled = true;

                Entities.GoiHang[] pt2 = new Entities.GoiHang[kh1.Length];
                int sotang = 0;
                for (int j = 0; j < kh1.Length; j++)
                {

                    if (kh1[j].Deleted == false)
                    {
                        pt2[sotang] = kh1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.GoiHang[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = pt2[j];
                    }
                }
                else
                {
                    dgvHienThi.DataSource = new Entities.GoiHang[0];
                    return;
                }
                dgvHienThi.DataSource = hienthi;
                new Common.Utilities().CountDatagridview(dgvHienThi);

                dgvHienThi.Rows[0].Selected = true;
            }
            finally
            {
                try
                {
                    for (int j = 1; j < dgvHienThi.ColumnCount; j++)
                    {
                        dgvHienThi.Columns[j].Visible = false;
                    }

                    dgvHienThi.Columns[0].Visible = true;
                    dgvHienThi.Columns[0].HeaderText = "STT";
                    dgvHienThi.Columns["MaGoiHang"].HeaderText = "Mã Gói Hàng";
                    dgvHienThi.Columns["TenGoiHang"].HeaderText = "Tên Gói Hàng";
                    dgvHienThi.Columns["GiaNhap"].HeaderText = "Giá Nhập";
                    dgvHienThi.Columns["GiaBanBuon"].HeaderText = "Giá Bán Buôn";
                    dgvHienThi.Columns["GiaBanLe"].HeaderText = "Giá Bán Lẻ";
                    dgvHienThi.Columns["MaGoiHang"].Visible = true;
                    dgvHienThi.Columns["TenGoiHang"].Visible = true;
                    dgvHienThi.Columns["GiaNhap"].Visible = true;
                    dgvHienThi.Columns["GiaBanBuon"].Visible = true;
                    dgvHienThi.Columns["GiaBanLe"].Visible = true;
                    dgvHienThi.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                    dgvHienThi.AllowUserToAddRows = false;
                    dgvHienThi.AllowUserToDeleteRows = false;
                    dgvHienThi.AllowUserToResizeRows = false;
                    dgvHienThi.RowHeadersVisible = false;
                }
                catch
                { }
            }
        }
Exemplo n.º 14
0
        private void tsslbl_Click(object sender, EventArgs e)
        {
            string maKH = dgvHienThi.Rows[i].Cells["MaGoiHang"].Value.ToString();

            if (!frmDangNhap.User.Administrator && !CheckQuyen(this.Name, 3))
            {
                MessageBox.Show("Bạn Không có quyền vào chức năng này.");
                return;
            }
            if (new Check().CheckReference("GH", maKH))
            {
                DialogResult dlgResult = MessageBox.Show("Bạn Có Chắc Chắn muốn Xóa Gói Hàng này không?", "Đồng ý?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlgResult == DialogResult.Yes)
                {
                    try
                    {

                        cl = new Server_Client.Client();
                        this.client1 = cl.Connect(Luu.IP, Luu.Ports);

                        Entities.GoiHang kh = new Entities.GoiHang();
                        kh = new Entities.GoiHang("Delete", int.Parse(dgvHienThi.Rows[i].Cells["GoiHangID"].Value.ToString()), Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                        clientstrem = cl.SerializeObj(this.client1, "GoiHang", kh);
                        bool kt = false;
                        kt = (bool)cl.DeserializeHepper(clientstrem, kt);
                        if (kt == true)
                        {
                        }
                        //}
                        else
                        {
                            MessageBox.Show("Mã Gói Hàng này đã bị xóa");
                        }
                        SelectData();
                    }
                    catch (Exception ex)
                    {

                    }
                }
            }
            else
            {
                MessageBox.Show("mã gói hàng này này không  thể xóa! Hiện tại đang có giao dịch");
            }
        }
Exemplo n.º 15
0
 public Entities.GoiHang[] GoiHang()
 {
     Entities.GoiHang[] nkh1 = new BizLogic.GoiHang().Select();
     if (nkh1 == null)
         nkh1 = new Entities.GoiHang[0];
     return nkh1;
 }