protected override List <YCTPaymentRecord> GetingItems(ParkDataContext parking, SearchCondition search)
        {
            IQueryable <YCTPaymentRecord> result = parking.GetTable <YCTPaymentRecord>();

            if (search is YCTPaymentRecordSearchCondition)
            {
                YCTPaymentRecordSearchCondition con = search as YCTPaymentRecordSearchCondition;
                if (con.PaymentDateTimeRange != null)
                {
                    result = result.Where(item => item.TIM >= con.PaymentDateTimeRange.Begin && item.TIM <= con.PaymentDateTimeRange.End);
                }
                if (!string.IsNullOrEmpty(con.PID))
                {
                    result = result.Where(item => item.PID == con.PID);
                }
                if (con.PSN.HasValue)
                {
                    result = result.Where(item => item.PSN == con.PSN.Value);
                }
                if (con.TIM.HasValue)
                {
                    result = result.Where(item => item.TIM == con.TIM.Value);
                }
                if (!string.IsNullOrEmpty(con.LCN))
                {
                    result = result.Where(item => item.LCN == con.LCN);
                }
                if (con.WalletType.HasValue)
                {
                    result = result.Where(item => item.WalletType == con.WalletType.Value);
                }
                if (con.State.HasValue)
                {
                    result = result.Where(item => (int)item.State == con.State.Value);
                }
                if (!string.IsNullOrEmpty(con.UploadFile))
                {
                    result = result.Where(item => item.UploadFile == con.UploadFile);
                }
                if (con.UnUploaded)
                {
                    result = result.Where(item => item.UploadFile == null);
                }
                return(result.ToList());
            }
            return(new List <YCTPaymentRecord>());
        }
예제 #2
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            YCTPaymentRecordSearchCondition con = new YCTPaymentRecordSearchCondition();

            con.PaymentDateTimeRange = new DateTimeRange(UCChargeDateTime.StartDateTime, UCChargeDateTime.EndDateTime);
            con.LCN = txtCardID.Text;
            if (!string.IsNullOrEmpty(cmbWalletType.Text))
            {
                con.WalletType = cmbWalletType.SelectedIndex;
            }
            if (!string.IsNullOrEmpty(cmbState.Text))
            {
                if (cmbState.Text == "支付成功")
                {
                    con.State = (int)YCTPaymentRecordState.PaidOk;
                }
                else if (cmbState.Text == "服务器已接收")
                {
                    con.State = (int)YCTPaymentRecordState.ServiceAccepted;
                }
                else if (cmbState.Text == "服务器拒绝")
                {
                    con.State = (int)YCTPaymentRecordState.ServiceDenied;
                }
                else if (cmbState.Text == "支付失败")
                {
                    con.State = (int)YCTPaymentRecordState.PaidFail;
                }
            }
            if (chkUnupload.Checked)
            {
                con.UnUploaded = true;
            }
            List <YCTPaymentRecord> records = new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect).GetItems(con).QueryObjects;

            if (records != null && records.Count > 0)
            {
                foreach (var record in records)
                {
                    int row = dataGridView1.Rows.Add();
                    ShowItemOnRow(dataGridView1.Rows[row], record);
                }
            }
            lblMsg.Text = string.Format("共有 {0} 项", records != null ? records.Count : 0);
        }
예제 #3
0
        //add by Jan 2016-04-27 新增未完整交易记录处理
        #region 未完整交易记录处理
        /// <summary>
        /// 获取最近一次未完成的交易记录
        /// </summary>
        /// <param name="card">羊城通卡</param>
        /// <returns></returns>
        private YCTPaymentRecord GetUnFinishedPayment(CardInfo card)
        {
            //已入场的才查询是否有未完成的交易
            if (card.IsInPark)
            {
                YCTPaymentRecordSearchCondition con = new YCTPaymentRecordSearchCondition();
                con.LCN                  = card.CardID;
                con.EnterDateTime        = card.LastDateTime;
                con.OrderByTIMDescending = true;
                con.State                = (int)YCTPaymentRecordState.PaidFail;

                List <YCTPaymentRecord> records = (new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect)).GetItems(con).QueryObjects;
                if (records != null && records.Count > 0)
                {
                    return(records[0]);
                }
            }

            return(null);
        }
예제 #4
0
        private void SyncUploadFiles(FtpClient ftp, YCTSetting yct)
        {
            //DateTime dt = DateTime.Now;
            DateTime dt     = DateTime.Today.AddMilliseconds(-1);
            string   m1Zip  = string.Format("XF{0}{1}{2}.ZIP", yct.ServiceCode.ToString().PadLeft(4, '0'), yct.ReaderCode.ToString().PadLeft(4, '0'), dt.ToString("yyyyMMdd"));
            string   cpuZip = string.Format("CX{0}{1}{2}.ZIP", yct.ServiceCode.ToString().PadLeft(4, '0'), yct.ReaderCode.ToString().PadLeft(4, '0'), dt.ToString("yyyyMMddHH"));

            InsertMsg("定位到: " + _WriteFolder);
            ftp.SetWorkingDirectory(_WriteFolder);
            var items = ftp.GetListing(_WriteFolder, FtpListOption.NoPath);

            if (items == null && items.Length == 0 || items.Count(it => it.Name == m1Zip) == 0)
            {
                YCTPaymentRecordSearchCondition con = new YCTPaymentRecordSearchCondition() //获取所有钱包类型为M1钱包且未上传的记录
                {
                    WalletType           = 1,
                    State                = (int)YCTPaymentRecordState.PaidOk,
                    UnUploaded           = true,
                    PaymentDateTimeRange = new DateTimeRange(new DateTime(2010, 1, 1), dt)
                };
                List <YCTPaymentRecord> records = new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect).GetItems(con).QueryObjects;
                if (records != null && records.Count > 0)
                {
                    YCTBlacklistSearchCondition ycon = new YCTBlacklistSearchCondition();
                    ycon.WalletType     = 1; //M
                    ycon.OnlyCatched    = true;
                    ycon.OnlyUnUploaded = true;
                    List <YCTBlacklist> blacks = new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect).GetItems(ycon).QueryObjects;
                    string zip = YCTUploadFileFactory.CreateM1UploadFile(dt, m1Zip, records, blacks);
                    if (!string.IsNullOrEmpty(zip))
                    {
                        InsertMsg("上传文件" + m1Zip);
                        using (FileStream fs = new FileStream(zip, FileMode.Open, FileAccess.Read))
                        {
                            ftp.Upload(m1Zip, fs);
                            new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect).BatchChangeUploadFile(records, m1Zip);
                            if (blacks != null && blacks.Count > 0)
                            {
                                new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect).BatchChangeUploadFile(blacks, m1Zip);
                            }
                        }
                    }
                }
            }

            if (items == null && items.Length == 0 || items.Count(it => it.Name == cpuZip) == 0)
            {
                YCTPaymentRecordSearchCondition con = new YCTPaymentRecordSearchCondition() //获取所有钱包类型为CPU钱包且未上传的记录
                {
                    WalletType           = 2,
                    State                = (int)YCTPaymentRecordState.PaidOk,
                    UnUploaded           = true,
                    PaymentDateTimeRange = new DateTimeRange(new DateTime(2010, 1, 1), dt)
                };
                List <YCTPaymentRecord> records = new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect).GetItems(con).QueryObjects;
                if (records != null && records.Count > 0)
                {
                    YCTBlacklistSearchCondition ycon = new YCTBlacklistSearchCondition();
                    ycon.WalletType     = 2; //cpu
                    ycon.OnlyCatched    = true;
                    ycon.OnlyUnUploaded = true;
                    List <YCTBlacklist> blacks = new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect).GetItems(ycon).QueryObjects;
                    string zip = YCTUploadFileFactory.CreateCPUUploadFile(dt, cpuZip, records, blacks);
                    if (!string.IsNullOrEmpty(zip))
                    {
                        InsertMsg("上传文件" + cpuZip);
                        using (FileStream fs = new FileStream(zip, FileMode.Open, FileAccess.Read))
                        {
                            ftp.Upload(cpuZip, fs);
                            new YCTPaymentRecordBll(AppSettings.CurrentSetting.MasterParkConnect).BatchChangeUploadFile(records, cpuZip);
                            if (blacks != null && blacks.Count > 0)
                            {
                                new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect).BatchChangeUploadFile(blacks, cpuZip);
                            }
                        }
                    }
                }
            }
        }