Beispiel #1
0
        public DataTable DocDuLieuChuyenHoan()
        {
            daCauHinh dCH = new daCauHinh();

            dCH.Lay((int)daCauHinh.eCauHinh.Mã_Bưu_Cục);
            if (dCH.CauHinh != null)
            {
                MaBuuCuc = dCH.CauHinh.GiaTri;
            }

            daBuuGui dBG = new daBuuGui();

            dBG.SoHieuBuuCuc = MaBuuCuc;
            dBG.Ngay         = Ngay;
            dBG.TuNgay       = Ngay;
            dBG.DenNgay      = Ngay;

            dCH.Lay((int)daCauHinh.eCauHinh.Đường_Dẫn_BCCP);
            if (dCH.CauHinh != null)
            {
                dBG.FileConfigBCCP = dCH.CauHinh.GiaTri;
            }

            return(dBG.DanhSachBuuGui_ChuyenHoan());
        }
        public void DocVaGhiDuLieu()
        {
            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 + "\\TRANSACTION";

            List <string> dsThuMuc;
            daThuMuc      dTM = new daThuMuc();

            dsThuMuc = dTM.TimThuMucCoDuLieu(rTenFile);

            DateTime _NgayPhatHanh = DateTime.Now;
            string   _rTenFileDL   = "";

            for (int i = 0; i < dsThuMuc.Count; i++)
            {
                _rTenFileDL = rTenFile + "\\" + dsThuMuc[i] + "\\" + _NgayPhatHanh.ToString("yyyyMMdd") + ".log";
                if (KiemTraCoTonTaiFile(_rTenFileDL))
                {
                    DocGhi(_rTenFileDL, _NgayPhatHanh);
                }
            }
        }
Beispiel #3
0
        public DataTable DocDuLieuPhanBuuTa()
        {
            daCauHinh dCH = new daCauHinh();

            dCH.Lay((int)daCauHinh.eCauHinh.Mã_Bưu_Cục);
            if (dCH.CauHinh != null)
            {
                MaBuuCuc = dCH.CauHinh.GiaTri;
            }

            daBuuGui dBG = new daBuuGui();

            dBG.SoHieuBuuCuc = MaBuuCuc;
            dBG.Ngay         = Ngay;

            dCH.Lay((int)daCauHinh.eCauHinh.Đường_Dẫn_BCCP);
            if (dCH.CauHinh != null)
            {
                dBG.FileConfigBCCP = dCH.CauHinh.GiaTri;
            }

            if (Ca == 1)
            {
                return(dBG.DanhSachBuuGui_COD_DongBuuTa_CaSang());
            }
            else
            {
                return(dBG.DanhSachBuuGui_COD_DongBuuTa_CaChieu());
            }
        }
        public void DocDuLieuPhatHanh()
        {
            daCauHinh dCH = new daCauHinh();

            dCH.Lay((int)daCauHinh.eCauHinh.Mã_Bưu_Cục);
            if (dCH.CauHinh != null)
            {
                MaBuuCuc = dCH.CauHinh.GiaTri;
            }

            daBuuGui dBG = new daBuuGui();

            dBG.SoHieuBuuCuc = MaBuuCuc;
            dBG.Ngay         = NgayPhatHanh;

            dCH.Lay((int)daCauHinh.eCauHinh.Đường_Dẫn_BCCP);
            if (dCH.CauHinh != null)
            {
                dBG.FileConfigBCCP = dCH.CauHinh.GiaTri;
            }

            BangDuLieu = dBG.DanhSachBuuGui();

            dCH.CauHinh.GiaTri = dBG.ChuoiKetNoiChay;
            dCH.CauHinh.ID     = (int)daCauHinh.eCauHinh._Chuỗi_Kết_nối_Chạy;
            dCH.CauHinh.Ma     = "ChuoiKetNoiBCCP";
            dCH.Them();
        }
Beispiel #5
0
        public void DocVaThem()
        {
            //Doc trong bccp
            daCauHinh     dCH  = new daCauHinh();
            daLayBangCuoc dLay = new daLayBangCuoc();

            dCH.Lay((int)daCauHinh.eCauHinh.Đường_Dẫn_BCCP);
            if (dCH.CauHinh != null)
            {
                dLay.FileConfigBCCP = dCH.CauHinh.GiaTri;
            }

            DataTable dt;

            dt = dLay.LayDSdichVu();
            //==============

            if (dt.Rows.Count > 0)
            {
                using (var db = new LiteDatabase(dCli.TenFileDichVu))
                {
                    var col = db.GetCollection <clsDichVu>(dCli.BangDichVu);
                    col.Delete(x => x.MaNhom == "BCCP");
                    int _ID;
                    try
                    {
                        _ID = col.Max();
                    }
                    catch
                    {
                        _ID = 0;
                    }
                    _ID = _ID + 1;

                    clsDichVu pDV;
                    DataRow   dr;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        dr         = dt.Rows[i];
                        pDV        = new clsDichVu();
                        pDV.Ma     = dr["ServiceCode"] == DBNull.Value ? "" : dr["ServiceCode"].ToString();
                        pDV.Ten    = dr["ServiceName"] == DBNull.Value ? "" : dr["ServiceName"].ToString();
                        pDV.MaNhom = dr["ServiceTypeCode"] == DBNull.Value ? "" : dr["ServiceTypeCode"].ToString();
                        pDV.STTsx  = i;
                        pDV.ID     = _ID + i;

                        col.Insert(pDV);
                    }
                    col.EnsureIndex(x => x.ID);
                    db.Shrink();
                }
            }
        }
Beispiel #6
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);
            }
        }
        public void DocVaGhiDuLieu(DateTime rTuNgay, DateTime rDenNgay)
        {
            daDuLieuPayPost dDLPP = new daDuLieuPayPost();

            dDLPP.XoaTatCa();

            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 + "\\TRANSACTION";

            List <string> dsThuMuc;
            daThuMuc      dTM = new daThuMuc();

            dsThuMuc = dTM.TimThuMucCoDuLieu(rTenFile);

            DateTime _NgayPhatHanh;// = DateTime.Now;
            string   _rTenFileDL = "";
            int      i;

            _NgayPhatHanh = rTuNgay;
            while (_NgayPhatHanh <= rDenNgay)
            {
                for (i = 0; i < dsThuMuc.Count; i++)
                {
                    _rTenFileDL = rTenFile + "\\" + dsThuMuc[i] + "\\" + _NgayPhatHanh.ToString("yyyyMMdd") + ".log";
                    if (KiemTraCoTonTaiFile(_rTenFileDL))
                    {
                        DocGhi(_rTenFileDL, _NgayPhatHanh);
                    }
                }
                _NgayPhatHanh = _NgayPhatHanh.AddDays(1);
            }
        }
        public void DocVaGhiDuLieu_LuuGiu()
        {
            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 + "\\TRANSACTION";

            dCH.Lay(dCH.TimMaThamSo((int)daCauHinh.eCauHinh.Tên_Đăng_nhập_Paypost));
            if (dCH.CauHinh != null)
            {
                rTenFile = rTenFile + "\\" + dCH.CauHinh.GiaTri;
            }

            DateTime _NgayPhatHanh = DateTime.Now;

            rTenFile = rTenFile + "\\" + _NgayPhatHanh.ToString("yyyyMMdd") + ".log";

            if (KiemTraCoTonTaiFile(rTenFile))
            {
                Transactions transactions = null;
                try
                {
                    transactions = ObjectXMLSerializer <Transactions> .Load(rTenFile, SerializedFormat.Binary);
                }
                catch
                {
                    transactions             = new Transactions();
                    transactions.Transaction = new PAYPOST.LOG.Transaction[0];
                }
                Transaction[] array = new Transaction[transactions.Transaction.Length];
                transactions.Transaction.CopyTo(array, 0);

                daDuLieuPayPost dDLPP = new daDuLieuPayPost();
                clsDuLieuPP     ptPP  = new clsDuLieuPP();
                Transaction     dlDoc;
                for (int i = 0; i < array.Length; i++)
                {
                    dlDoc = array[i];
                    ptPP  = dDLPP.Tim(dlDoc.TranID);
                    if (ptPP != null)
                    {
                        if (ptPP.TranTime != dlDoc.TranTime)
                        {
                            ptPP.DaTruyen = false;
                            dDLPP.Them(ptPP);
                        }
                    }
                    else
                    {
                        ptPP = new clsDuLieuPP();
                        ptPP.NgayPhatHanh    = _NgayPhatHanh;
                        ptPP.TranTime        = dlDoc.TranTime;
                        ptPP.TranCat         = dlDoc.TranCat;
                        ptPP.InvokedFrom     = dlDoc.InvokedFrom;
                        ptPP.TranID          = dlDoc.TranID;
                        ptPP.PAC             = dlDoc.PAC;
                        ptPP.AccountID       = dlDoc.AccountID;
                        ptPP.TranAmount      = dlDoc.TranAmount;
                        ptPP.SenderName      = dlDoc.SenderName;
                        ptPP.AddInfo1        = dlDoc.AddInfo1;
                        ptPP.AddInfo2        = dlDoc.AddInfo2;
                        ptPP.AddInfo3        = dlDoc.AddInfo3;
                        ptPP.AddInfo4        = dlDoc.AddInfo4;
                        ptPP.AddInfo5        = dlDoc.AddInfo5;
                        ptPP.AddInfo6        = dlDoc.AddInfo6;
                        ptPP.AddInfo7        = dlDoc.AddInfo7;
                        ptPP.AddInfo8        = dlDoc.AddInfo8;
                        ptPP.Fee             = dlDoc.Fee;
                        ptPP.Add_Info_Fee_01 = dlDoc.Add_Info_Fee_01;
                        ptPP.Add_Info_Fee_02 = dlDoc.Add_Info_Fee_02;
                        ptPP.Add_Info_Fee_03 = dlDoc.Add_Info_Fee_03;
                        ptPP.Add_Info_Fee_04 = dlDoc.Add_Info_Fee_04;
                        ptPP.Add_Info_Fee_05 = dlDoc.Add_Info_Fee_05;

                        dDLPP.Them(ptPP);
                    }

                    Ghi(ptPP, null);
                }
            }
        }