Exemplo n.º 1
0
 public string ProID(string tenBang)
 {
     try
     {
         string idnew;
         Server_Client.Client cl = new Server_Client.Client();
         // gán TCPclient
         TcpClient 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.LayID lid1 = new Entities.LayID("Select", tenBang);
         // khởi tạo mảng đối tượng để hứng giá trị
         Entities.LayID lid = new Entities.LayID();
         NetworkStream clientstrem = cl.SerializeObj(client1, "LayID", lid1);
         // đổ mảng đối tượng vào datagripview
         lid = (Entities.LayID)cl.DeserializeHepper(clientstrem, lid);
         if (lid == null)
         {
             if (tenBang.Equals("TyLeTinh"))
             {
                 return "TLT_0001";
             }
             else if (tenBang.Equals("DiemThuongKhachHang"))
             {
                 return "DTKH_0001";
             }
         }
         Common.Utilities a = new Common.Utilities();
         idnew = a.ProcessID(lid.ID);
         return idnew;
     }
     catch
     { return ""; }
 }
Exemplo n.º 2
0
        public void checkConflict()
        {
            Server_Client.Client client= new Server_Client.Client();
             this.tcpClient = client.Connect(Luu.IP, Luu.Ports);

             Entities.KhoHang kh = new Entities.KhoHang("Select");
             Entities.KhoHang[] kh1 = new Entities.KhoHang[1];
             networkStream = client.SerializeObj(this.tcpClient, "KhoHang", kh);

             kh1 = (Entities.KhoHang[])client.DeserializeHepper1(networkStream, kh1);
             if (kh1 != null)
             {
                 for (int j = 0; j < kh1.Length; j++)
                 {
                     if (kh1[j].MaKho == txtMaKho.Text)
                     {
                         MessageBox.Show("Thất bại");
                         chck = "No";
                         txtMaKho.Text = new Common.Utilities().ProcessID(txtMaKho.Text);
                         break;
                     }
                     else
                         chck = "Yes";
                 }
             }
        }
Exemplo n.º 3
0
 public void HienThi()
 {
     try
     {
         bool kt = false;
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         clientstrem = cl.SerializeObj(this.client, "SoDuKho", new Entities.SoDuKho("Select"));
         ddh = new Entities.SoDuKho[1];
         ddh = (Entities.SoDuKho[])cl.DeserializeHepper(clientstrem, ddh);
         if (ddh == null)
         {
             toolStrip1.Enabled = true;
             dgvsodukhohang.DataSource = new Entities.SoDuKho[0];
             FixDatagridview();
             return;
         }
         Entities.KhoHang kh = (Entities.KhoHang)cbbkhohang.SelectedItem;
         List<Entities.SoDuKho> L = new List<Entities.SoDuKho>();
         DateTime SoSanh = new DateTime(int.Parse(cbbnam.Text), int.Parse(cbbthang.Text), 1);
         foreach (Entities.SoDuKho item in ddh)
         {
             if ((item.TrangThai && !kt) || (!kt && (item.NgayKetChuyen.Month == SoSanh.Month - 1) && (item.NgayKetChuyen.Year == SoSanh.Year) && (item.MaKho.ToUpper().Equals(kh.MaKho.ToUpper()))))
             {
                 kt = item.TrangThai;
             }
             if ((item.NgayKetChuyen.Month == SoSanh.Month) && (item.NgayKetChuyen.Year == SoSanh.Year) && (item.MaKho.ToUpper().Equals(kh.MaKho.ToUpper())))
             {
                 L.Add(item);
             }
         }
         if (L.Count == 0)
         {
             lbltrangthai.Text = "";
             toolStrip1.Enabled = true;
             dgvsodukhohang.DataSource = new Entities.SoDuKho[0];
             FixDatagridview();
             return;
         }
         if (L[0].TrangThai)
         {
             lbltrangthai.ForeColor = Color.Red;
             lbltrangthai.Text = "Kỳ Đã Khóa";
             toolStrip1.Enabled = false;
         }
         else
         {
             lbltrangthai.ForeColor = Color.Green;
             lbltrangthai.Text = "Kỳ Chưa Khóa";
             toolStrip1.Enabled = true;
         }
         dgvsodukhohang.DataSource = L.ToArray();
         FixDatagridview();
         if (kt)
         {
             toolStrip1.Enabled = false;
         }
     }
     catch { }
 }
        void LayDL()
        {
            try
            {
                cl = new Server_Client.Client();
                // gán TCPclient
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                //truyền giá trị lên server
                clientstrem = cl.SerializeObj(this.client1, "LayBackUp", null);
                // đổ mảng đối tượng vào datagripview
                slht = (Entities.SaoLuuHeThong[])cl.DeserializeHepper1(clientstrem, null);
                if (slht != null)
                {
                    if (slht.Length > 0)
                    {
                        dgvHienThi.DataSource = slht;
                    }
                }
                else
                {
                    slht = new Entities.SaoLuuHeThong[0];
                    dgvHienThi.DataSource = slht;
                }
                fix();
            }
            catch
            {
                dgvHienThi.DataSource = new Entities.SaoLuuHeThong[0];
                fix();
            }

            dgvHienThi.Refresh();
        }
        public Entities.BaoCaoNhapHangTheoNhomHang[] SelectData1()
        {
            Entities.BaoCaoNhapHangTheoNhomHang[] nkh1 = new Entities.BaoCaoNhapHangTheoNhomHang[1];
            try
            {
                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.BaoCaoNhapHangTheoNhomHang nkh = new Entities.BaoCaoNhapHangTheoNhomHang();
                // truyền HanhDong
                Entities.TruyenGiaTri truyen = new Entities.TruyenGiaTri("Select");
                // khởi tạo mảng đối tượng để hứng giá trị

                clientstrem = cl.SerializeObj(this.client1, "BaoCaoNhapHangTheoNhomHang", truyen);
                // đổ mảng đối tượng vào datagripview
                nkh1 = (Entities.BaoCaoNhapHangTheoNhomHang[])cl.DeserializeHepper1(clientstrem, nkh1);
                Entities.BaoCaoNhapHangTheoNhomHang[] nkh3 = new Entities.BaoCaoNhapHangTheoNhomHang[nkh1.Length];
                Common.Utilities a = new Common.Utilities();

            }
            catch (Exception ex)
            {
                MessageBox.Show("Không kết nối được với server - thử lại sau");
            }
            return nkh1;
        }
Exemplo n.º 6
0
        /// <summary>
        /// hàm đăng nhập
        /// </summary>
        /// <param name="ttk"></param>
        /// <param name="mk"></param>
        /// <returns></returns>
        public bool LogIn(string ttk,string mk)
        {
            try
            {
                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.TaiKhoan tk = new Entities.TaiKhoan();
                tk = new Entities.TaiKhoan(ttk, mk);
                // khởi tạo mảng đối tượng để hứng giá trị
                tk1 = new Entities.TaiKhoan[1];
                clientstrem = cl.SerializeObj(this.client1, "LogIn", tk);
                // đổ mảng đối tượng vào datagripview
                tk1 = (Entities.TaiKhoan[])cl.DeserializeHepper1(clientstrem, tk1);
                if (tk1.Length > 0)
                {
                    if (!tk1[0].KhoaTaiKhoan)
                    {
                        Common.Utilities.User = User = tk1[0];
                        Common.Utilities.CTQ = CTQ = LayChiTietQuyen(User.TenNhomQuyen);

                        return true;
                    }
                    return false;
                }
                else
                    return false;
            }
            catch (Exception w)
            {
                string str=w.Message;
                return false;
            }
        }
Exemplo n.º 7
0
        public void checkConflict()
        {
            Server_Client.Client client = new Server_Client.Client();
            this.tcpClient = client.Connect(Luu.IP, Luu.Ports);

            Entities.LoaiHangHoa lhh = new Entities.LoaiHangHoa("Select");
            Entities.LoaiHangHoa[] lhh1 = new Entities.LoaiHangHoa[1];
            networkStream = client.SerializeObj(this.tcpClient, "NhanVien", lhh);

            lhh1 = (Entities.LoaiHangHoa[])client.DeserializeHepper1(networkStream, lhh1);
            if (lhh1 != null)
            {
                for (int j = 0; j < lhh1.Length; j++)
                {
                    if (lhh1[j].MaLoaiHang == txtTenLoaiHang.Text)
                    {
                        MessageBox.Show("Thất bại");
                        chck = "No";
                        txtTenLoaiHang.Text = new Common.Utilities().ProcessID(txtTenLoaiHang.Text);
                        break;
                    }
                    else
                        chck = "Yes";
                }
            }
        }
 public string ProID(string tenBang)
 {
     try
     {
         string idnew;
         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.LayID lid1 = new Entities.LayID("Select", tenBang);
         // khởi tạo mảng đối tượng để hứng giá trị
         Entities.LayID lid = new Entities.LayID();
         clientstrem = cl.SerializeObj(this.client1, "LayID", lid1);
         // đổ mảng đối tượng vào datagripview
         lid = (Entities.LayID)cl.DeserializeHepper(clientstrem, hienthi);
         if (lid == null)
             return "SDCN_0001";
         Common.Utilities a = new Common.Utilities();
         idnew = a.ProcessID(lid.ID);
         return idnew;
     }
     catch (Exception ex)
     {
         return "";
     }
 }
Exemplo n.º 9
0
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {
                Server_Client.Client 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.NhanVien ncc = new Entities.NhanVien("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.NhanVien[] ncc1 = new Entities.NhanVien[1];
                clientstrem = cl.SerializeObj(this.client1, "NhanVien", ncc);
                // đổ mảng đối tượng vào datagripview
                ncc1 = (Entities.NhanVien[])cl.DeserializeHepper1(clientstrem, ncc1);
                if (ncc1 == null)
                {
                    hienthi = new Entities.NhanVien[0];
                    dtgvncc.DataSource = new Entities.NhanVien[0];
                    return;
                }

                Entities.NhanVien[] ncc2 = new Entities.NhanVien[ncc1.Length];
                int sotang = 0;
                for (int j = 0; j < ncc1.Length; j++)
                {
                    if (ncc1[j].Deleted == false)
                    {
                        ncc2[sotang] = ncc1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.NhanVien[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = ncc2[j];
                    }
                }
                else
                {
                    hienthi = new Entities.NhanVien[0];
                    dtgvncc.DataSource = new Entities.NhanVien[0];
                    return;
                }
                dtgvncc.DataSource = hienthi;
                dtgvncc.Rows[0].Selected = true;

            }
            catch (Exception ex)
            {
            }
            finally
            {

                fix();

            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {
                dtgvKH.RowHeadersVisible = false;
                Server_Client.Client 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.HDBanHang kh = new Entities.HDBanHang("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.HDBanHang[] kh1 = new Entities.HDBanHang[1];
                clientstrem = cl.SerializeObj(this.client1, "HDBanHang", kh);
                // đổ mảng đối tượng vào datagripview
                kh1 = (Entities.HDBanHang[])cl.DeserializeHepper1(clientstrem, kh1);
                if (kh1 == null)
                {
                    hienthi = new Entities.HDBanHang[0];
                    dtgvKH.DataSource = new Entities.HDBanHang[0];
                    return;
                }
                Entities.HDBanHang[] kh2 = new Entities.HDBanHang[kh1.Length];
                int sotang = 0;
                for (int j = 0; j < kh1.Length; j++)
                {
                    if (kh1[j].MaKhachHang == str1 && kh1[j].Deleted == false && kh1[j].LoaiHoaDon == false && !kh1[j].TongTienThanhToan.Equals(kh1[j].ThanhToanNgay) && !kh1[j].TongTienThanhToan.Equals(kh1[j].ThanhToanKhiLapPhieu))
                    {
                        kh2[sotang] = kh1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.HDBanHang[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = kh2[j];
                    }
                }
                else
                {
                    hienthi = new Entities.HDBanHang[0];
                    dtgvKH.DataSource = new Entities.HDBanHang[0];
                    return;
                }
                dtgvKH.DataSource = hienthi;
                dtgvKH.Rows[0].Selected = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Không kết nối được với server - thử lại sau");
            }
            finally
            {

                fix();

            }
        }
Exemplo n.º 11
0
        public void Select()
        {
            try
            {
                dtgvHienThi.RowHeadersVisible = false;
                Server_Client.Client cl = new Server_Client.Client();
                cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                Entities.CheckRefer ctxh = new Entities.CheckRefer("NH");
                clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
                Entities.NhomHang[] kh1 = new Entities.NhomHang[0];
                kh1 = (Entities.NhomHang[])cl.DeserializeHepper1(clientstrem, kh1);
                if (kh1 == null)
                {
                    hienthi = new Entities.NhomHang[0];
                    dtgvHienThi.DataSource = new Entities.NhomHang[0];
                    return;
                }

                Entities.NhomHang[] ncc2 = new Entities.NhomHang[kh1.Length];
                int sotang = 0;
                for (int j = 0; j < kh1.Length; j++)
                {
                    if (kh1[j].Deleted == false)
                    {
                        ncc2[sotang] = kh1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.NhomHang[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = ncc2[j];
                    }
                }
                else
                {
                    hienthi = new Entities.NhomHang[0];
                    dtgvHienThi.DataSource = new Entities.NhomHang[0];
                    return;
                }

                dtgvHienThi.DataSource = hienthi;
                dtgvHienThi.Rows[0].Selected = true;
            }
            catch (Exception ex)
            {

            }
            finally
            {

                fix();

            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// select dữ liệu từ server
        /// </summary>
        public void SelectData()
        {
            try
            {
                dtgvKH.RowHeadersVisible = false;
                Server_Client.Client 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.DonDatHang kh = new Entities.DonDatHang("SelectDDH");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.DonDatHang[] kh1 = new Entities.DonDatHang[1];
                clientstrem = cl.SerializeObj(this.client1, "DonDatHang", kh);
                // đổ mảng đối tượng vào datagripview
                kh1 = (Entities.DonDatHang[])cl.DeserializeHepper1(clientstrem, kh1);
                if (kh1 == null)
                {
                    hienthi = new Entities.DonDatHang[0];
                    dtgvKH.DataSource = hienthi;
                    return;
                }
                Entities.DonDatHang[] kh2 = new Entities.DonDatHang[kh1.Length];
                int sotang = 0;
                for (int j = 0; j < kh1.Length; j++)
                {
                    if (kh1[j].Makhachhang == str1)
                    {
                        kh2[sotang] = kh1[j];
                        sotang++;
                    }
                }
                hienthi = new Entities.DonDatHang[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        hienthi[j] = kh2[j];
                    }
                }
                else
                {
                    hienthi = new Entities.DonDatHang[0];
                    dtgvKH.DataSource = new Entities.DonDatHang[0];
                    return;
                }
                dtgvKH.DataSource = hienthi;

                dtgvKH.Rows[0].Selected = true;
            }
            catch (Exception ex)
            {
            }
            finally
            {
                fix();
            }
        }
Exemplo n.º 13
0
 public static DateTime Date()
 {
     Server_Client.Client cl = new Server_Client.Client();
     client1 = cl.Connect(Luu.IP, Luu.Ports);
     Entities.CheckRefer pt = new Entities.CheckRefer();
     clientstrem = cl.SerializeObj(client1, "Datetime", pt);
     DateTime dt = new DateTime();
     dt = (DateTime)cl.DeserializeHepper(clientstrem, dt);
     return dt;
 }
Exemplo n.º 14
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private Entities.BaoCaoXuatHangTheoKho[] BaoCaoKhoHang(string makho, string ngay)
 {
     Entities.BaoCaoXuatHangTheoKho[] tralai = null;
     Entities.TruyenGiaTri truyen = new Entities.TruyenGiaTri("Select", makho, ngay);
     cl = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     clientstrem = cl.SerializeObj(this.client, "BaoCaoXuatHangTheoKho", truyen);
     tralai = (Entities.BaoCaoXuatHangTheoKho[])cl.DeserializeHepper(clientstrem, tralai);
     return tralai;
 }
        public void CheckDataGridCongSL(DataGridView dgv, string maKho)
        {
            if (dgv.RowCount != 0)
            {
                try
                {

                    Server_Client.Client cl = new Server_Client.Client();
                    this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                    Entities.ChiTietKhoHangTheoHoaHonNhap nv = new Entities.ChiTietKhoHangTheoHoaHonNhap("Select");
                    clientstrem = cl.SerializeObj(this.client1, "ChiTietKho", nv);
                    Entities.ChiTietKhoHangTheoHoaHonNhap[] kh1 = new Entities.ChiTietKhoHangTheoHoaHonNhap[1];
                    kh1 = (Entities.ChiTietKhoHangTheoHoaHonNhap[])cl.DeserializeHepper1(clientstrem, kh1);
                    List<Entities.ChiTietKhoHangTheoHoaHonNhap> ctList = new List<Entities.ChiTietKhoHangTheoHoaHonNhap>();
                    for (int i = 0; i < dgv.RowCount; i++)
                    {
                        bool retVal = false;
                        foreach (Entities.ChiTietKhoHangTheoHoaHonNhap item in kh1)
                        {
                            if (dgv["MaHangHoa", i].Value.ToString().ToUpper().Equals(item.Mahanghoa.ToUpper()) && maKho.Equals(item.Makho))
                            {
                                retVal = true;
                                break;
                            }
                        }
                        if (!retVal)
                        {
                            Entities.ChiTietKhoHangTheoHoaHonNhap ct = new Entities.ChiTietKhoHangTheoHoaHonNhap();
                            ct.Hanhdong = "Insert";
                            ct.Mahanghoa = dgv["MaHangHoa", i].Value.ToString();
                            ct.Makho = maKho;
                            ct.Ngaynhap = DateServer.Date();
                            DateTime ngayHetHan = DateTime.Now;
                            if (dgv["NgayHetHan", i] != null)
                                ngayHetHan = (DateTime)dgv["NgayHetHan", i].Value;
                            ct.Ngayhethan = ngayHetHan;
                            ct.Soluong = int.Parse(dgv["SoLuong", i].Value.ToString());
                            ct.Ghichu = "";
                            ctList.Add(ct);
                        }
                    }
                    Server_Client.Client cl1 = new Server_Client.Client();
                    this.client1 = cl1.Connect(Luu.IP, Luu.Ports);
                    clientstrem = cl1.SerializeObj(this.client1, "ThemChiTietKhoHang", ctList.ToArray());
                }
                catch (Exception)
                {

                }
            }
        }
        public void SelectGoiHang()
        {
            try
            {
                cl = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                Entities.GoiHang goi = new Entities.GoiHang("Select");
                clientstrem = cl.SerializeObj(this.client, "GoiHang", goi);
                Entities.GoiHang[] GoiHang = new Entities.GoiHang[1];
                GoiHang = (Entities.GoiHang[])cl.DeserializeHepper1(clientstrem, GoiHang);
                try
                {
                    for (int j = 0; j < GoiHang.Length; j++)
                    {
                        if (GoiHang[j].Deleted == false)
                        {
                            Entities.ThongTinMaVach row = new Entities.ThongTinMaVach();
                            row.MaHangHoa = GoiHang[j].MaGoiHang;
                            row.TenHangHoa = GoiHang[j].TenGoiHang;
                            list.Add(row);
                        }
                    }

                }
                catch { }
                try
                {
                    for (int i = 0; i < this.search.Length; i++)
                    {
                        list.Add(this.search[i]);
                    }
                }
                catch { }
                int k = list.Count;
                if (k <= 0)
                {
                    this.search = null;
                }
                else
                {
                    this.search = new Entities.ThongTinMaVach[k];
                    for (int i = 0; i < k; i++)
                    {
                        this.search[i] = (Entities.ThongTinMaVach)list[i];
                    }
                }
            }
            catch { }
        }
 public bool Restore(Entities.SaoLuuHeThong slht1)
 {
     try
     {
         cl = new Server_Client.Client();
         // gán TCPclient
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         //truyền giá trị lên server
         clientstrem = cl.SerializeObj(this.client1, "Restore", slht1);
         //lấy giá trị về
         bool tv = (bool)cl.DeserializeHepper(clientstrem, null);
         return tv;
     }
     catch { return false; }
 }
Exemplo n.º 18
0
        public Entities.LogFile[] LayDT()
        {
            try
            {
                Server_Client.Client cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);

                clientstrem = cl.SerializeObj(this.client1, "DocFileLog", null);
                Entities.LogFile[] lf1 = (Entities.LogFile[])cl.DeserializeHepper1(clientstrem, null);
                return lf1;
            }
            catch (Exception)
            {
                return null;
            }
        }
Exemplo n.º 19
0
 public bool CheckReference(string tenTruong, string maTruong)
 {
     try
     {
         Server_Client.Client cl = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer pt = new Entities.CheckRefer(tenTruong, maTruong);
         bool kt = false;
         clientstrem = cl.SerializeObj(this.client1, "CheckRefer", pt);
         kt = (bool)cl.DeserializeHepper(clientstrem, kt);
         return kt;
     }
     catch
     {
         return false;
     }
 }
Exemplo n.º 20
0
 public void ChiTietHoaDonNhap()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTHDN");
         clientstrem       = cl.SerializeObj(this.client1, "Select", ctxh);
         chitiethoadonnhap = (Entities.ChiTietHoaDonNhap[])cl.DeserializeHepper1(clientstrem, chitiethoadonnhap);
         if (chitiethoadonnhap == null)
         {
             chitiethoadonnhap = new Entities.ChiTietHoaDonNhap[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 21
0
 public void SelectNhanVien()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.NhanVien ctxh = new Entities.NhanVien("Select");
         clientstrem = cl.SerializeObj(this.client1, "NhanVien", ctxh);
         nv          = (Entities.NhanVien[])cl.DeserializeHepper1(clientstrem, nv);
         if (nv == null)
         {
             nv = new Entities.NhanVien[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 22
0
 /// <summary>
 /// hungvv =======================lay du lieu moi checkfix===========================
 /// </summary>
 private Entities.KhoHang ConfilickData(string table, string values)
 {
     Entities.KhoHang ddh = null;
     try
     {
         cl             = new Server_Client.Client();
         this.tcpClient = cl.Connect(Luu.IP, Luu.Ports);
         Entities.TruyenGiaTri gitri = new Entities.TruyenGiaTri("Select", table, values);
         networkStream = cl.SerializeObj(this.tcpClient, "CheckKhoHang", gitri);
         ddh           = new Entities.KhoHang();
         ddh           = (Entities.KhoHang)cl.DeserializeHepper(networkStream, ddh);
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         ddh = null;
     }
     return(ddh);
 }
 public void ChiTietXuatHuy()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTPXH");
         clientstrem    = cl.SerializeObj(this.client1, "Select", ctxh);
         chitietxuathuy = (Entities.ChiTietXuatHuy[])cl.DeserializeHepper1(clientstrem, chitietxuathuy);
         if (chitietxuathuy == null)
         {
             chitietxuathuy = new Entities.ChiTietXuatHuy[0];
             return;
         }
     }
     catch
     {
     }
 }
 public void SoDuKho()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.SoDuKho ctxh = new Entities.SoDuKho("Select");
         clientstrem = cl.SerializeObj(this.client1, "SoDuKho", ctxh);
         sodukho     = (Entities.SoDuKho[])cl.DeserializeHepper1(clientstrem, sodukho);
         if (sodukho == null)
         {
             sodukho = new Entities.SoDuKho[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 25
0
 public void HangHoa()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("HH");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         hanghoa     = (Entities.HangHoa[])cl.DeserializeHepper1(clientstrem, hanghoa);
         if (hanghoa == null)
         {
             hanghoa = new Entities.HangHoa[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 26
0
 public void GoiHang()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("GH");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         goihang     = (Entities.GoiHang[])cl.DeserializeHepper1(clientstrem, goihang);
         if (goihang == null)
         {
             goihang = new Entities.GoiHang[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 27
0
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     dgvHienThi.DataSource = null;
     kk          = new Entities.KiemKeKho();
     cl          = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     kk          = new Entities.KiemKeKho("Select");
     clientstrem = cl.SerializeObj(this.client, "KiemKeKho", kk);
     Entities.KiemKeKho[] ddh = new Entities.KiemKeKho[1];
     ddh = (Entities.KiemKeKho[])cl.DeserializeHepper(clientstrem, ddh);
     dgvHienThi.DataSource            = ddh;
     dgvHienThi.Columns[1].Visible    = false;
     dgvHienThi.Columns[0].HeaderText = "STT";
     new Common.Utilities().CountDatagridview(dgvHienThi);
     dgvHienThi.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
     dgvHienThi.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
     client.Close();
     clientstrem.Close();
 }
Exemplo n.º 28
0
 public void ChiTietPhieuDieuChuyenKho()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTPDCKNB");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         chitietphieudieuchuyenkho = (Entities.ChiTietPhieuDieuChuyenKho[])cl.DeserializeHepper1(clientstrem, chitietphieudieuchuyenkho);
         if (chitietphieudieuchuyenkho == null)
         {
             chitietphieudieuchuyenkho = new Entities.ChiTietPhieuDieuChuyenKho[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 29
0
 /// <summary>
 /// update dư nợ
 /// </summary>
 /// <param name="ctkhthdn"></param>
 public bool UpdateDuNo(Entities.KhachHang ctkhthdn)
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         clientstrem  = cl.SerializeObj(this.client1, "KhachHang", ctkhthdn);
         bool kt = false;
         kt = (bool)cl.DeserializeHepper(clientstrem, kt);
         return(kt);
     }
     catch
     {
         return(false);
     }
     finally
     {
     }
 }
 public void ChiTietTraLaiNCC()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTTLNCC");
         clientstrem      = cl.SerializeObj(this.client1, "Select", ctxh);
         chitiettralaincc = (Entities.ChiTietTraLaiNhaCungCap[])cl.DeserializeHepper1(clientstrem, chitiettralaincc);
         if (chitiettralaincc == null)
         {
             chitiettralaincc = new Entities.ChiTietTraLaiNhaCungCap[0];
             return;
         }
     }
     catch
     {
     }
 }
 Entities.ThongTinMaVach[] getTheGiaTri()
 {
     cl          = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     clientstrem = cl.SerializeObj(this.client, "THAOTAC_InMaVachTheGiaTri", new Entities.ThongTinMaVach());
     Entities.ThongTinMaVach[] bientam = new Entities.ThongTinMaVach[1];
     //Tìm kiếm thẻ giá trị
     bientam = (Entities.ThongTinMaVach[])cl.DeserializeHepper(clientstrem, bientam);
     client.Close();
     clientstrem.Close();
     if (bientam != null)
     {
         return(bientam);
     }
     else
     {
         return(new Entities.ThongTinMaVach[0]);
     }
 }
Exemplo n.º 32
0
 public void LayKhoHang()
 {
     try
     {
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.KhoHang ctxh = new Entities.KhoHang("Select");
         clientstrem = cl.SerializeObj(this.client, "KhoHang", ctxh);
         khohang     = (Entities.KhoHang[])cl.DeserializeHepper1(clientstrem, khohang);
         if (khohang == null)
         {
             khohang = new Entities.KhoHang[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 33
0
 void SelectData()
 {
     Server_Client.Client cl = new Server_Client.Client();
     this.client1 = cl.Connect(Luu.IP, Luu.Ports);
     Entities.CheckRefer ctxh = new Entities.CheckRefer("BCThue", new Common.Utilities().CaiDatKho("View", "", "").Giatritruyen);
     clientstrem      = cl.SerializeObj(this.client1, "Select", ctxh);
     selectall        = (Entities.SelectAll)cl.DeserializeHepper(clientstrem, selectall);
     hdbanhang        = selectall.HDBanHang;
     chitiethdbanhang = selectall.ChiTietHDBanHang;
     thue             = selectall.Thue;
     hanghoa          = selectall.HangHoaTheoKho;
     if (thue.Length != 0)
     {
         cbbThue.DataSource    = thue;
         cbbThue.DisplayMember = "GiaTriThue";
         cbbThue.ValueMember   = "MaThue";
         cbbThue.SelectedIndex = -1;
     }
 }
Exemplo n.º 34
0
        public bool DeleteToDataBase()
        {
            bool msg = false;
            try
            {
                cl = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);

                Entities.SoDuKho[] sdk1 = LaySoDuKhoTheoNgay(Convert.ToInt32(cbbthang.Text), Convert.ToInt32(cbbnam.Text));
                clientstrem = cl.SerializeObj(this.client, "XoaArr", sdk1);
                msg = (bool)cl.DeserializeHepper(clientstrem, msg);
            }
            catch
            {
                msg = false;
            }

            return msg;
        }
Exemplo n.º 35
0
 public void ChiTietKhachHangTraLai()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTKHTL");
         clientstrem            = cl.SerializeObj(this.client1, "Select", ctxh);
         chitietkhachhangtralai = (Entities.ChiTietKhachHangTraLai[])cl.DeserializeHepper1(clientstrem, chitietkhachhangtralai);
         if (chitietkhachhangtralai == null)
         {
             chitietkhachhangtralai = new Entities.ChiTietKhachHangTraLai[0];
             return;
         }
     }
     catch
     {
     }
 }
 public void ChiTietHDBanHang()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTHDBH");
         clientstrem      = cl.SerializeObj(this.client1, "Select", ctxh);
         chitiethdbanhang = (Entities.ChiTietHDBanHang[])cl.DeserializeHepper1(clientstrem, chitiethdbanhang);
         if (chitiethdbanhang == null)
         {
             chitiethdbanhang = new Entities.ChiTietHDBanHang[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 37
0
 public void LaySoDuKho()
 {
     Entities.SoDuKho sodukho;
     sodukho     = new Entities.SoDuKho();
     cl          = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     sodukho     = new Entities.SoDuKho("Select");
     clientstrem = cl.SerializeObj(this.client, "SoDuKho", sodukho);
     ddh         = new Entities.SoDuKho[1];
     ddh         = (Entities.SoDuKho[])cl.DeserializeHepper(clientstrem, ddh);
     if (ddh != null)
     {
         sdk = ddh;
     }
     else
     {
         sdk = new Entities.SoDuKho[0];
     }
 }
Exemplo n.º 38
0
        /// <summary>
        /// xử lý giá trị truyền tới
        /// </summary>
        /// <param name="str"></param>
        public frmXuLyBanLe(string str)
        {
            try
            {
                InitializeComponent();
                //
                cl = new Server_Client.Client();
                // gán TCPclient
                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
                CapNhatGia pt = new CapNhatGia("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                _cngkh = new CapNhatGia[1];
                Clientstrem = cl.SerializeObj(Client1, "CapNhatGia", pt);
                // đổ mảng đối tượng vào datagripview
                _cngkh = (CapNhatGia[])cl.DeserializeHepper1(Clientstrem, _cngkh) ?? new CapNhatGia[0];
                //
                _datesv = DateServer.Date();
                toolStripStatusLabel3.Enabled = false;
                dtgvsanpham.DataSource = new HangHoaHienThi[0];
                _str = str;
                TheVip();
                try
                {
                    LayKhoHang();
                    new Common.Utilities().ComboxKhoHang(cbbkhohang);
                }
                catch
                {
                }
                _datesv = DateServer.Date();
                cbxHinhthucthanhtoan.SelectedIndex = 0;
                mskngaychungtu.Text = new Common.Utilities().XuLy(2, _datesv.ToShortDateString());
                lbnhanvien.Text = Common.Utilities.User.TenNhanVien;
                //
                KhoiTao();
                _kmSoLuong = GetData();
            }
            catch
            {

            }
        }
Exemplo n.º 39
0
 public void ChiTietHDBanHang()
 {
     try
     {
         cl = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         Entities.CheckRefer ctxh = new Entities.CheckRefer("CTHDBH");
         clientstrem = cl.SerializeObj(this.client1, "Select", ctxh);
         chitiethdbanhang = (Entities.ChiTietHDBanHang[])cl.DeserializeHepper1(clientstrem, chitiethdbanhang);
         if (chitiethdbanhang == null)
         {
             chitiethdbanhang = new Entities.ChiTietHDBanHang[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 40
0
        private void tsslSua_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                CheckConflictUpdate();
                if (kt == "ok")
                {
                    Server_Client.Client cl = new Server_Client.Client();
                    this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                    PhongBan          pb = (PhongBan)cbbmapb.SelectedItem;
                    Entities.NhanVien nv = new Entities.NhanVien("Update", Convert.ToInt32(txtID.Text), txtmanv.Text, txttennv.Text, pb.MaPhongBan, " ", txtdcthuongtru.Text, txtdctamtru.Text, txtdtcd.Text, txtdtdd.Text, txtemail.Text, txtcmnd.Text, xulyNgayInsert(txtngaycap.Text), txtnoicap.Text, xulyNgayInsert(txtngaysinh.Text), txtghichu.Text, false, Common.Utilities.User.NhanVienID, Common.Utilities.User.TenDangNhap);
                    clientstream = cl.SerializeObj(this.client1, "NhanVien", nv);

                    int msg = 0;
                    msg = (int)cl.DeserializeHepper(clientstream, msg);
                    if (msg != 1)
                    {
                        MessageBox.Show("Update that bai");
                    }

                    tenNhanVien = txttennv.Text;
                    maPhongBan  = pb.MaPhongBan;
                    dCThuongTru = txtdcthuongtru.Text;
                    dCTamTru    = txtdctamtru.Text;
                    dienThoaiCD = txtdtcd.Text;
                    dienThoaiDD = txtdtdd.Text;
                    email       = txtemail.Text;
                    cMND        = txtcmnd.Text;
                    ngayCap     = xulyNgay(xulyNgayInsert(txtngaycap.Text));
                    noiCap      = txtnoicap.Text;
                    ngaySinh    = xulyNgay(xulyNgayInsert(txtngaysinh.Text));
                    ghiChu      = txtghichu.Text;
                    this.Close();
                }
                else
                if (kt == "null")
                {
                    MessageBox.Show("Bản Ghi đã bị xóa trước khi cập nhật! Vui lòng thao tác lại !");
                    this.Close();
                }
            }
        }
Exemplo n.º 41
0
        public void HienThi()
        {
            List <Entities.SoDuKho> listTemp = new List <Entities.SoDuKho>();

            Entities.SoDuKho sodukho;
            sodukho     = new Entities.SoDuKho();
            cl          = new Server_Client.Client();
            this.client = cl.Connect(Luu.IP, Luu.Ports);
            sodukho     = new Entities.SoDuKho("Select");
            clientstrem = cl.SerializeObj(this.client, "SoDuKho", sodukho);
            ddh         = new Entities.SoDuKho[1];
            ddh         = (Entities.SoDuKho[])cl.DeserializeHepper(clientstrem, ddh);

            if (ddh == null)
            {
                ddh = new Entities.SoDuKho[0];
            }

            //
            for (int i = 0; i < ddh.Length; i++)
            {
                if (ddh[i].NgayKetChuyen.Month.ToString().Equals(cbbthang.Text) && ddh[i].NgayKetChuyen.Year.ToString().Equals(cbbnam.Text))
                {
                    listTemp.Add(ddh[i]);
                }
            }
            if (listTemp.ToArray().Length != 0)
            {
                if ((bool)listTemp.ToArray()[0].TrangThai)
                {
                    lbtrangthai.ForeColor = Color.Red;
                    lbtrangthai.Text      = "Kỳ Đã Khóa";
                    tsslthuchien.Enabled  = false;
                }
                else
                {
                    lbtrangthai.ForeColor = Color.Green;
                    lbtrangthai.Text      = "Kỳ Chưa Khóa";
                    tsslthuchien.Enabled  = true;
                }
            }
        }
Exemplo n.º 42
0
 void SelectData()
 {
     try
     {
         i = 0;
         dtgvbanbuon.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.TheGiamGia pt = new Entities.TheGiamGia();
         pt.HanhDong = "Select";
         clientstrem = cl.SerializeObj(this.client1, "TheGiamGia", pt);
         // đổ mảng đối tượng vào datagripview
         hienthi = (Entities.TheGiamGia[])cl.DeserializeHepper1(clientstrem, hienthi);
         if (hienthi == null)
         {
             hienthi = new Entities.TheGiamGia[0];
         }
         //Fix hiển thị
         foreach (Entities.TheGiamGia item in hienthi)
         {
             item.GiaTriThe    = new TienIch().FormatMoney(item.GiaTriThe.Replace(",", ""));
             item.GiaTriConLai = new TienIch().FormatMoney(item.GiaTriConLai.Replace(",", ""));
         }
         //////////////////////////////////
         dtgvbanbuon.DataSource = hienthi;
         if (hienthi.Length != 0)
         {
             dtgvbanbuon.Rows[0].Selected = true;
         }
     }
     catch
     {
         MessageBox.Show("Không kết nối được với server - thử lại sau");
         dtgvbanbuon.DataSource = new Entities.TheGiamGia[0];
     }
     finally
     {
         fix();
     }
 }
Exemplo n.º 43
0
        public bool DeleteToDataBase()
        {
            bool msg = false;

            try
            {
                cl          = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);

                Entities.SoDuKho[] sdk1 = LaySoDuKhoTheoNgay(Convert.ToInt32(cbbthang.Text), Convert.ToInt32(cbbnam.Text));
                clientstrem = cl.SerializeObj(this.client, "XoaArr", sdk1);
                msg         = (bool)cl.DeserializeHepper(clientstrem, msg);
            }
            catch
            {
                msg = false;
            }

            return(msg);
        }
Exemplo n.º 44
0
 public void LayChiTiet_XuatHuy()
 {
     try
     {
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.ChiTietXuatHuy ctxh = new Entities.ChiTietXuatHuy("SelectSon");
         clientstrem = cl.SerializeObj(this.client, "ChiTietXuatHuy", ctxh);
         ctPXuatHuy  = new Entities.ChiTietXuatHuy[0];
         ctPXuatHuy  = (Entities.ChiTietXuatHuy[])cl.DeserializeHepper1(clientstrem, ctPXuatHuy);
         if (ctPXuatHuy == null)
         {
             ctPXuatHuy = new Entities.ChiTietXuatHuy[0];
             return;
         }
     }
     catch
     {
     }
 }
Exemplo n.º 45
0
        private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                Server_Client.Client cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                Entity.NhomTKKeToan pb = new Entity.NhomTKKeToan("Insert", Convert.ToInt32(txtID.Text), txtmapb.Text, txttenNTKKT.Text, txtghichu.Text, false);
                clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", pb);

                int msg = 0;
                msg = (int)cl.DeserializeHepper(clientstream, msg);
                if (msg == 1)
                {
                    MessageBox.Show("Insert thanh cong ...");
                }
                else
                    MessageBox.Show("Insert that bai");

            }
        }
Exemplo n.º 46
0
 /// <summary>
 /// do du lieu vao dgv
 /// </summary>
 private void HienThi_ChiTiet_DonDatHang()
 {
     try
     {
         Entities.DonDatHang dat = new Entities.DonDatHang();
         dat.Hanhdong     = "Select";
         dat.MaNhaCungCap = GiaTriCanLuu.Ma.ToString().ToUpper();
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         clientstrem = cl.SerializeObj(this.client, "HienThi_ChiTiet_DonDatHang", dat);
         Entities.HienThi_ChiTiet_DonDatHang[] ddh = new Entities.HienThi_ChiTiet_DonDatHang[1];
         ddh = (Entities.HienThi_ChiTiet_DonDatHang[])cl.DeserializeHepper(clientstrem, ddh);
         dgvInsertOrder.DataSource = ddh;
         DoiTen(dgvInsertOrder);
     }
     catch (Exception)
     { }
     client.Close();
     clientstrem.Close();
 }
Exemplo n.º 47
0
 void LayGiaVon()
 {
     try
     {
         cl           = new Server_Client.Client();
         this.client1 = cl.Connect(Luu.IP, Luu.Ports);
         ArrayList arr = new ArrayList();
         arr.Add("SelectTheoDieuKien_GiaVon");
         arr.Add("Select_GIAVON");
         arr.Add(new Entities.GiaVon());
         arr.Add(new Entities.GiaVon());
         clientstrem = cl.SerializeObj(this.client1, "GiaVon_k", arr);
         GIAVON      = (Entities.GiaVon[])cl.DeserializeHepper1(clientstrem, GIAVON);
         if (GIAVON == null)
         {
             GIAVON = new Entities.GiaVon[0];
         }
     }
     catch { }
 }
        private void tsslXacNhan_Click(object sender, EventArgs e)
        {
            if (check_Xacnhan.Checked == true)
            {
                Server_Client.Client cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                Entities.KhoHang kho1 = (Entities.KhoHang)cbxTukho.SelectedItem;
                Entities.KhoHang kho2 = (Entities.KhoHang)cbxDenkho.SelectedItem;
                Entities.PhieuDieuChuyenKhoNoiBo nv = new Entities.PhieuDieuChuyenKhoNoiBo("Update", PDCKID, txtSochungtu.Text, ConvertDatetime(makNgaychungtu.Text), kho1.MaKho, "", kho2.MaKho, "", maHDNhap, check_Xacnhan.Checked, ghichu, false);
                clientstrem = cl.SerializeObj(this.client1, "PhieuDieuCHuyenKhoNoiBo", nv);

                int msg = 0;
                msg = (int)cl.DeserializeHepper(clientstrem, msg);
                if (msg == 1)
                {
                    // tru so luong tu kho
                    Entities.KhoHang khoh = (Entities.KhoHang)cbxTukho.SelectedItem;
                    CheckDataGridTruSL(dgvInsertOrder, khoh.MaKho);
                    // Update so luong khi co hang hoa tong tai trong kho den
                    Entities.KhoHang khoDen = (Entities.KhoHang)cbxDenkho.SelectedItem;
                    CheckDataGridCongSL1(dgvInsertOrder, khoDen.MaKho);
                    // Insert so luong kho ko co hang hoa do
                    CheckDataGridCongSL(dgvInsertOrder, khoDen.MaKho);
                }
                else
                {
                    MessageBox.Show("Update that bai");
                    return;
                }


                this.Close();
            }
            else
            {
                if (check_Xacnhan.Checked == false)
                {
                    MessageBox.Show("Chưa xác nhận vào checkbox xác nhận ", "Hệ Thống Cảnh Báo");
                }
            }
        }
Exemplo n.º 49
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public bool InsertToDataBase2()
        {
            bool msg = false;

            try
            {
                string maSoDuKho = LayID("SoDuKho");
                for (int i = 0; i < ctBCXH.Length; i++)
                {
                    ctBCXH[i].MaSoDuKho = maSoDuKho;
                    ctBCXH[i].TrangThai = false;
                    ctBCXH[i].HanhDong  = "Insert";
                    int nam   = int.Parse(cbbnam.Text);
                    int thang = int.Parse(cbbthang.Text);
                    if (thang == 12)
                    {
                        nam  += 1;
                        thang = 1;
                    }
                    else
                    {
                        thang += 1;
                    }

                    ctBCXH[i].NgayKetChuyen = new DateTime(nam, thang, 1);
                    ctBCXH[i].SoDuDauKy     = ctBCXH[i].SoDuCuoiKy;
                    ctBCXH[i].SoDuCuoiKy    = 0;
                }
                //
                cl          = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                clientstrem = cl.SerializeObj(this.client, "ThemArr", ctBCXH);
                msg         = (bool)cl.DeserializeHepper(clientstrem, msg);
            }
            catch
            {
                msg = false;
            }

            return(msg);
        }
Exemplo n.º 50
0
        public void LayHDBanHang()
        {
            try
            {
                cl          = new Server_Client.Client();
                this.client = cl.Connect(Luu.IP, Luu.Ports);
                Entities.HDBanHang ctxh = new Entities.HDBanHang("Select");
                clientstrem = cl.SerializeObj(this.client, "HDBanHang", ctxh);
                Entities.HDBanHang[] HDBanHang1 = new Entities.HDBanHang[0];
                HDBanHang1 = (Entities.HDBanHang[])cl.DeserializeHepper1(clientstrem, HDBanHang1);
                if (HDBanHang1 == null)
                {
                    HDBanHang1 = new Entities.HDBanHang[0];
                    return;
                }

                int count = 0;
                for (int i = 0; i < HDBanHang1.Length; i++)
                {
                    DateTime ngayban = HDBanHang1[i].NgayBan;
                    if (ngayban >= BatDau && ngayban <= KetThuc)
                    {
                        count++;
                    }
                }
                HDBanHang = new Entities.HDBanHang[count];
                count     = 0;
                for (int i = 0; i < HDBanHang1.Length; i++)
                {
                    DateTime ngayban = HDBanHang1[i].NgayBan;
                    if (ngayban >= BatDau && ngayban <= KetThuc)
                    {
                        HDBanHang[count] = HDBanHang1[i];
                        count++;
                    }
                }
            }
            catch
            {
            }
        }
Exemplo n.º 51
0
 void SelectData()
 {
     Server_Client.Client cl = new Server_Client.Client();
     this.client1 = cl.Connect(Luu.IP, Luu.Ports);
     Entities.CheckRefer ctxh = new Entities.CheckRefer("BCCongNoNhaCungCap");
     clientstrem       = cl.SerializeObj(this.client1, "Select", ctxh);
     selectall         = (Entities.SelectAll)cl.DeserializeHepper(clientstrem, selectall);
     hienthi1          = selectall.SoDuCongNo;
     ncc               = selectall.NhaCungCap;
     hdn               = selectall.HoaDonNhap;
     tl                = selectall.TraLaiNCC;
     phieuttncc        = selectall.PhieuTTNCC;
     chitietphieuttncc = selectall.ChiTietPhieuTTNCC;
     phieuThuChi       = selectall.PhieuThu;
     SelectNhaCungCap();
     SelectNhapKho();
     SelectTLNCC();
     SelectPhieuTTNCC();
     SelectChiTietPhieuTTNCC();
     SelectSoDuCongNo();
 }
Exemplo n.º 52
0
        private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e)
        {
            if (Validate())
            {
                Server_Client.Client cl = new Server_Client.Client();
                this.client1 = cl.Connect(Luu.IP, Luu.Ports);
                Entity.NhomTKKeToan pb = new Entity.NhomTKKeToan("Insert", Convert.ToInt32(txtID.Text), txtmapb.Text, txttenNTKKT.Text, txtghichu.Text, false);
                clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", pb);

                int msg = 0;
                msg = (int)cl.DeserializeHepper(clientstream, msg);
                if (msg == 1)
                {
                    MessageBox.Show("Insert thanh cong ...");
                }
                else
                {
                    MessageBox.Show("Insert that bai");
                }
            }
        }
 public Entities.ChiTietQuyen[] LayChiTietQuyen(string manhomquyen)
 {
     try
     {
         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 nếu muốn truyền giá trị
         Entities.ChiTietQuyen nq = new Entities.ChiTietQuyen(manhomquyen);
         // khởi tạo mảng đối tượng để hứng giá trị
         Entities.ChiTietQuyen[] nq1;
         clientstrem = cl.SerializeObj(this.client1, "LayChiTietQuyen", nq);
         // đổ mảng đối tượng vào datagripview
         nq1 = (Entities.ChiTietQuyen[])cl.DeserializeHepper1(clientstrem, null);
         return(nq1);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemplo n.º 54
0
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     ctdh = new Entities.HoaDonNhap();
     cl = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     ctdh = new Entities.HoaDonNhap("Delete",ID);
     clientstrem = cl.SerializeObj(this.client, "HoaDonNhap", ctdh);
     int trave = 0;
     trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
     client.Close();
     clientstrem.Close();
     if (trave == 1)
     {
         SelectData();
         MessageBox.Show("Thành công !");
     }
     if (trave == 0)
     {
         MessageBox.Show("Thất bại !");
     }
 }
Exemplo n.º 55
0
        public void hienthi()
        {
            Server_Client.Client cl = new Server_Client.Client();
            this.client1 = cl.Connect(Luu.IP, Luu.Ports);
            ntkkt = new NhomTKKeToan("Select", 1, "a", "a", "a", false);
            clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", ntkkt);

            NhomTKKeToan[] tk1 = new NhomTKKeToan[1];
            tk1[0] = new NhomTKKeToan(1, "a", "a", "a", false);
            tk1 = (NhomTKKeToan[])cl.DeserializeHepper1(clientstream, tk1);

            foreach (NhomTKKeToan objtk in tk1)
            {
                if (objtk.MaNhomTKKeToan == maNhomTKKeToan)
                {
                    txtID.Text = objtk.NhomTKKeToanID.ToString();
                    txtmaNTKKT.Text = objtk.MaNhomTKKeToan;
                    txttenNTKKT.Text = objtk.TenNhomTKKeToan;
                    txtghichu.Text = objtk.GhiChu;
                }
            }
        }
Exemplo n.º 56
0
        private void cmbMaNhanVien_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbMaNhanVien.Items.Clear();
             client = new Server_Client.Client();
             this.tcpClient = client.Connect(Luu.IP, Luu.Ports);

             Entities.NhanVien kh = new Entities.NhanVien();
             kh = new Entities.NhanVien("Select");
             networkStream = client.SerializeObj(this.tcpClient, "NhanVien", kh);
             Entities.NhanVien[] kh1 = new Entities.NhanVien[1];
             kh1 = (Entities.NhanVien[])client.DeserializeHepper1(networkStream, kh1);

             if (kh1.Length > 0)
             {
                 int sl = kh1.Length;
                 for (int i = 0; i < sl; i++)
                 {
                     if (kh1[i].Deleted == false)
                         cmbMaNhanVien.Items.Add(kh1[i].MaNhanVien);
                 }
             }
        }
Exemplo n.º 57
0
 public void DeleteSoQuy()
 {
     try
     {
         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.SoDuSoQuy pt = new Entities.SoDuSoQuy("Delete", ma);
         // khởi tạo mảng đối tượng để hứng giá trị
         clientstrem = cl.SerializeObj(this.client1, "SoQuy", pt);
         bool kt = false;
         kt = (bool)cl.DeserializeHepper(clientstrem, kt);
         if (kt == true)
         {
             SelectData();
         }
     }
     catch
     {
     }
 }
Exemplo n.º 58
0
        public Entities.ChiTietQuyen[] LayChiTietQuyen(string manhomquyen)
        {
            try
            {
                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 nếu muốn truyền giá trị
                Entities.ChiTietQuyen nq = new Entities.ChiTietQuyen(manhomquyen);
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.ChiTietQuyen[] nq1;
                clientstrem = cl.SerializeObj(this.client1, "LayChiTietQuyen", nq);
                // đổ mảng đối tượng vào datagripview
                nq1 = (Entities.ChiTietQuyen[])cl.DeserializeHepper1(clientstrem, null);
                return nq1;
            }
            catch (Exception)
            {

                return null;
            }
        }
Exemplo n.º 59
0
        public void CheckConflictInsert()
        {
            try
            {
                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.NhomTKKeToan pb = new Entities.NhomTKKeToan("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.NhomTKKeToan[] pb1 = new Entities.NhomTKKeToan[1];
                clientstream = cl.SerializeObj(this.client1, "NhomTKKeToan", pb);
                // đổ mảng đối tượng vào datagripview
                pb1 = (Entities.NhomTKKeToan[])cl.DeserializeHepper1(clientstream, pb1);
                if (pb1 != null)
                {
                    for (int j = 0; j < pb1.Length; j++)
                    {
                        if (pb1[j].MaNhomTKKeToan == txtmaNTKKT.Text)
                        {
                            MessageBox.Show("Mã nhóm tk này đã có trong dữ liệu - mời nhập lại");
                            kt = "ko";
                            txtmaNTKKT.Text = "";
                            break;
                        }
                        else
                            kt = "ok";
                    }

                }
                else
                    kt = "ok";

            }
            catch
            {
            }
        }
Exemplo n.º 60
0
        public void CheckConflictInsert()
        {
            try
            {
                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.PhongBan pb = new Entities.PhongBan("Select");
                // khởi tạo mảng đối tượng để hứng giá trị
                Entities.PhongBan[] pb1 = new Entities.PhongBan[1];
                clientstream = cl.SerializeObj(this.client1, "PhongBan", pb);
                // đổ mảng đối tượng vào datagripview
                pb1 = (Entities.PhongBan[])cl.DeserializeHepper1(clientstream, pb1);
                if (pb1 != null)
                {
                    for (int j = 0; j < pb1.Length; j++)
                    {
                        if (pb1[j].MaPhongBan == txtmapb.Text)
                        {
                            MessageBox.Show("cập nhật mã Khoản Mục - kiểm tra lại để insert");
                            kt = "ko";
                            txtmapb.Text = LayID("PhongBan");
                            break;
                        }
                        else
                            kt = "ok";
                    }

                }
                else
                    kt = "ok";

            }
            catch
            {
            }
        }