private static void Host_PostDelViceCardInfo(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e) { try { int hostIndex = e.Arguments[0].IntValue; int viceIndex = e.Arguments[1].IntValue; CardInfo hostInfo = CardManager.CardInfos[hostIndex]; CardInfo viceInfo = hostInfo.ViceCardInfos[viceIndex]; BundledInfoManager.Delete(hostInfo.CardNumber, viceInfo.CardNumber); hostInfo.ViceCardInfos.RemoveAt(viceIndex); viceInfo = null; } catch (Exception ex) { Log4Helper.ErrorInfo(ex.Message, ex); ViewCallFunction.ViewAlert(ex.Message); } }
private static void Host_PostUpdateViceCardInfo(object sender, Chromium.Remote.Event.CfrV8HandlerExecuteEventArgs e) { try { int index = e.Arguments[0].IntValue; int viceIndex = e.Arguments[1].IntValue; string strNumber = e.Arguments[2].StringValue; int type = e.Arguments[3].IntValue; Chromium.Remote.CfrTime cTime = e.Arguments[4].DateValue; DateTime time = new DateTime(cTime.Year, cTime.Month, cTime.DayOfMonth); int partition = e.Arguments[5].IntValue; CardInfo info = CardManager.CardInfos[index]; if (viceIndex > -1) { CardInfo viceInfo = info.ViceCardInfos[viceIndex]; viceInfo.CardNumber = strNumber; viceInfo.CardTime = time; viceInfo.CardPartition = partition; viceInfo.CardCount = DistanceIssue.SetCount(viceInfo.CardCount); CardManager.Update(viceInfo); } else { if (info.ViceCardInfos == null) { info.ViceCardInfos = new List <CardInfo>(); } List <BundledInfo> bundledInfos = new List <BundledInfo>(); string[] strNumbers = strNumber.Split(','); if (type == (int)PortEnums.CardTypes.Card2)//车卡 { List <CardInfo> viceInfos = CardManager.CardInfos.Where(c => c.Id == 0 && c.CardType == (int)PortEnums.CardTypes.Card4).ToList(); if (viceInfos.Count > 0) { foreach (CardInfo item in viceInfos) { foreach (string number in strNumbers) { if (item.CardNumber != number) { continue; } item.CardTime = time; item.CardPartition = partition; item.CardCount = DistanceIssue.SetCount(item.CardCount); item.Id = CardManager.Insert(item); info.ViceCardInfos.Add(item); bundledInfos.Add(new BundledInfo() { //Cid = info.Id, HostCardNumber = info.CardNumber, Vid = item.Id, ViceCardNumber = item.CardNumber }); break; } } } viceInfos = CardManager.GetViceCards(strNumbers); if (viceInfos.Count > 0) { foreach (CardInfo item in viceInfos) { item.CardTime = time; item.CardPartition = partition; item.CardCount = DistanceIssue.SetCount(item.CardCount); bundledInfos.Add(new BundledInfo() { //Cid = info.Id, HostCardNumber = info.CardNumber, Vid = item.Id, ViceCardNumber = item.CardNumber }); } info.ViceCardInfos.AddRange(viceInfos); CardManager.Update(viceInfos.ToArray()); } } else if (type == (int)PortEnums.CardTypes.Card3)//车牌号码 { CardInfo licensePlateInfo = CardManager.GetLicensePlateInfo(strNumber); if (licensePlateInfo != null) { licensePlateInfo.CardTime = time; licensePlateInfo.CardPartition = partition; CardManager.Update(licensePlateInfo); } else { licensePlateInfo = new CardInfo() { CardNumber = strNumber, CardTime = time, CardPartition = partition, CardType = -1, }; licensePlateInfo.Id = CardManager.Insert(licensePlateInfo); } info.ViceCardInfos.Add(licensePlateInfo); bundledInfos.Add(new BundledInfo() { //Cid = info.Id, HostCardNumber = info.CardNumber, Vid = licensePlateInfo.Id, ViceCardNumber = licensePlateInfo.CardNumber, }); } if (bundledInfos.Count > 0) { BundledInfoManager.Insert(bundledInfos.ToArray()); } } string json = Utility.JsonSerializerByArrayData(info.ViceCardInfos.ToArray()); e.SetReturnValue(json); } catch (Exception ex) { Log4Helper.ErrorInfo(ex.Message, ex); ViewCallFunction.ViewAlert(ex.Message); } }