Example #1
0
        /// <summary>
        /// tim hoa don ban hang theo ma khach hang
        /// </summary>
        /// <param name="makhachhang"></param>
        private void TimHoaDonBanHangTheoMaKhachHang(string makhachhang)
        {
            try
            {
                Entities.TruyenGiaTri nhap = new Entities.TruyenGiaTri();
                cl = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                nhap.Hanhdong = "Select";
                nhap.Giatritruyen = makhachhang;
                nhap.Giatrithuhai = "";

                clientstrem = cl.SerializeObj(this.client, "TimHoaDonBanHangTheoMaKhachHang", nhap);
                Entities.HienThi_KhachHangTraLai[] ddh = new Entities.HienThi_KhachHangTraLai[1];
                ddh = (Entities.HienThi_KhachHangTraLai[])cl.DeserializeHepper(clientstrem, ddh);
                client.Close();
                clientstrem.Close();
                if (ddh.Length > 0)
                {
                    dgvHieThi.DataSource = null;
                    dgvHieThi.DataSource = ddh;
                    fixTimhoadontheomakhachhang();
                }
                else
                {
                    Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[1];
                    dgvHieThi.DataSource = null;
                    dgvHieThi.DataSource = lay;
                    fixTimhoadontheomakhachhang();
                }

            }
            catch (Exception ex)
            {
                string s = ex.Message.ToString();
                Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[1];
                dgvHieThi.DataSource = null;
                dgvHieThi.DataSource = lay;
                fixTimhoadontheomakhachhang();
            }
        }
Example #2
0
        /// <summary>
        /// tim hoa don nhap theo ma nha cung cap
        /// </summary>
        /// <param name="ma"></param>
        private void TimHoaDonNhapTheoMaNhaCungCap(string ma)
        {
            try
            {
                Entities.TruyenGiaTri nhap = new Entities.TruyenGiaTri();
                cl = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                nhap.Hanhdong = "Select";
                nhap.Giatritruyen = ma;
                nhap.Giatrithuhai = "";
                clientstrem = cl.SerializeObj(this.client, "TimHoaDonNhapTheoMaNhaCungCap", nhap);
                Entities.HienThi_KhachHangTraLai[] ddh = new Entities.HienThi_KhachHangTraLai[1];
                ddh = (Entities.HienThi_KhachHangTraLai[])cl.DeserializeHepper(clientstrem, ddh);
                if (ddh.Length <= 0)
                {
                    Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[0];
                    dgvHieThi.DataSource = null;
                    dgvHieThi.DataSource = lay;
                    fixDondathangtheomanhacungcap();
                }
                else
                {
                    dgvHieThi.DataSource = null;
                    Entities.HienThi_KhachHangTraLai[] temp = new Entities.HienThi_KhachHangTraLai[ddh.Length];
                    int sl = 0;
                    for (int i = 0; i < temp.Length; i++)
                    {
                        if (ddh[i].MaKho == makho)
                        {
                            temp[sl] = ddh[i];
                            sl++;
                        }
                    }
                    ddh = new Entities.HienThi_KhachHangTraLai[sl];
                    for (int i = 0; i < sl; i++)
                    {
                        ddh[i] = temp[i];
                    }
                    hienthiKHTL = ddh;
                    dgvHieThi.DataSource = ddh;
                    fixDondathangtheomanhacungcap();
                }

            }
            catch (Exception ex)
            {
                string s = ex.Message.ToString();
                Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[0];
                dgvHieThi.DataSource = null;
                dgvHieThi.DataSource = lay;
                fixDondathangtheomanhacungcap();
            }
        }
Example #3
0
 /// <summary>
 /// lay hoa don ban hang
 /// </summary>
 /// <param name="ma"></param>
 private void LayHoaDonBanHang(string ma)
 {
     try
     {
         Entities.TruyenGiaTri nhap = new Entities.TruyenGiaTri();
         nhap.Hanhdong = "Select";
         nhap.Giatritruyen = ma;
         nhap.Giatrithuhai = GiaTriCanLuu.Giatri;
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         clientstrem = cl.SerializeObj(this.client, "ThongTinHoaDonBanHang", nhap);
         Entities.HienThi_KhachHangTraLai[] ddh = new Entities.HienThi_KhachHangTraLai[1];
         ddh = (Entities.HienThi_KhachHangTraLai[])cl.DeserializeHepper(clientstrem, ddh);
         client.Close();
         clientstrem.Close();
         if (ddh.Length > 0)
         {
             dgvHieThi.DataSource = null;
             Entities.HienThi_KhachHangTraLai[] temp = new Entities.HienThi_KhachHangTraLai[ddh.Length];
             int sl = 0;
             for (int i = 0; i < temp.Length; i++)
             {
                 if (ddh[i].MaKho == makho)
                 {
                     temp[sl] = ddh[i];
                     sl++;
                 }
             }
             ddh = new Entities.HienThi_KhachHangTraLai[sl];
             for (int i = 0; i < sl; i++)
             {
                 ddh[i] = temp[i];
             }
             hienthiKHTL = ddh;
             dgvHieThi.DataSource = ddh;
             fixHoaDonBanHang();
         }
         else
         {
             Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[0];
             dgvHieThi.DataSource = null;
             dgvHieThi.DataSource = lay;
             fixHoaDonBanHang();
         }
         GiaTriCanLuu.Giatri = null;
         GiaTriCanLuu.Giatri2 = null;
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         Entities.HienThi_KhachHangTraLai[] lay = new Entities.HienThi_KhachHangTraLai[0];
         dgvHieThi.DataSource = null;
         dgvHieThi.DataSource = lay;
         fixHoaDonBanHang();
     }
 }