/// <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; }
 }
 public void LayTraLaiNCC()
 {
     try
     {
         List <Entities.TraLaiNCC> listTemp = new List <Entities.TraLaiNCC>();
         cl          = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.TraLaiNCC ctxh = new Entities.TraLaiNCC("Select");
         clientstrem = cl.SerializeObj(this.client, "TLNCC", ctxh);
         Entities.TraLaiNCC[] TraLaiNCC1 = new Entities.TraLaiNCC[0];
         TraLaiNCC1 = (Entities.TraLaiNCC[])cl.DeserializeHepper1(clientstrem, TraLaiNCC1);
         if (TraLaiNCC1 == null)
         {
             TraLaiNCC = new Entities.TraLaiNCC[0];
             return;
         }
         //
         for (int i = 0; i < TraLaiNCC1.Length; i++)
         {
             DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 listTemp.Add(TraLaiNCC1[i]);
             }
         }
         //
         TraLaiNCC = listTemp.ToArray();
     }
     catch
     {
     }
 }
示例#4
0
 /// <summary>
 /// select trả lại nhà cung cấp
 /// </summary>
 private void SelectTLNCC()
 {
     try
     {
         Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
         int sotang = 0;
         for (int j = 0; j < tl.Length; j++)
         {
             string month1 = tl[j].Ngaytra.Month.ToString();
             string year1  = tl[j].Ngaytra.Year.ToString();
             if (month == month1 & year == year1 && Convert.ToDouble(tl[j].ThanhToanNgay) != 0)
             {
                 sl++;
                 pt2[sotang] = tl[j];
                 sotang++;
             }
         }
         tl = new Entities.TraLaiNCC[sotang];
         if (sotang != 0)
         {
             for (int j = 0; j < sotang; j++)
             {
                 tl[j] = pt2[j];
             }
         }
         else
         {
             tl = new Entities.TraLaiNCC[0];
         }
     }
     catch { }
 }
        private Entities.TraLaiNCC getDatagridview()
        {
            Entities.TraLaiNCC tra = new Entities.TraLaiNCC();
            int x = dgvHienThi.RowCount;
            int y = dgvHienThi.ColumnCount;

            if (y <= -1 || x <= -1)
            {
            }
            else
            {
                int vitri = dgvHienThi.CurrentRow.Index;
                tra.MaHDTraLaiNCC     = "" + dgvHienThi.Rows[vitri].Cells["MaHDTraLaiNCC"].Value.ToString().ToUpper();
                tra.Ngaytra           = DateTime.Parse("" + dgvHienThi.Rows[vitri].Cells["Ngaytra"].Value.ToString());
                tra.MaNCC             = "" + dgvHienThi.Rows[vitri].Cells["MaNCC"].Value.ToString().ToUpper();
                tra.NoHienThoi        = dgvHienThi.Rows[vitri].Cells["NoHienThoi"].Value.ToString();
                tra.NguoiNhanHang     = "" + dgvHienThi.Rows[vitri].Cells["NguoiNhanHang"].Value.ToString();
                tra.HinhThucThanhToan = "" + dgvHienThi.Rows[vitri].Cells["HinhThucThanhToan"].Value.ToString();
                tra.MaHoaDonNhap      = "" + dgvHienThi.Rows[vitri].Cells["MaHoaDonNhap"].Value.ToString().ToUpper();
                tra.MaKho             = dgvHienThi.Rows[vitri].Cells["MaKho"].Value.ToString();
                tra.MaTienTe          = "" + dgvHienThi.Rows[vitri].Cells["MaTienTe"].Value.ToString().ToUpper();
                tra.TienBoiThuong     = dgvHienThi.Rows[vitri].Cells["TienBoiThuong"].Value.ToString();
                tra.ThanhToanNgay     = dgvHienThi.Rows[vitri].Cells["ThanhToanNgay"].Value.ToString();
                tra.ThueGTGT          = dgvHienThi.Rows[vitri].Cells["ThueGTGT"].Value.ToString();
                tra.GhiChu            = dgvHienThi.Rows[vitri].Cells["GhiChu"].Value.ToString();
            }
            return(tra);
        }
 public frmXuLy_HangTraLai(string hanhdong, string tenForm, string truyen, Entities.TraLaiNCC ncctra)
 {
     InitializeComponent();
     this.HanhDong = hanhdong;
     this.tenForm = tenForm;
     this.truyen = truyen;
     this.ncctra = ncctra;
 }
示例#7
0
 public Entities.TraLaiNCC[] TraLaiNCC()
 {
     Entities.TraLaiNCC[] select = (Entities.TraLaiNCC[]) new BizLogic.CongNo().SelectTLNCC();
     if (select == null)
     {
         select = new Entities.TraLaiNCC[0];
     }
     return(select);
 }
 private void CapNhat(DataGridView dgv)
 {
     try
     {
         Entities.TraLaiNCC[] lay = new Entities.TraLaiNCC[0];
         dgv.DataSource = lay;
     }
     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>
        /// select trả lại nhà cung cấp
        /// </summary>
        private void SelectTLNCC()
        {
            try
            {
                if (tl == null || tl.Length == 0)
                {
                    tl = new Entities.TraLaiNCC[0];
                    return;
                }

                Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
                int sotang = 0;
                for (int j = 0; j < tl.Length; j++)
                {
                    DateTime hientai = tl[j].Ngaytra;
                    if (tl[j].Deleted == false && hientai.Date >= Convert.ToDateTime(batdau).Date&& hientai.Date < Convert.ToDateTime(ketthuc).Date)
                    {
                        pt2[sotang] = tl[j];
                        sotang++;
                    }
                }
                tl = new Entities.TraLaiNCC[sotang];
                if (sotang != 0)
                {
                    for (int j = 0; j < sotang; j++)
                    {
                        tl[j] = pt2[j];
                    }
                }
                else
                {
                    tl = new Entities.TraLaiNCC[0];
                }
            }
            catch
            {
            }
            finally
            {
            }
        }
 /// <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 !");
     }
 }
 private Entities.TraLaiNCC getDatagridview()
 {
     Entities.TraLaiNCC tra = new Entities.TraLaiNCC();
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             int x = dgvHienThi.RowCount;
             int y = dgvHienThi.ColumnCount;
             if (y <= -1 || x <= -1)
             {
             }
             else
             {
                 int vitri = dgvHienThi.CurrentRow.Index;
                 tra.TraLaiNCCID       = int.Parse(dgvHienThi.Rows[vitri].Cells[1].Value.ToString());
                 tra.MaHDTraLaiNCC     = "" + dgvHienThi.Rows[vitri].Cells[2].Value.ToString();
                 tra.Ngaytra           = DateTime.Parse(dgvHienThi.Rows[vitri].Cells[3].Value.ToString());
                 tra.MaNCC             = dgvHienThi.Rows[vitri].Cells[4].Value.ToString();
                 tra.NoHienThoi        = dgvHienThi.Rows[vitri].Cells[5].Value.ToString();
                 tra.NguoiNhanHang     = "" + dgvHienThi.Rows[vitri].Cells[6].Value.ToString();
                 tra.HinhThucThanhToan = "" + dgvHienThi.Rows[vitri].Cells[7].Value.ToString();
                 tra.MaHoaDonNhap      = dgvHienThi.Rows[vitri].Cells[8].Value.ToString();
                 tra.MaKho             = dgvHienThi.Rows[vitri].Cells[9].Value.ToString();
                 tra.MaTienTe          = "" + dgvHienThi.Rows[vitri].Cells[10].Value.ToString();
                 tra.TienBoiThuong     = dgvHienThi.Rows[vitri].Cells[11].Value.ToString();
                 tra.ThanhToanNgay     = dgvHienThi.Rows[vitri].Cells[12].Value.ToString();
                 tra.ThueGTGT          = dgvHienThi.Rows[vitri].Cells[13].Value.ToString();
                 tra.GhiChu            = dgvHienThi.Rows[vitri].Cells[14].Value.ToString();
                 tra.Deleted           = Boolean.Parse(dgvHienThi.Rows[vitri].Cells[15].Value.ToString());
             }
         }
         else
         {
         }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     return(tra);
 }
        /// <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 !");
            }
        }
示例#14
0
 public void LayTraLaiNCC()
 {
     try
     {
         Entities.TraLaiNCC[] TraLaiNCC1 = new Entities.TraLaiNCC[0];
         TraLaiNCC1 = new BizLogic.TraLaiNhaCungCap().Select();
         if (TraLaiNCC1 == null)
         {
             TraLaiNCC = new Entities.TraLaiNCC[0];
             return;
         }
         int count = 0;
         for (int i = 0; i < TraLaiNCC1.Length; i++)
         {
             DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 count++;
             }
         }
         TraLaiNCC = new Entities.TraLaiNCC[count];
         count     = 0;
         for (int i = 0; i < TraLaiNCC1.Length; i++)
         {
             DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 TraLaiNCC[count] = TraLaiNCC1[i];
                 count++;
             }
         }
     }
     catch
     {
     }
 }
 /// <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; }
 }
示例#16
0
        /// <summary>
        /// select trả lại nhà cung cấp
        /// </summary>
        private void SelectTLNCC()
        {
            try
            {
                if (tl == null || tl.Length == 0)
                {
                    tl = new Entities.TraLaiNCC[0];
                    return;
                }

                Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
                int sotang = 0;
                for (int j = 0; j < tl.Length; j++)
                {
                    string month1 = tl[j].Ngaytra.Month.ToString();
                    string year1 = tl[j].Ngaytra.Year.ToString();

                    if (tl[j].Deleted == false && month1 == month && year1 == year)
                    {
                        pt2[sotang] = tl[j];
                        sotang++;
                    }
                }
                tl = new Entities.TraLaiNCC[sotang];
                if (sotang != 0)
                {

                    for (int j = 0; j < sotang; j++)
                    {
                        tl[j] = pt2[j];
                    }
                }
                else
                    tl = new Entities.TraLaiNCC[0];
            }
            catch { }
        }
 public void CheckUpdateTLNCC()
 {
     kt = false;
     cl = new Server_Client.Client();
     this.client1 = cl.Connect(Luu.IP, Luu.Ports);
     Entities.TraLaiNCC ctk = new Entities.TraLaiNCC();
     ctk = new Entities.TraLaiNCC("Select");
     Entities.TraLaiNCC[] ctk1 = new Entities.TraLaiNCC[1];
     clientstrem = cl.SerializeObj(this.client1, "TraLaiNhaCungCap", ctk);
     ctk1 = (Entities.TraLaiNCC[])cl.DeserializeHepper1(clientstrem, ctk1);
     dgvXemthongtin.DataSource = ctk;
     if (ctk != null)
     {
         for (int j = 0; j < ctk1.Length; j++)
         {
             if (ctk1[j].MaHDTraLaiNCC == sodonhang)
             {
                 kt = CheckTLNCC(ctk1[j]);
                 if (kt == false)
                     MessageBox.Show("đã cật nhập 1 số trường thay đổi - kiểm tra lại", "hệ thống cảnh báo");
                 break;
             }
             else
                 kt = true;
         }
     }
 }
 public void CheckInsertTLNCC()
 {
     kt = false;
     cl = new Server_Client.Client();
     this.client1 = cl.Connect(Luu.IP, Luu.Ports);
     Entities.TraLaiNCC ctk = new Entities.TraLaiNCC();
     ctk = new Entities.TraLaiNCC("Select");
     clientstrem = cl.SerializeObj(this.client1, "TraLaiNhaCungCap", ctk);
     Entities.TraLaiNCC[] ctk1 = new Entities.TraLaiNCC[1];
     ctk1 = (Entities.TraLaiNCC[])cl.DeserializeHepper1(clientstrem, ctk1);
     dgvXemthongtin.DataSource = ctk;
     if (ctk != null)
     {
         for (int j = 0; j < ctk1.Length; j++)
         {
             if (ctk1[j].MaHDTraLaiNCC == sodonhang)
             {
                 MessageBox.Show("cập nhật mã phiếu - kiểm tra lại để insert");
                 kt = false;
                 sodonhang = txtSodonhang.Text = new Common.Utilities().ProcessID(txtSodonhang.Text);
                 break;
             }
             else
                 kt = true;
         }
     }
 }
 /// <summary>
 /// xoa
 /// </summary>
 /// <param name="hanhdong"></param>
 /// <param name="matralainhacungcap"></param>
 private void XuLy_Xoa_TraLaiNhaCungCap(string hanhdong, string matralainhacungcap)
 {
     Entities.TraLaiNCC them = new Entities.TraLaiNCC();
     them = new Entities.TraLaiNCC(hanhdong, matralainhacungcap);
     clientstrem = cl.SerializeObj(this.client, "TraLaiNCC", them);
     //hứng giá trị trả về
     int trave;
     Entities.TraLaiNCC[] tralai = new Entities.TraLaiNCC[1];
     trave = (int)cl.DeserializeHepper(clientstrem, tralai);
     //thong bao
     if (trave == 1) { MessageBox.Show("Thành công !"); }
     else { MessageBox.Show("Thất bại !"); }
 }
 /// <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(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>
        /// select trả lại nhà cung cấp
        /// </summary>
        private void SelectTLNCC()
        {
            try
            {
                Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
                int sotang = 0;
                for (int j = 0; j < tl.Length; j++)
                {
                    if (batDau <= tl[j].Ngaytra && tl[j].Ngaytra <= ketThuc && Convert.ToDouble(tl[j].ThanhToanNgay) != 0)
                    {
                        sl++;
                        pt2[sotang] = tl[j];
                        sotang++;
                    }
                }
                tl = new Entities.TraLaiNCC[sotang];
                if (sotang != 0)
                {

                    for (int j = 0; j < sotang; j++)
                    {
                        tl[j] = pt2[j];
                    }
                }
                else
                    tl = new Entities.TraLaiNCC[0];
            }
            catch
            {
            }
            finally
            {

            }
        }
 private void SearchData(RadioButton rdoMa, RadioButton rdoNgay, RadioButton rdoTatCa, DataGridView dgv, string giatritim)
 {
     try
     {
         if (search.Length > 0)
         {
             ArrayList            list    = new ArrayList();
             Entities.TraLaiNCC[] getData = null;
             if (rdoMa.Checked == true)
             {
                 if (giatritim != "")
                 {
                     for (int i = 0; i < search.Length; i++)
                     {
                         string layma = search[i].MaHDTraLaiNCC.ToLower();
                         if (layma.Length > 0)
                         {
                             int index = layma.IndexOf(giatritim);
                             if (index >= 0)
                             {
                                 list.Add(search[i]);
                             }
                         }
                         else
                         {
                             continue;
                         }
                     }
                     int n = list.Count;
                     if (n == 0)
                     {
                         getData = null;
                     }
                     getData = new Entities.TraLaiNCC[n];
                     for (int i = 0; i < n; i++)
                     {
                         getData[i] = (Entities.TraLaiNCC)list[i];
                     }
                     dgv.DataSource = null;
                     dgv.DataSource = getData;
                 }
                 else
                 {
                     CapNhat(dgv);
                 }
             }
             if (rdoNgay.Checked == true)
             {
                 if (giatritim != "")
                 {
                     for (int i = 0; i < search.Length; i++)
                     {
                         string layma = search[i].Ngaytra.ToString().ToLower();
                         if (layma.Length > 0)
                         {
                             int index = layma.IndexOf(giatritim);
                             if (index >= 0)
                             {
                                 list.Add(search[i]);
                             }
                         }
                         else
                         {
                             continue;
                         }
                     }
                     int n = list.Count;
                     if (n == 0)
                     {
                         getData = null;
                     }
                     getData = new Entities.TraLaiNCC[n];
                     for (int i = 0; i < n; i++)
                     {
                         getData[i] = (Entities.TraLaiNCC)list[i];
                     }
                     dgv.DataSource = null;
                     dgv.DataSource = getData;
                 }
                 else
                 {
                     CapNhat(dgv);
                 }
             }
             if (rdoTatca.Checked == true)
             {
                 dgv.DataSource = null;
                 dgv.DataSource = search;
             }
         }
         else
         {
             CapNhat(dgv);
         }
         fixDatagridview();
     }
     catch (Exception ex)
     {
         string s = ex.Message;
         CapNhat(dgv);
         fixDatagridview();
     }
 }
示例#24
0
 /// <summary>
 /// hungvv =======================Xoa ===========================
 /// </summary>
 private void DeleteData2(string ID)
 {
     try
     {
         Entities.TraLaiNCC 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();
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
        /// <summary>
        /// select trả lại nhà cung cấp
        /// </summary>
        private void SelectTLNCC()
        {
            try
            {
                if (tl == null || tl.Length == 0)
                {
                    tl = new Entities.TraLaiNCC[0];
                    return;
                }

                Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
                int sotang = 0;
                for (int j = 0; j < tl.Length; j++)
                {
                    DateTime hientai = tl[j].Ngaytra;
                    if (tl[j].Deleted == false && hientai.Date >= Convert.ToDateTime(batdau).Date && hientai.Date < Convert.ToDateTime(ketthuc).Date)
                    {
                        pt2[sotang] = tl[j];
                        sotang++;
                    }
                }
                tl = new Entities.TraLaiNCC[sotang];
                if (sotang != 0)
                {

                    for (int j = 0; j < sotang; j++)
                    {
                        tl[j] = pt2[j];
                    }
                }
                else
                    tl = new Entities.TraLaiNCC[0];
            }
            catch
            {
            }
            finally
            {

            }
        }
示例#26
0
        public void LayTraLaiNCC()
        {
            try
            {
                Entities.TraLaiNCC[] TraLaiNCC1 = new Entities.TraLaiNCC[0];
                TraLaiNCC1 = new BizLogic.TraLaiNhaCungCap().Select();
                if (TraLaiNCC1 == null)
                {
                    TraLaiNCC = new Entities.TraLaiNCC[0];
                    return;
                }
                int count = 0;
                for (int i = 0; i < TraLaiNCC1.Length; i++)
                {
                    DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
                    if (ngaylap >= BatDau && ngaylap <= KetThuc)
                    {
                        count++;
                    }
                }
                TraLaiNCC = new Entities.TraLaiNCC[count];
                count = 0;
                for (int i = 0; i < TraLaiNCC1.Length; i++)
                {
                    DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
                    if (ngaylap >= BatDau && ngaylap <= KetThuc)
                    {
                        TraLaiNCC[count] = TraLaiNCC1[i];
                        count++;
                    }
                }

            }
            catch
            {
            }
        }
 private Entities.TraLaiNCC getDatagridview()
 {
     Entities.TraLaiNCC tra = new Entities.TraLaiNCC();
     try
     {
         if (dgvHienThi.RowCount > 0)
         {
             int x = dgvHienThi.RowCount;
             int y = dgvHienThi.ColumnCount;
             if (y <= -1 || x <= -1)
             { }
             else
             {
                 int vitri = dgvHienThi.CurrentRow.Index;
                 tra.TraLaiNCCID = int.Parse(dgvHienThi.Rows[vitri].Cells[1].Value.ToString());
                 tra.MaHDTraLaiNCC = "" + dgvHienThi.Rows[vitri].Cells[2].Value.ToString();
                 tra.Ngaytra = DateTime.Parse(dgvHienThi.Rows[vitri].Cells[3].Value.ToString());
                 tra.MaNCC = dgvHienThi.Rows[vitri].Cells[4].Value.ToString();
                 tra.NoHienThoi = dgvHienThi.Rows[vitri].Cells[5].Value.ToString();
                 tra.NguoiNhanHang = "" + dgvHienThi.Rows[vitri].Cells[6].Value.ToString();
                 tra.HinhThucThanhToan = "" + dgvHienThi.Rows[vitri].Cells[7].Value.ToString();
                 tra.MaHoaDonNhap = dgvHienThi.Rows[vitri].Cells[8].Value.ToString();
                 tra.MaKho = dgvHienThi.Rows[vitri].Cells[9].Value.ToString();
                 tra.MaTienTe = "" + dgvHienThi.Rows[vitri].Cells[10].Value.ToString();
                 tra.TienBoiThuong = dgvHienThi.Rows[vitri].Cells[11].Value.ToString();
                 tra.ThanhToanNgay = dgvHienThi.Rows[vitri].Cells[12].Value.ToString();
                 tra.ThueGTGT = dgvHienThi.Rows[vitri].Cells[13].Value.ToString();
                 tra.GhiChu = dgvHienThi.Rows[vitri].Cells[14].Value.ToString();
                 tra.Deleted = Boolean.Parse(dgvHienThi.Rows[vitri].Cells[15].Value.ToString());
             }
         }
         else
         { }
     }
     catch (Exception ex)
     { string s = ex.Message.ToString(); }
     return tra;
 }
示例#28
0
        /// <summary>
        /// select trả lại nhà cung cấp
        /// </summary>
        private void SelectTLNCC()
        {
            try
            {
                Entities.TraLaiNCC[] pt2 = new Entities.TraLaiNCC[tl.Length];
                int sotang = 0;
                for (int j = 0; j < tl.Length; j++)
                {
                    string month1 = tl[j].Ngaytra.Month.ToString();
                    string year1 = tl[j].Ngaytra.Year.ToString();
                    if (month == month1 & year == year1 && Convert.ToDouble(tl[j].ThanhToanNgay) != 0)
                    {
                        sl++;
                        pt2[sotang] = tl[j];
                        sotang++;
                    }
                }
                tl = new Entities.TraLaiNCC[sotang];
                if (sotang != 0)
                {

                    for (int j = 0; j < sotang; j++)
                    {
                        tl[j] = pt2[j];
                    }
                }
                else
                    tl = new Entities.TraLaiNCC[0];
            }
            catch { }
        }
 private void SearchData(RadioButton rdoMa, RadioButton rdoNgay, RadioButton rdoTatCa, DataGridView dgv, string giatritim)
 {
     try
     {
         if (search.Length > 0)
         {
             ArrayList list = new ArrayList();
             Entities.TraLaiNCC[] getData = null;
             if (rdoMa.Checked == true)
             {
                 if (giatritim != "")
                 {
                     for (int i = 0; i < search.Length; i++)
                     {
                         string layma = search[i].MaHDTraLaiNCC.ToLower();
                         if (layma.Length > 0)
                         {
                             int index = layma.IndexOf(giatritim);
                             if (index >= 0)
                             {
                                 list.Add(search[i]);
                             }
                         }
                         else
                         { continue; }
                     }
                     int n = list.Count;
                     if (n == 0) { getData = null; }
                     getData = new Entities.TraLaiNCC[n];
                     for (int i = 0; i < n; i++)
                     {
                         getData[i] = (Entities.TraLaiNCC)list[i];
                     }
                     dgv.DataSource = null;
                     dgv.DataSource = getData;
                 }
                 else
                 { CapNhat(dgv); }
             }
             if (rdoNgay.Checked == true)
             {
                 if (giatritim != "")
                 {
                     for (int i = 0; i < search.Length; i++)
                     {
                         string layma = search[i].Ngaytra.ToString().ToLower();
                         if (layma.Length > 0)
                         {
                             int index = layma.IndexOf(giatritim);
                             if (index >= 0)
                             {
                                 list.Add(search[i]);
                             }
                         }
                         else
                         { continue; }
                     }
                     int n = list.Count;
                     if (n == 0) { getData = null; }
                     getData = new Entities.TraLaiNCC[n];
                     for (int i = 0; i < n; i++)
                     {
                         getData[i] = (Entities.TraLaiNCC)list[i];
                     }
                     dgv.DataSource = null;
                     dgv.DataSource = getData;
                 }
                 else
                 { CapNhat(dgv); }
             }
             if (rdoTatca.Checked == true)
             {
                 dgv.DataSource = null;
                 dgv.DataSource = search;
             }
         }
         else
         { CapNhat(dgv); }
         fixDatagridview();
     }
     catch (Exception ex)
     {
         string s = ex.Message;
         CapNhat(dgv);
         fixDatagridview();
     }
 }
示例#30
0
 private Entities.TraLaiNCC ConfilickDataTraLaiNhaCungcap(string table, string values)
 {
     Entities.TraLaiNCC ddh = new Entities.TraLaiNCC();
     try
     {
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.TruyenGiaTri gitri = new Entities.TruyenGiaTri("Select", table, values);
         clientstrem = cl.SerializeObj(this.client, "CheckTraLaiNhaCungCap", gitri);
         ddh = (Entities.TraLaiNCC)cl.DeserializeHepper(clientstrem, ddh);
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         ddh = null;
     }
     return ddh;
 }
 private void CapNhat(DataGridView dgv)
 {
     try
     {
         Entities.TraLaiNCC[] lay = new Entities.TraLaiNCC[0];
         dgv.DataSource = lay;
     }
     catch (Exception ex)
     { string s = ex.Message; }
 }
示例#32
0
        private void XuLy_TraLaiNhaCungCap(string hanhdong)
        {
            try
            {
                Entities.TraLaiNCC xuly = new Entities.TraLaiNCC();
                Common.Utilities ck = new Common.Utilities();

                //Mrk Fix 3/2/2013
                string _makNgaydonhang = makNgaydonhang.Text;
                if (string.IsNullOrEmpty(_makNgaydonhang))
                {
                    MessageBox.Show("Vui lòng kiểm tra lại ngày! \r\nkhông được phép rỗng!");
                    return;
                }
                string[] temp = _makNgaydonhang.Split('/');
                DateTime temp_date1 = new DateTime(int.Parse(temp[2]), int.Parse(temp[1]), int.Parse(temp[0]));
                DateTime temp_date2 = DateServer.Date();
                if (temp_date1.Date >= temp_date2.Date)
                {
                    xuly.Ngaytra = temp_date1;
                    ///////////////////////////////////////////////////////

                    //string thoigian_1 = makNgaydonhang.Text;
                    //string thoigian_sosanh = DateServer.Date().ToString("dd/MM/yyyy");
                    //if (ck.SoSanhNgay('/', ">=", thoigian_1, thoigian_sosanh) == true && thoigian_1 != null)
                    //{
                    //xuly.Ngaytra = DateTime.Parse(new Common.Utilities().KiemTraDinhDangNgayThangNam("ThangNgayNam", thoigian_1, '/'));
                    //thoigian_1 = null;
                    xuly.Hanhdong = hanhdong;
                    xuly.TraLaiNCCID = NhaCungCapID;
                    xuly.MaHDTraLaiNCC = txtSodonhang.Text;
                    xuly.NoHienThoi = txtNohienthoi.Text;
                    xuly.MaNCC = txtMakhachhang.Text;
                    xuly.NguoiNhanHang = "" + txtNguoitra.Text;
                    xuly.HinhThucThanhToan = cbxHinhthucthanhtoan.SelectedItem.ToString();
                    xuly.MaHoaDonNhap = txtChungtugoc.Text;
                    xuly.MaKho = cbxKhoHang.SelectedValue.ToString();
                    xuly.MaTienTe = cbxTiente_Tygia.SelectedValue.ToString();
                    xuly.TienBoiThuong = txtTongtienthanhtoan.Text;
                    xuly.ThanhToanNgay = Double.Parse(0 + txtThanhtoanngay.Text).ToString();
                    xuly.ThueGTGT = 0 + txtGiatrigiatang.Text;
                    xuly.GhiChu = "" + txtDiengiai.Text;
                    xuly.Deleted = false;
                    xuly.Manhanvien = Common.Utilities.User.NhanVienID;
                    xuly.Tendangnhap = Common.Utilities.User.TenDangNhap;
                    if (dgvXemthongtin.RowCount > 0)
                    {
                        if (CheckDataNhaCungCap(xuly) == true)
                        {
                            cl = new Server_Client.Client();
                            this.client = cl.Connect(Luu.IP, Luu.Ports);
                            clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", xuly);
                            Entities.KhachHangTraLai[] tralai = new Entities.KhachHangTraLai[1];
                            int trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, tralai));
                            if (trave == 1)
                            {
                                if (CapNhatDuNoNhaCungCap() >= 1)
                                {
                                    LuuChiTietTraLaiNhaCungCap();
                                }
                                else
                                { MessageBox.Show("Chưa cập nhật dư nợ nhà cung cấp"); }
                            }
                            else
                            {
                                MessageBox.Show("Thất bại");
                            }
                        }
                    }
                    else
                    { MessageBox.Show("Không có hàng hóa trong đơn đặt hàng"); }
                }
                else
                { MessageBox.Show("Kiểm tra ngày"); }
            }
            catch (Exception ex)
            {
                string s = ex.Message.ToString();
                MessageBox.Show("Thông tin nhập không đúng");
            }
        }
 private Entities.TraLaiNCC getDatagridview()
 {
     Entities.TraLaiNCC tra = new Entities.TraLaiNCC();
     int x = dgvHienThi.RowCount;
     int y = dgvHienThi.ColumnCount;
     if (y <= -1 || x <= -1)
     { }
     else
     {
         int vitri = dgvHienThi.CurrentRow.Index;
         tra.MaHDTraLaiNCC = "" + dgvHienThi.Rows[vitri].Cells["MaHDTraLaiNCC"].Value.ToString().ToUpper();
         tra.Ngaytra = DateTime.Parse("" + dgvHienThi.Rows[vitri].Cells["Ngaytra"].Value.ToString());
         tra.MaNCC = "" + dgvHienThi.Rows[vitri].Cells["MaNCC"].Value.ToString().ToUpper();
         tra.NoHienThoi = dgvHienThi.Rows[vitri].Cells["NoHienThoi"].Value.ToString();
         tra.NguoiNhanHang = "" + dgvHienThi.Rows[vitri].Cells["NguoiNhanHang"].Value.ToString();
         tra.HinhThucThanhToan = "" + dgvHienThi.Rows[vitri].Cells["HinhThucThanhToan"].Value.ToString();
         tra.MaHoaDonNhap = "" + dgvHienThi.Rows[vitri].Cells["MaHoaDonNhap"].Value.ToString().ToUpper();
         tra.MaKho = dgvHienThi.Rows[vitri].Cells["MaKho"].Value.ToString();
         tra.MaTienTe = "" + dgvHienThi.Rows[vitri].Cells["MaTienTe"].Value.ToString().ToUpper();
         tra.TienBoiThuong = dgvHienThi.Rows[vitri].Cells["TienBoiThuong"].Value.ToString();
         tra.ThanhToanNgay = dgvHienThi.Rows[vitri].Cells["ThanhToanNgay"].Value.ToString();
         tra.ThueGTGT = dgvHienThi.Rows[vitri].Cells["ThueGTGT"].Value.ToString();
         tra.GhiChu = dgvHienThi.Rows[vitri].Cells["GhiChu"].Value.ToString();
     }
     return tra;
 }
 public void LayTraLaiNCC()
 {
     try
     {
         List<Entities.TraLaiNCC> listTemp = new List<Entities.TraLaiNCC>();
         cl = new Server_Client.Client();
         this.client = cl.Connect(Luu.IP, Luu.Ports);
         Entities.TraLaiNCC ctxh = new Entities.TraLaiNCC("Select");
         clientstrem = cl.SerializeObj(this.client, "TLNCC", ctxh);
         Entities.TraLaiNCC[] TraLaiNCC1 = new Entities.TraLaiNCC[0];
         TraLaiNCC1 = (Entities.TraLaiNCC[])cl.DeserializeHepper1(clientstrem, TraLaiNCC1);
         if (TraLaiNCC1 == null)
         {
             TraLaiNCC = new Entities.TraLaiNCC[0];
             return;
         }
         //
         for (int i = 0; i < TraLaiNCC1.Length; i++)
         {
             DateTime ngaylap = TraLaiNCC1[i].Ngaytra;
             if (ngaylap >= BatDau && ngaylap <= KetThuc)
             {
                 listTemp.Add(TraLaiNCC1[i]);
             }
         }
         //
         TraLaiNCC = listTemp.ToArray();
     }
     catch
     {
     }
 }
示例#35
0
 public Entities.TraLaiNCC[] TraLaiNCC()
 {
     Entities.TraLaiNCC[] select = (Entities.TraLaiNCC[])new BizLogic.CongNo().SelectTLNCC();
     if (select == null)
         select = new Entities.TraLaiNCC[0];
     return select;
 }
 /// <summary>
 /// hungvv ========================================them moi hoac sua===============
 /// </summary>
 private void XuLy_TraLaiNhaCungCap(string hanhdong)
 {
     try
     {
         Entities.TraLaiNCC xuly = new Entities.TraLaiNCC();
         string thoigian_1 = null;
         thoigian_1 = new Common.Utilities().MyDateConversion(makNgaydonhang.Text);
         if (thoigian_1 != null)
         {
             xuly.Ngaytra = DateTime.Parse(thoigian_1);
             thoigian_1 = null;
             xuly.Hanhdong = hanhdong;
             xuly.MaHDTraLaiNCC = txtSodonhang.Text.ToUpper();
             xuly.MaNCC = txtMakhachhang.Text.ToUpper();
             xuly.NoHienThoi = 0 + txtNohienthoi.Text;
             xuly.NguoiNhanHang = "" + txtNguoitra.Text;
             xuly.HinhThucThanhToan = cbxHinhthucthanhtoan.SelectedItem.ToString();
             xuly.MaHoaDonNhap = txtChungtugoc.Text.ToUpper();
             xuly.MaKho = cbxKhoHang.SelectedValue.ToString().ToUpper();
             xuly.MaTienTe = cbxTiente_Tygia.SelectedValue.ToString().ToUpper();
             xuly.TienBoiThuong = 0 + txtTienboithuong.Text;
             xuly.ThanhToanNgay = 0 + txtThanhtoanngay.Text;
             xuly.ThueGTGT = 0 + txtGiatrigiatang.Text;
             xuly.GhiChu = "" + txtDiengiai.Text;
             xuly.Deleted = false;
             if (dgvXemthongtin.RowCount > 0)
             {
                 if (CheckData(xuly) == true)
                 {
                     CheckInsertTLNCC();
                     if (kt == true)
                     {
                         cl = new Server_Client.Client();
                         this.client = cl.Connect(Luu.IP, Luu.Ports);
                         clientstrem = cl.SerializeObj(this.client, "TraLaiNhaCungCap", xuly);
                         Entities.KhachHangTraLai[] tralai = new Entities.KhachHangTraLai[1];
                         int trave = System.Convert.ToInt32(cl.DeserializeHepper(clientstrem, tralai));
                         if (trave == 1)
                         {
                             LuuChiTietTraLaiNhaCungCap();
                             CheckDataGridTruSL(dgvXemthongtin);
                             MessageBox.Show("Thành công");
                         }
                         else
                         {
                             MessageBox.Show("Thất bại");
                         }
                     }
                 }
             }
             else
             { MessageBox.Show("Không có hàng hóa trong đơn đặt hàng"); }
         }
         else
         { MessageBox.Show("Kiểm tra ngày"); }
     }
     catch (Exception ex)
     {
         string s = ex.Message.ToString();
         MessageBox.Show("Thông tin nhập không đúng");
     }
 }