Esempio n. 1
0
        private void HandleBlacklist(YCTItem item, YCTWallet w, YCTBlacklist black)
        {
            bool catched = item.Reader.CatchBlackList(); //捕捉黑名单

            if (catched && black.CatchAt == null)        //之前没有捕捉日期的才写数据库
            {
                black.WalletType = w.WalletType;
                black.CatchAt    = DateTime.Now;
                black.UploadFile = null;
                new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect).Update(black);
            }
            EntranceInfo      entrance = item.EntranceID.HasValue ? ParkBuffer.Current.GetEntrance(item.EntranceID.Value) : null;
            OpenCardEventArgs args     = new OpenCardEventArgs()
            {
                CardID    = w.LogicCardID,
                CardType  = w.WalletType == 0 ? string.Empty : YCTSetting.CardTyte,
                Entrance  = entrance,
                Balance   = (decimal)w.Balance / 100,
                LastError = "黑名单卡",
            };

            if (this.OnError != null)
            {
                this.OnError(this, args);
            }
        }
Esempio n. 2
0
 private void ExtraFile(string file)
 {
     if (Path.GetExtension(file).ToUpper() == ".ZIP")
     {
         string[] mds = ReadMD(file);
         if (mds != null && mds.Length > 0)
         {
             InsertMsg("解析黑名单...");
             YCTBlacklistBll     bll = new YCTBlacklistBll(AppSettings.CurrentSetting.MasterParkConnect);
             List <YCTBlacklist> bl  = bll.GetItems(null).QueryObjects;
             Dictionary <string, YCTBlacklist> blacks = new Dictionary <string, YCTBlacklist>();
             bl.ForEach(it => blacks.Add(it.LCN, it));
             List <YCTBlacklist> addings = new List <YCTBlacklist>();
             foreach (var md in mds)
             {
                 string[] temp = md.Split('\t');
                 if (temp.Length >= 3)
                 {
                     string lcn = temp[1].Length == 16 ? temp[1] : temp[0]; //CPU名单逻辑卡号在第二个位置, M1卡名单逻辑卡号在第一个位置
                     string fcn = temp[1].Length == 16 ? temp[0] : temp[1]; //物理卡号位置与逻辑卡号刚好相反
                     if (!blacks.ContainsKey(lcn))
                     {
                         YCTBlacklist yb = new YCTBlacklist();
                         yb.LCN         = lcn;
                         yb.FCN         = fcn;
                         yb.Reason      = temp[2];
                         yb.AddDateTime = DateTime.Now;
                         addings.Add(yb);
                     }
                 }
             }
             if (addings.Count > 0)
             {
                 int count = 0;
                 List <YCTBlacklist> temp = new List <YCTBlacklist>();
                 foreach (YCTBlacklist it in addings)
                 {
                     if (temp.Count < 1000)
                     {
                         temp.Add(it);
                         count++;
                     }
                     if (temp.Count == 1000)
                     {
                         bll.BatchInsert(temp);
                         temp.Clear();
                         InsertMsg(string.Format("导入黑名单完成 {0:P}", (decimal)count / addings.Count));
                     }
                 }
                 if (temp.Count > 0)
                 {
                     bll.BatchInsert(temp);
                     temp.Clear();
                 }
             }
             InsertMsg("完成黑名单解析");
         }
     }
 }
Esempio n. 3
0
        public CommandResult Update(YCTBlacklist newVal)
        {
            YCTBlacklist original = _Provider.GetByID(newVal.LCN).QueryObject;

            if (original != null)
            {
                return(_Provider.Update(newVal, original));
            }
            else
            {
                return(new CommandResult(ResultCode.NoRecord, ResultCodeDecription.GetDescription(ResultCode.NoRecord)));
            }
        }
Esempio n. 4
0
 public CommandResult Delete(YCTBlacklist info)
 {
     return(_Provider.Delete(info));
 }
Esempio n. 5
0
 public CommandResult Insert(YCTBlacklist info)
 {
     return(_Provider.Insert(info));
 }