示例#1
0
 public Entities.NhaCungCap[] NhaCungCap()
 {
     Entities.NhaCungCap[] ncc1 = new BizLogic.NhaCungCap().Select();
     if (ncc1 == null)
     {
         ncc1 = new Entities.NhaCungCap[0];
     }
     return(ncc1);
 }
示例#2
0
 /// <summary>
 /// Nhà Cung Cấp
 /// </summary>
 /// <param name="clientStream"></param>
 public void XuLy_NhaCungCap(NetworkStream clientStream)
 {
     Entities.NhaCungCap ncc = (Entities.NhaCungCap)formatter.Deserialize(clientStream);
     switch (ncc.HanhDong)
     {
         case "Insert":
             {
                 int msg = new BizLogic.NhaCungCap().InsertUpdate(ncc);
                 if (msg == 1)
                 {
                     new BizLogic.LogFile().GhiFile(new Entities.LogFile(ncc.MaNhanVien, ncc.TenDangNhap, ncc.HanhDong, DateTime.Now.ToString(), "Thêm nhà cung cấp: " + ncc.MaNhaCungCap));
                 }
                 formatter.Serialize(clientStream, msg);
                 break;
             }
         case "Update":
             {
                 int msg = new BizLogic.NhaCungCap().InsertUpdate(ncc);
                 if (msg == 1)
                 {
                     new BizLogic.LogFile().GhiFile(new Entities.LogFile(ncc.MaNhanVien, ncc.TenDangNhap, ncc.HanhDong, DateTime.Now.ToString(), "Sửa nhà cung cấp: " + ncc.MaNhaCungCap));
                 }
                 formatter.Serialize(clientStream, msg);
                 break;
             }
         case "Delete":
             {
                 new BizLogic.NhaCungCap().Delete(ncc);
                 bool kt = true;
                 formatter.Serialize(clientStream, kt);
                 break;
             }
         case "Select":
             {
                 Entities.NhaCungCap[] ncc1 = new BizLogic.NhaCungCap().Select();
                 formatter.Serialize(clientStream, ncc1);
                 break;
             }
         case "Search":
             {
                 Entities.NhaCungCap[] ncc1 = new BizLogic.NhaCungCap().Select(ncc.Cot, ncc.Kieu, ncc.GiaTri);
                 formatter.Serialize(clientStream, ncc1);
                 break;
             }
         case "UpdateDuNo": // trừ
             {
                 bool kt = new BizLogic.NhaCungCap().UpdateDuNo(ncc);
                 formatter.Serialize(clientStream, kt);
                 break;
             }
         case "UpdateDuNoNCC": // cộng
             {
                 bool kt = new BizLogic.NhaCungCap().UpdateDuNoNCC(ncc);
                 formatter.Serialize(clientStream, kt);
                 break;
             }
         default:
             break;
     }
 }
        public Entities.TraLaiNCC[] Select()
        {
            Entities.TraLaiNCC[] arrC = null;
            try
            {
                Entities.NhaCungCap[] ncc = new BizLogic.NhaCungCap().Select();
                tlncc = new Constants.TraLaiNhaCungCap();
                Sql   = new Constants.Sql();
                string sql = "select * from  TraLaiNCC where Deleted = 0";
                conn = new Connection();
                cn   = conn.openConnection();
                cmd  = new SqlCommand(sql, cn);

                dr  = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    tralainhacungcap               = new Entities.TraLaiNCC();
                    tralainhacungcap.TraLaiNCCID   = Convert.ToInt32(dr[tlncc.TraLaiNCCID].ToString());
                    tralainhacungcap.MaHDTraLaiNCC = dr[tlncc.MaHDTraLaiNCC].ToString();
                    tralainhacungcap.Ngaytra       = Convert.ToDateTime(dr[tlncc.Ngaytra].ToString());
                    tralainhacungcap.MaNCC         = dr[tlncc.MaNCC].ToString();
                    tralainhacungcap.TenNCC        = "";
                    foreach (Entities.NhaCungCap item in ncc)
                    {
                        if (item.MaNhaCungCap == tralainhacungcap.MaNCC)
                        {
                            tralainhacungcap.TenNCC = item.TenNhaCungCap;
                            break;
                        }
                    }

                    tralainhacungcap.NoHienThoi        = dr[tlncc.NoHienThoi].ToString();
                    tralainhacungcap.NguoiNhanHang     = dr[tlncc.NguoiNhanHang].ToString();
                    tralainhacungcap.HinhThucThanhToan = dr[tlncc.HinhThucThanhToan].ToString();
                    tralainhacungcap.MaHoaDonNhap      = dr[tlncc.MaHoaDonNhap].ToString();
                    tralainhacungcap.MaKho             = dr[tlncc.MaKho].ToString();
                    tralainhacungcap.MaTienTe          = dr[tlncc.MaTienTe].ToString();
                    tralainhacungcap.TienBoiThuong     = dr[tlncc.TienBoiThuong].ToString();
                    tralainhacungcap.ThanhToanNgay     = dr[tlncc.ThanhToanNgay].ToString();
                    tralainhacungcap.ThueGTGT          = dr[tlncc.ThueGTGT].ToString();
                    tralainhacungcap.GhiChu            = dr[tlncc.GhiChu].ToString();
                    tralainhacungcap.Deleted           = Convert.ToBoolean(dr[tlncc.Deleted].ToString());
                    arr.Add(tralainhacungcap);
                }
                int n = arr.Count;
                if (n == 0)
                {
                    return(null);
                }
                arrC = new Entities.TraLaiNCC[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.TraLaiNCC)arr[i];
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return(arrC);
        }
        public Entities.TraLaiNCC[] Select()
        {
            Entities.TraLaiNCC[] arrC = null;
            try
            {
                Entities.NhaCungCap[] ncc = new BizLogic.NhaCungCap().Select();
                tlncc = new Constants.TraLaiNhaCungCap();
                Sql = new Constants.Sql();
                string sql = "select * from  TraLaiNCC where Deleted = 0";
                conn = new Connection();
                cn = conn.openConnection();
                cmd = new SqlCommand(sql, cn);

                dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                arr = new ArrayList();
                while (dr.Read())
                {
                    tralainhacungcap = new Entities.TraLaiNCC();
                    tralainhacungcap.TraLaiNCCID = Convert.ToInt32(dr[tlncc.TraLaiNCCID].ToString());
                    tralainhacungcap.MaHDTraLaiNCC = dr[tlncc.MaHDTraLaiNCC].ToString();
                    tralainhacungcap.Ngaytra = Convert.ToDateTime(dr[tlncc.Ngaytra].ToString());
                    tralainhacungcap.MaNCC = dr[tlncc.MaNCC].ToString();
                    tralainhacungcap.TenNCC ="";
                    foreach (Entities.NhaCungCap item in ncc)
                    {
                        if (item.MaNhaCungCap == tralainhacungcap.MaNCC)
                        {
                            tralainhacungcap.TenNCC = item.TenNhaCungCap;
                            break;
                        }
                    }

                    tralainhacungcap.NoHienThoi = dr[tlncc.NoHienThoi].ToString();
                    tralainhacungcap.NguoiNhanHang = dr[tlncc.NguoiNhanHang].ToString();
                    tralainhacungcap.HinhThucThanhToan = dr[tlncc.HinhThucThanhToan].ToString();
                    tralainhacungcap.MaHoaDonNhap = dr[tlncc.MaHoaDonNhap].ToString();
                    tralainhacungcap.MaKho = dr[tlncc.MaKho].ToString();
                    tralainhacungcap.MaTienTe = dr[tlncc.MaTienTe].ToString();
                    tralainhacungcap.TienBoiThuong = dr[tlncc.TienBoiThuong].ToString();
                    tralainhacungcap.ThanhToanNgay = dr[tlncc.ThanhToanNgay].ToString();
                    tralainhacungcap.ThueGTGT = dr[tlncc.ThueGTGT].ToString();
                    tralainhacungcap.GhiChu = dr[tlncc.GhiChu].ToString();
                    tralainhacungcap.Deleted = Convert.ToBoolean(dr[tlncc.Deleted].ToString());
                    arr.Add(tralainhacungcap);
                }
                int n = arr.Count;
                if (n == 0) { return null; }
                arrC = new Entities.TraLaiNCC[n];
                for (int i = 0; i < n; i++)
                {
                    arrC[i] = (Entities.TraLaiNCC)arr[i];
                }
            }
            catch (Exception ex)
            { string s = ex.Message.ToString(); }
            finally
            {
                cmd.Connection.Dispose();
                cn.Close();
                conn.closeConnection();
            }
            return arrC;
        }
示例#5
0
 public Entities.NhaCungCap[] NhaCungCap()
 {
     Entities.NhaCungCap[] ncc1 = new BizLogic.NhaCungCap().Select();
     if (ncc1 == null)
         ncc1 = new Entities.NhaCungCap[0];
     return ncc1;
 }