Beispiel #1
0
        public void Them(clsDuLieuPP ptDLPP)
        {
            daClient dC = new daClient();

            dC.Tao();

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                if (ptDLPP.ID == 0)
                {
                    try
                    {
                        ptDLPP.ID = col.Max() + 1;
                    }
                    catch
                    {
                        ptDLPP.ID = 1;
                    }
                    ptDLPP.DaTruyen = false;
                    col.Insert(ptDLPP);
                    col.EnsureIndex(x => x.ID);
                }
                else
                {
                    col.Update(ptDLPP.ID, ptDLPP);
                }
            }
        }
        public void Them(clsLan ptLan)
        {
            daClient dC = new daClient();

            dC.Tao();

            using (var db = new LiteDatabase(dC.TenFileLogLay))
            {
                var col = db.GetCollection <clsLan>(dC.BangLanLay);
                if (ptLan.ID == 0)
                {
                    try
                    {
                        ptLan.ID = col.Max() + 1;
                    }
                    catch
                    {
                        ptLan.ID = 1;
                    }
                    col.Insert(ptLan);
                    col.EnsureIndex(x => x.ID);
                }
                else
                {
                    col.Update(ptLan.ID, ptLan);
                }
            }
        }
Beispiel #3
0
        public List <bCauHinh> Doc()
        {
            daClient dC = new daClient();

            dC.Tao();
            var db  = new LiteDatabase(dC.TenFileNVPP);
            var col = db.GetCollection <bCauHinh>(dC.BangDanhMuc);

            return(col.FindAll().OrderBy(x => x.Ma).ToList());
        }
Beispiel #4
0
        public void XoaTatCa()
        {
            daClient dC = new daClient();

            dC.Tao();

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                col.Delete(x => x.DaTruyen == true);
                db.Shrink();
            }
        }
Beispiel #5
0
        public void Xoa(DateTime rNgay)
        {
            daClient dC = new daClient();

            dC.Tao();

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                col.Delete(x => x.NgayPhatHanh.Value <= daTienIch.CuoiNgay(rNgay) && x.DaTruyen == true);
                db.Shrink();
            }
        }
Beispiel #6
0
        public List <clsDuLieuPP> LayDanhSachChuaTruyen()
        {
            daClient dC = new daClient();

            dC.Tao();
            List <clsDuLieuPP> lstPP = new List <clsDuLieuPP>();

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                lstPP = col.Find(x => x.DaTruyen == false).ToList();
            }

            return(lstPP);
        }
Beispiel #7
0
        public clsDuLieuPP Tim(string rTranID)
        {
            daClient dC = new daClient();

            dC.Tao();
            clsDuLieuPP _kqtim = new clsDuLieuPP();

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                _kqtim = col.FindOne(x => x.TranID == rTranID);
            }

            return(_kqtim);
        }
Beispiel #8
0
        public void LayDanhMuc()
        {
            string    rTenFile = "";
            daCauHinh dCH      = new daCauHinh();

            dCH.Lay(dCH.TimMaThamSo((int)daCauHinh.eCauHinh.Đường_Dẫn_Paypost));
            if (dCH.CauHinh != null)
            {
                rTenFile = dCH.CauHinh.GiaTri;
            }

            rTenFile = rTenFile + "\\PAYPOST DICTIONARY\\PROVIDER_ACNT.DIC";

            object[]   obj;
            IFormatter formatter = new BinaryFormatter();

            if (File.Exists(rTenFile))
            {
                Stream stream = new FileStream(rTenFile, System.IO.FileMode.Open, FileAccess.Read, FileShare.None);
                obj = (object[])formatter.Deserialize(stream);
                stream.Close();

                daClient dC = new daClient();
                dC.Tao();
                var      db  = new LiteDatabase(dC.TenFileNVPP);
                var      col = db.GetCollection <bCauHinh>(dC.BangDanhMuc);
                bCauHinh pt;
                string[] str;
                int      n = 0;
                for (int i = 0; i < obj.Length; i++)
                {
                    str = obj[i].ToString().Split(';');
                    if (str[2] != "6")
                    {
                        pt        = new bCauHinh();
                        n         = n + 1;
                        pt.ID     = n;
                        pt.Ma     = str[3].Trim();
                        pt.GiaTri = str[4].Trim();
                        col.Insert(pt);
                    }
                }
                col.EnsureIndex(x => x.ID);
            }
        }
Beispiel #9
0
        public DataTable BaoCao(DateTime rNgay)
        {
            //Dich vu
            List <bCauHinh> lstDV = new List <bCauHinh>();
            daDanhMucNVPP   dDM   = new daDanhMucNVPP();

            lstDV = dDM.Doc();
            //===========

            daClient dC = new daClient();

            dC.Tao();
            List <clsDuLieuPP> lstPPThu = new List <clsDuLieuPP>();
            List <clsDuLieuPP> lstPPChi = new List <clsDuLieuPP>();
            List <clsBaoCaoPP> lst      = new List <clsBaoCaoPP>();
            clsBaoCaoPP        bc;

            using (var db = new LiteDatabase(dC.TenFileDuLieuPP))
            {
                var col = db.GetCollection <clsDuLieuPP>(dC.BangDuLieuPP);
                foreach (bCauHinh dm in lstDV)
                {
                    lstPPThu = col.Find(x => x.NgayPhatHanh.Value.ToShortDateString() == rNgay.ToShortDateString() && x.PAC.Trim() == dm.Ma && (x.InvokedFrom == "THU" || x.InvokedFrom == "NORMAL")).ToList();
                    lstPPChi = col.Find(x => x.NgayPhatHanh.Value.ToShortDateString() == rNgay.ToShortDateString() && x.PAC.Trim() == dm.Ma && x.InvokedFrom == "CHI").ToList();
                    bc       = new clsBaoCaoPP();
                    bc.Ma    = dm.Ma;
                    bc.Ten   = dm.GiaTri;
                    bc.Thu   = lstPPThu.Sum(t => t.TranAmount.Value);
                    bc.Chi   = lstPPChi.Sum(c => c.TranAmount.Value);
                    if (bc.Thu != 0 || bc.Chi != 0)
                    {
                        lst.Add(bc);
                    }
                }
            }

            return(daTienIch.ToDataTable(lst));
        }
Beispiel #10
0
 public daDichVu()
 {
     dCli.Tao();
 }
Beispiel #11
0
 public daDuLieuBCCP()
 {
     dCli.Tao();
 }