Exemple #1
0
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     try
     {
         dgvHienThi.DataSource = null;
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh          = new Entities.DonDatHang("Select", "");
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         Entities.DonDatHang[] ddh = new Entities.DonDatHang[1];
         ddh = (Entities.DonDatHang[])cl.DeserializeHepper(clientstrem, ddh);
         if (ddh.Length > 0)
         {
             search = ddh;
             dgvHienThi.DataSource = search;
             rdoTatca.Checked      = true;
         }
         else
         {
             Entities.DonDatHang[] lay = new Entities.DonDatHang[0];
             dgvHienThi.DataSource = lay;
             search = null;
             toolStripStatus_Sua.Enabled = false;
         }
         FixDataGridview(dgvHienThi);
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         Entities.DonDatHang[] lay = new Entities.DonDatHang[0];
         dgvHienThi.DataSource = lay;
         FixDataGridview(dgvHienThi);
     }
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData(string ID)
 {
     try
     {
         dgvHienThi.DataSource = null;
         ctdh        = new Entities.TraLaiNCC();
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         ctdh        = new Entities.TraLaiNCC("Select", ID);
         clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
         Entities.TraLaiNCC[] ddh = new Entities.TraLaiNCC[1];
         ddh = (Entities.TraLaiNCC[])cl.DeserializeHepper(clientstrem, ddh);
         if (ddh.Length > 0)
         {
             search = new Entities.TraLaiNCC[ddh.Length];
             search = ddh;
             dgvHienThi.DataSource = search;
             rdoTatca.Checked      = true;
         }
         else
         {
             CapNhat(dgvHienThi);
         }
         fixDatagridview();
     }
     catch (Exception ex)
     {
         string s = ex.Message;
         CapNhat(dgvHienThi);
         fixDatagridview();
     }
 }
Exemple #3
0
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         dh             = new Entities.DonDatHang();
         cl             = new Server_Client.Client();
         this.client    = cl.Connect(Luu.IP, Luu.Ports);
         dh             = new Entities.DonDatHang("Delete", ID);
         dh.Manhanvien  = Common.Utilities.User.MaNV;
         dh.Tendangnhap = Common.Utilities.User.TenDangNhap;
         clientstrem    = cl.SerializeObj(this.client, "DonDatHang", dh);
         int trave = 0;
         trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
         client.Close();
         clientstrem.Close();
         if (trave >= 1)
         {
             SelectData();
             if (dgvHienThi.RowCount <= 0)
             {
                 search = null;
             }
         }
         else
         {
             MessageBox.Show("Thất bại !");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         dh          = new Entities.DonDatHang();
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh          = new Entities.DonDatHang("Delete", ID);
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         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 !");
         }
     }
     catch (Exception)
     { }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         if (ID != "")
         {
             ctdh        = new Entities.TraLaiNCC();
             cl          = new Server_Client.Client();
             this.client = cl.Connect(Luu.IP, Luu.Ports);
             ctdh        = new Entities.TraLaiNCC("Delete", ID);
             clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
             int trave = 0;
             trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
             client.Close();
             clientstrem.Close();
             if (trave >= 1)
             {
                 SelectData("");
             }
             if (trave == 0)
             {
                 MessageBox.Show("Thất bại !");
             }
         }
         else
         {
             MessageBox.Show("Không tìm thấy mã cần xóa");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         dh = new Entities.DonDatHang();
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh = new Entities.DonDatHang("Delete", ID);
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         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 !");
         }
     }
     catch (Exception)
     { }
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     dgvHienThi.DataSource = null;
     ctdh        = new Entities.TraLaiNCC();
     cl          = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     ctdh        = new Entities.TraLaiNCC("Select");
     clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
     Entities.TraLaiNCC[] ddh = new Entities.TraLaiNCC[1];
     ddh = (Entities.TraLaiNCC[])cl.DeserializeHepper(clientstrem, ddh);
     dgvHienThi.DataSource            = ddh;
     dgvHienThi.Columns[1].Visible    = false;
     dgvHienThi.Columns[0].HeaderText = "STT";
     new Common.Utilities().CountDatagridview(dgvHienThi);
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     try
     {
         dgvHienThi.DataSource = null;
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh          = new Entities.DonDatHang("Select");
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         Entities.DonDatHang[] ddh = new Entities.DonDatHang[1];
         ddh = (Entities.DonDatHang[])cl.DeserializeHepper(clientstrem, ddh);
         dgvHienThi.DataSource             = ddh;
         dgvHienThi.Columns[0].HeaderText  = "STT";
         dgvHienThi.Columns[0].Width       = 10;
         dgvHienThi.Columns[1].Visible     = false;
         dgvHienThi.Columns[2].HeaderText  = "Mã đơn đặt hàng";
         dgvHienThi.Columns[3].Visible     = false;
         dgvHienThi.Columns[4].HeaderText  = "Ngày đơn hàng ";
         dgvHienThi.Columns[5].Visible     = false;
         dgvHienThi.Columns[6].Visible     = false;
         dgvHienThi.Columns[7].Visible     = false;
         dgvHienThi.Columns[8].HeaderText  = "Ngày dự kiến";
         dgvHienThi.Columns[9].Visible     = false;
         dgvHienThi.Columns[10].Visible    = false;
         dgvHienThi.Columns[11].Visible    = false;
         dgvHienThi.Columns[12].Visible    = false;
         dgvHienThi.Columns[13].Visible    = false;
         dgvHienThi.Columns[17].HeaderText = "Thuế GTGT";
         dgvHienThi.Columns[15].Visible    = false;
         dgvHienThi.Columns[16].Visible    = false;
         dgvHienThi.Columns[17].HeaderText = "Ghi chú";
         dgvHienThi.Columns[18].Visible    = false;
         new Common.Utilities().CountDatagridview(dgvHienThi);
         dgvHienThi.RowHeadersVisible   = false;
         dgvHienThi.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dgvHienThi.SelectionMode       = DataGridViewSelectionMode.FullRowSelect;
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         MessageBox.Show("Lỗi hiển thị dữ liệu");
     }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     ctdh = new Entities.TraLaiNCC();
     cl = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     ctdh = new Entities.TraLaiNCC("Delete", ID);
     clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", 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 !");
     }
 }
        /// <summary>
        /// hungvv =======================Xoa ===========================
        /// </summary>
        private void DeleteData(string ID)
        {
            ctdh        = new Entities.TraLaiNCC();
            cl          = new Server_Client.Client();
            this.client = cl.Connect(Luu.IP, Luu.Ports);
            ctdh        = new Entities.TraLaiNCC("Delete", ID);
            clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", 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 !");
            }
        }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData(string ID)
 {
     try
     {
         dgvHienThi.DataSource = null;
         ctdh = new Entities.TraLaiNCC();
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         ctdh = new Entities.TraLaiNCC("Select", ID);
         clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
         Entities.TraLaiNCC[] ddh = new Entities.TraLaiNCC[1];
         ddh = (Entities.TraLaiNCC[])cl.DeserializeHepper(clientstrem, ddh);
         if (ddh.Length > 0)
         {
             search = new Entities.TraLaiNCC[ddh.Length];
             search = ddh;
             dgvHienThi.DataSource = search;
             rdoTatca.Checked = true;
         }
         else
         {
             CapNhat(dgvHienThi);
         }
         fixDatagridview();
     }
     catch (Exception ex)
     {
         string s = ex.Message;
         CapNhat(dgvHienThi);
         fixDatagridview();
     }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         if (ID != "")
         {
             ctdh = new Entities.TraLaiNCC();
             cl = new Server_Client.Client();
             this.client = cl.Connect(Luu.IP, Luu.Ports);
             ctdh = new Entities.TraLaiNCC("Delete", ID);
             clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
             int trave = 0;
             trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
             client.Close();
             clientstrem.Close();
             if (trave >= 1)
             {
                 SelectData("");
             }
             if (trave == 0)
             {
                 MessageBox.Show("Thất bại !");
             }
         }
         else
         { MessageBox.Show("Không tìm thấy mã cần xóa"); }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     try
     {
         dgvHienThi.DataSource = null;
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh = new Entities.DonDatHang("Select", "");
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         Entities.DonDatHang[] ddh = new Entities.DonDatHang[1];
         ddh = (Entities.DonDatHang[])cl.DeserializeHepper(clientstrem, ddh);
         if (ddh.Length > 0)
         {
             search = ddh;
             dgvHienThi.DataSource = search;
             rdoTatca.Checked = true;
         }
         else
         {
             Entities.DonDatHang[] lay = new Entities.DonDatHang[0];
             dgvHienThi.DataSource = lay;
             search = null;
             toolStripStatus_Sua.Enabled = false;
         }
         FixDataGridview(dgvHienThi);
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         Entities.DonDatHang[] lay = new Entities.DonDatHang[0];
         dgvHienThi.DataSource = lay;
         FixDataGridview(dgvHienThi);
     }
 }
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData(string ID)
 {
     try
     {
         dh = new Entities.DonDatHang();
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh = new Entities.DonDatHang("Delete", ID);
         dh.Manhanvien = Common.Utilities.User.MaNV;
         dh.Tendangnhap = Common.Utilities.User.TenDangNhap;
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         int trave = 0;
         trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, trave));
         client.Close();
         clientstrem.Close();
         if (trave >= 1)
         {
             SelectData();
             if (dgvHienThi.RowCount <= 0)
             { search = null; }
         }
         else
         {
             MessageBox.Show("Thất bại !");
         }
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     dgvHienThi.DataSource = null;
     ctdh = new Entities.TraLaiNCC();
     cl = new Server_Client.Client();
     this.client = cl.Connect(Luu.IP, Luu.Ports);
     ctdh = new Entities.TraLaiNCC("Select");
     clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", ctdh);
     Entities.TraLaiNCC[] ddh = new Entities.TraLaiNCC[1];
     ddh = (Entities.TraLaiNCC[])cl.DeserializeHepper(clientstrem, ddh);
     dgvHienThi.DataSource = ddh;
     dgvHienThi.Columns[1].Visible = false;
     dgvHienThi.Columns[0].HeaderText = "STT";
     new Common.Utilities().CountDatagridview(dgvHienThi);
 }
 /// <summary>
 /// hungvv =======================giao tiep voi server===========================
 /// </summary>
 private void SelectData()
 {
     try
     {
         dgvHienThi.DataSource = null;
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         dh = new Entities.DonDatHang("Select");
         clientstrem = cl.SerializeObj(this.client, "DonDatHang", dh);
         Entities.DonDatHang[] ddh = new Entities.DonDatHang[1];
         ddh = (Entities.DonDatHang[])cl.DeserializeHepper(clientstrem, ddh);
         dgvHienThi.DataSource = ddh;
         dgvHienThi.Columns[0].HeaderText = "STT";
         dgvHienThi.Columns[0].Width = 10;
         dgvHienThi.Columns[1].Visible = false;
         dgvHienThi.Columns[2].HeaderText = "Mã đơn đặt hàng";
         dgvHienThi.Columns[3].Visible = false;
         dgvHienThi.Columns[4].HeaderText = "Ngày đơn hàng ";
         dgvHienThi.Columns[5].Visible = false;
         dgvHienThi.Columns[6].Visible = false;
         dgvHienThi.Columns[7].Visible = false;
         dgvHienThi.Columns[8].HeaderText = "Ngày dự kiến";
         dgvHienThi.Columns[9].Visible = false;
         dgvHienThi.Columns[10].Visible = false;
         dgvHienThi.Columns[11].Visible = false;
         dgvHienThi.Columns[12].Visible = false;
         dgvHienThi.Columns[13].Visible = false;
         dgvHienThi.Columns[17].HeaderText = "Thuế GTGT";
         dgvHienThi.Columns[15].Visible = false;
         dgvHienThi.Columns[16].Visible = false;
         dgvHienThi.Columns[17].HeaderText = "Ghi chú";
         dgvHienThi.Columns[18].Visible = false;
         new Common.Utilities().CountDatagridview(dgvHienThi);
         dgvHienThi.RowHeadersVisible = false;
         dgvHienThi.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dgvHienThi.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         MessageBox.Show("Lỗi hiển thị dữ liệu");
     }
 }