示例#1
0
 public void CapNhat(clsDuLieuBCCP ptBCCP)
 {
     using (var db = new LiteDatabase(dCli.TenFileDuLieuBCCP))
     {
         var col = db.GetCollection <clsDuLieuBCCP>(dCli.BangDuLieuBCCP);
         col.Update(ptBCCP.ID, ptBCCP);
     }
 }
示例#2
0
        private clsDuLieuBCCP Chuyen1Dong(DataRow dr, int i)
        {
            clsDuLieuBCCP ptBCCP = new clsDuLieuBCCP();

            ptBCCP.ID               = i;
            ptBCCP.DaTruyen         = false;
            ptBCCP.MaBuuCuc         = MaBuuCuc;
            ptBCCP.NgayPhatHanh     = NgayPhatHanh;
            ptBCCP.SoHieu           = dr["SoHieu"].ToString();
            ptBCCP.MaDichVu         = dr["MaDichVu"] == DBNull.Value ? "" : dr["MaDichVu"].ToString();
            ptBCCP.TenDichVu        = dr["TenDichVu"] == DBNull.Value ? "" : dr["TenDichVu"].ToString();
            ptBCCP.MaBuuCucChapNhan = dr["MaBCChapNhan"] == DBNull.Value ? "" : dr["MaBCChapNhan"].ToString();
            try
            {
                ptBCCP.NgayGioChapNhan = DateTime.Parse(dr["NgayGioNhan"].ToString());
            }
            catch
            {
                ptBCCP.NgayGioChapNhan = NgayPhatHanh;
            }
            ptBCCP.LoaiBuuGui   = dr["LoaiBuuGui"] == DBNull.Value ? "" : dr["LoaiBuuGui"].ToString();
            ptBCCP.MaBuuCucDong = dr["BuuCucNhanCT"] == DBNull.Value ? "" : dr["BuuCucNhanCT"].ToString();

            ptBCCP.SoChuyen         = Convert.ToInt32(dr["SoChuyen"]);
            ptBCCP.SoTui            = Convert.ToInt32(dr["SoTui"]);
            ptBCCP.MaDuongThu       = dr["MaDuongThu"] == DBNull.Value ? "" : dr["MaDuongThu"].ToString();
            ptBCCP.TrongLuong       = dr["TrongLuong"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["TrongLuong"]);
            ptBCCP.TrongLuongQuiDoi = dr["TrongLuongQuiDoi"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["TrongLuongQuiDoi"]);
            ptBCCP.MaTinhPhat       = dr["MaTinhPhat"] == DBNull.Value ? "" : dr["MaTinhPhat"].ToString();
            ptBCCP.MaNuocPhat       = dr["MaNuocPhat"] == DBNull.Value ? "" : dr["MaNuocPhat"].ToString();
            ptBCCP.MaKhachHang      = dr["MaKhachHang"] == DBNull.Value ? "" : dr["MaKhachHang"].ToString();
            ptBCCP.TenKhachHang     = dr["TenKhachHang"] == DBNull.Value ? "" : dr["TenKhachHang"].ToString();
            ptBCCP.DiaChiKhachHang  = dr["DiaChiKhachHang"] == DBNull.Value ? "" : dr["DiaChiKhachHang"].ToString();
            ptBCCP.TenNguoiNhan     = dr["TenNguoiNhan"] == DBNull.Value ? "" : dr["TenNguoiNhan"].ToString();
            ptBCCP.DiaChiNguoiNhan  = dr["DiaChiNguoiNhan"] == DBNull.Value ? "" : dr["DiaChiNguoiNhan"].ToString();
            ptBCCP.CuocChinh        = dr["CuocChinh"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["CuocChinh"]);
            ptBCCP.PhuPhiXD         = dr["PhuPhiXD"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["PhuPhiXD"]);
            ptBCCP.PhuPhiVX         = dr["PhuPhiVX"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["PhuPhiVX"]);
            ptBCCP.CuocCongThem     = dr["CuocCongThem"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["CuocCongThem"]);
            ptBCCP.DichVuCongThem   = dr["DichVuCongThem"] == DBNull.Value ? "" : dr["DichVuCongThem"].ToString();
            ptBCCP.SoTienCOD        = dr["SoTienCOD"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["SoTienCOD"]);
            ptBCCP.CuocCOD          = dr["CuocCOD"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["CuocCOD"]);
            ptBCCP.CuocCODVAT       = dr["CuocCODVAT"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["CuocCODVAT"]);
            ptBCCP.GhiNo            = dr["No"] == DBNull.Value ? false : Convert.ToBoolean(dr["No"]);
            if (ptBCCP.CuocCongThem < 0)
            {
                ptBCCP.CuocCongThem = 0;
            }
            ptBCCP.TongCuoc = ptBCCP.CuocChinh + ptBCCP.PhuPhiVX + ptBCCP.PhuPhiXD + ptBCCP.CuocCongThem;

            ptBCCP.VAT           = dr["VAT"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["VAT"]);
            ptBCCP.ThanhTien     = dr["ThanhTien"] == DBNull.Value ? 0 : Convert.ToDecimal(dr["ThanhTien"]);
            ptBCCP.NoiDungBuuGui = dr["NoiDungBuuGui"] == DBNull.Value ? "" : Convert.ToString(dr["NoiDungBuuGui"]);
            ptBCCP.GuiLo         = dr["GuiLo"] == DBNull.Value ? false : Convert.ToBoolean(dr["GuiLo"]);
            ptBCCP.SoLo          = dr["SoLo"] == DBNull.Value ? "" : Convert.ToString(dr["SoLo"]);

            return(ptBCCP);
        }
示例#3
0
 public void Them(clsDuLieuBCCP ptBCCP)
 {
     using (var db = new LiteDatabase(dCli.TenFileDuLieuBCCP))
     {
         var col = db.GetCollection <clsDuLieuBCCP>(dCli.BangDuLieuBCCP);
         col.Insert(ptBCCP);
         col.EnsureIndex(x => x.ID);
     }
 }