Exemplo n.º 1
0
            public SessionsInfo Merge(SessionsInfo other)
            {
                if (other == null)
                {
                    return(this);
                }

                return(new SessionsInfo(Count + other.Count, Sessions.Concat(other.Sessions).ToList()));
            }
Exemplo n.º 2
0
        protected override void InSession()
        {
            try
            {
                if (_qrInfo != null)
                {
                    //写入本地记录并且通知
                    var info = new SessionsInfo
                    {
                        SessionId    = MyMatch.SessionId,
                        CreateDate   = DateTime.Now,
                        Name         = MyMatch.SessionName,
                        IdNo         = BarIdNo,
                        IdCardPhoto  = null,
                        TakePhoto    = PhotoOk,
                        FaceData     = FaceFun.StructToBytes(CameraRft),
                        IdAddress    = null,
                        TicketType   = 0,
                        TicketNo     = _qrInfo.Value.TicketNo,
                        Area         = _qrInfo.Value.Area,
                        Row          = _qrInfo.Value.Row,
                        Seat         = _qrInfo.Value.Seat,
                        TelNo        = IrAdvanced.ReadString("TelNo"),
                        TelArea      = IrAdvanced.ReadString("TelArea"),
                        BuyName      = "",
                        BuyPhoto     = null,
                        BuyDate      = null,
                        ValidateType = 5,
                        SyncTime     = null,
                        Status       = 0,
                        Remark       = "",
                        UserName     = AftUserName,
                    };

                    if (FaceFun.AddSessions(info) > 0)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            MyArea.Text = string.Format("区域:{0}{1}排{2}座", info.Area, info.Row, info.Seat);
                            MyNum.Text  = "票号:" + info.TicketNo;
                            MyType.Text = "类型:散票";
                            MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                            ShowEventMsg("检票成功", MsgType.FaceOk);
                        });
                    }
                    else
                    {
                        ShowEventMsg("检票失败,数据库连接失败", MsgType.TipErr);
                    }
                }
            }
            catch (Exception ex)
            {
                ex.ToSaveLog("InSession");
            }
        }
Exemplo n.º 3
0
        /// <summary> 写入数据库 </summary>
        protected override void InSession()
        {
            try
            {
                //写入本地记录并且通知
                var info = new SessionsInfo
                {
                    SessionId    = MyMatch.SessionId,
                    CreateDate   = DateTime.Now,
                    Name         = MyMatch.SessionName,
                    IdNo         = Cvr.Info.Number,
                    IdCardPhoto  = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"),
                    TakePhoto    = PhotoOk,
                    FaceData     = FaceFun.StructToBytes(CameraRft),
                    IdAddress    = Cvr.Info.Address,
                    TicketType   = 2,
                    TicketNo     = null,
                    Area         = null,
                    Row          = null,
                    Seat         = null,
                    TelNo        = IrAdvanced.ReadString("TelNo"),
                    TelArea      = IrAdvanced.ReadString("TelArea"),
                    BuyName      = Cvr.Info.Name,
                    BuyPhoto     = null,
                    BuyDate      = null,
                    ValidateType = 1,
                    SyncTime     = null,
                    Status       = 0,
                    Remark       = "",
                    UserName     = AftUserName,
                };

                if (FaceFun.AddSessions(info) > 0)
                {
                    Dispatcher.InvokeAsync(() =>
                    {
                        MiniImg.Source = FaceFun.ByteToBitmapImage(PhotoOk);
                    });
                    base.InSession();
                }
                else
                {
                    "写入数据库失败".ToSaveLog("入场记录时:");
                }
            }
            catch (Exception ex)
            {
                ex.ToSaveLog("InSession");
            }
        }
Exemplo n.º 4
0
        /// <summary> 写入本地记录并且通知 </summary>
        protected override void InSession()
        {
            //写入本地记录并且通知
            var info = new SessionsInfo
            {
                SessionId    = MyMatch.SessionId,
                CreateDate   = DateTime.Now,
                Name         = MyMatch.SessionName,
                IdNo         = Cvr.Info.Number,
                IdCardPhoto  = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"),
                TakePhoto    = PhotoOk,
                FaceData     = FaceFun.StructToBytes(CameraRft),
                IdAddress    = Cvr.Info.Address,
                TicketType   = 0,
                TicketNo     = _qrInfo.Value.TicketNo,
                Area         = _qrInfo.Value.Area,
                Row          = _qrInfo.Value.Row,
                Seat         = _qrInfo.Value.Seat,
                TelNo        = IrAdvanced.ReadString("TelNo"),
                TelArea      = IrAdvanced.ReadString("TelArea"),
                BuyName      = Cvr.Info.Name,
                BuyPhoto     = null,
                BuyDate      = null,
                ValidateType = 3,
                SyncTime     = null,
                Status       = 0,
                Remark       = "",
                UserName     = AftUserName,
            };

            if (FaceFun.AddSessions(info) > 0)
            {
                ShowEventMsg("检票成功", MsgType.FaceOk);
            }
            else
            {
                "写入数据库失败".ToSaveLog("入场记录时:");
                ShowEventMsg("检票失败", MsgType.FaceErr);
            }
        }
Exemplo n.º 5
0
        /// <summary> 写入数据库 </summary>
        protected override void InSession()
        {
            try
            {
                //写入本地记录并且通知
                var info = new SessionsInfo
                {
                    SessionId    = MyMatch.SessionId,
                    CreateDate   = DateTime.Now,
                    Name         = MyMatch.SessionName,
                    IdNo         = Cvr.Info.Number,
                    IdCardPhoto  = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"),
                    TakePhoto    = PhotoOk,
                    FaceData     = FaceFun.StructToBytes(CameraRft),
                    IdAddress    = Cvr.Info.Address,
                    TicketType   = 2,
                    TicketNo     = null,
                    Area         = null,
                    Row          = null,
                    Seat         = null,
                    TelNo        = IrAdvanced.ReadString("TelNo"),
                    TelArea      = IrAdvanced.ReadString("TelArea"),
                    BuyName      = Cvr.Info.Name,
                    BuyPhoto     = null,
                    BuyDate      = null,
                    ValidateType = 1,
                    SyncTime     = null,
                    Status       = 0,
                    Remark       = "",
                    UserName     = AftUserName,
                };

                AFT_System.Face.FaceFun.AddSessions(info);
            }
            catch (Exception ex)
            {
                ex.ToSaveLog("InSession");
            }
        }
Exemplo n.º 6
0
 /// <summary> 添加入场流水记录进数据库 </summary>
 /// <param name="info">入场记录</param>
 public static int AddSessions(SessionsInfo info)
 {
     try
     {
         info.IdNo.ToSaveLog("写入场流水记录:");
         var sb = new StringBuilder();
         sb.Append("insert into in_sessions(session_id,create_date,name,id_no,id_card_photo,take_photo,face_data,id_address,ticket_type,ticket_no,area,row,seat,tel_no,tel_area,buy_name,buy_photo,buy_date,validate_type,sync_time,status,remark) ");
         sb.Append("VALUES(?session_id,?create_date,?name,?id_no,?id_card_photo,?take_photo,?face_data,?id_address,?ticket_type,?ticket_no,?area,?row,?seat,?tel_no,?tel_area,?buy_name,?buy_photo,?buy_date,?validate_type,?sync_time,?status,?remark) ");
         MySqlParameter[] parameters =
         {
             new MySqlParameter("?session_id",    MySqlDbType.Int32),
             new MySqlParameter("?create_date",   MySqlDbType.DateTime),
             new MySqlParameter("?name",          MySqlDbType.VarChar),
             new MySqlParameter("?id_no",         MySqlDbType.VarChar),
             new MySqlParameter("?id_card_photo", MySqlDbType.MediumBlob),
             new MySqlParameter("?take_photo",    MySqlDbType.MediumBlob),
             new MySqlParameter("?face_data",     MySqlDbType.MediumBlob),
             new MySqlParameter("?id_address",    MySqlDbType.VarChar),
             new MySqlParameter("?ticket_type",   MySqlDbType.Int32),
             new MySqlParameter("?ticket_no",     MySqlDbType.VarChar),
             new MySqlParameter("?area",          MySqlDbType.VarChar),
             new MySqlParameter("?row",           MySqlDbType.VarChar),
             new MySqlParameter("?seat",          MySqlDbType.VarChar),
             new MySqlParameter("?tel_no",        MySqlDbType.VarChar),
             new MySqlParameter("?tel_area",      MySqlDbType.VarChar),
             new MySqlParameter("?buy_name",      MySqlDbType.VarChar),
             new MySqlParameter("?buy_photo",     MySqlDbType.MediumBlob),
             new MySqlParameter("?buy_date",      MySqlDbType.DateTime),
             new MySqlParameter("?validate_type", MySqlDbType.Int32),
             new MySqlParameter("?sync_time",     MySqlDbType.DateTime),
             new MySqlParameter("?status",        MySqlDbType.Int32),
             new MySqlParameter("?remark",        MySqlDbType.VarChar),
         };
         parameters[0].Value  = info.SessionId;
         parameters[1].Value  = info.CreateDate;
         parameters[2].Value  = info.Name;
         parameters[3].Value  = info.IdNo;
         parameters[4].Value  = info.IdCardPhoto;
         parameters[5].Value  = info.TakePhoto;
         parameters[6].Value  = info.FaceData;
         parameters[7].Value  = info.IdAddress;
         parameters[8].Value  = info.TicketType;
         parameters[9].Value  = info.TicketNo;
         parameters[10].Value = info.Area;
         parameters[11].Value = info.Row;
         parameters[12].Value = info.Seat;
         parameters[13].Value = info.TelNo;
         parameters[14].Value = info.TelArea;
         parameters[15].Value = info.BuyName;
         parameters[16].Value = info.BuyPhoto;
         parameters[17].Value = info.BuyDate;
         parameters[18].Value = info.ValidateType;
         parameters[19].Value = info.SyncTime;
         parameters[20].Value = info.Status;
         parameters[21].Value = info.Remark;
         return(MysqlHelper.ExecuteNonQuery(sb.ToString(), CommandType.Text, parameters));
     }
     catch (Exception ex)
     {
         ex.ToSaveLog("写入数据库失败AddSessions:");
     }
     return(0);
 }
Exemplo n.º 7
0
        /// <summary> 读写IC卡 </summary>
        private int CheckICard()
        {
            FaceFun.TimeStart();
            var icInfo = new IdCardFunc.TicketCardInfo();
            int i      = IdCardFunc.GetTicketData_New(ref icInfo);

            if (i == 0)
            {
                if (IsIdSame && (Cvr.Info.Number != icInfo.IDCard))
                {
                    ShowEventMsg("身份证号码与票面不符合!", MsgType.Info);
                }
                else
                {
                    tempTime = DateTime.Now;
                    //检查白名单验证
                    if (!CheckWhite(icInfo.IDCard))
                    {
                        return(1);
                    }
                    //写入本地记录并且通知
                    var info = new SessionsInfo
                    {
                        SessionId    = MyMatch.SessionId,
                        CreateDate   = DateTime.Now,
                        Name         = MyMatch.SessionName,
                        IdNo         = icInfo.IDCard,
                        IdCardPhoto  = IrAdvanced.ReadBytesFromFile(FaceFun.BaseDir + "\\pic.bmp"),
                        TakePhoto    = PhotoOk,
                        FaceData     = FaceFun.StructToBytes(CameraRft),
                        IdAddress    = "",
                        TicketType   = 1,
                        TicketNo     = icInfo.CardNo,
                        Area         = icInfo.StadiumArea,
                        Row          = icInfo.Row,
                        Seat         = icInfo.Position,
                        TelNo        = IrAdvanced.ReadString("TelNo"),
                        TelArea      = IrAdvanced.ReadString("TelArea"),
                        BuyName      = icInfo.Name,
                        BuyPhoto     = null,
                        BuyDate      = null,
                        ValidateType = 2,
                        SyncTime     = null,
                        Status       = 0,
                        Remark       = "",
                        UserName     = AftUserName,
                    };
                    if (FaceFun.AddSessions(info) > 0)
                    {
                        Dispatcher.InvokeAsync(() =>
                        {
                            ShowEventMsg("检票成功", MsgType.FaceOk);
                            MyArea.Text = string.Format("区域:{0}{1}排{2}座", info.Area, info.Row, info.Seat);
                            MyNum.Text  = "票号:" + info.TicketNo;
                            MyType.Text = "类型:年票";
                            MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                        });
                    }
                }
            }
            else if (i == 16)
            {
                i.ToString().ToSaveLog("已刷卡:");
                var str = (tempTime == null) ? "拒绝入场" : string.Format("{0}入场", tempTime);
                ShowEventMsg("一天只能入场一次!\n" + str, MsgType.InfoErr);
                ShowEventMsg("检票失败", MsgType.FaceErr);
                Thread.Sleep(500);
            }
            else if (i == 1)    //未放卡
            {
                tempTime = null;
            }
            else
            {
                i.ToString().ToSaveLog("IC卡读卡失败:");
                Thread.Sleep(300);
            }
            FaceFun.TimeStop("IC读写耗时:");
            return(i);
        }
Exemplo n.º 8
0
        /// <summary> 读写IC卡 </summary>
        private int CheckICard()
        {
            try
            {
                "准备请求读卡".ToSaveLog("CheckIcard:");
                FaceFun.TimeStart();
                var icInfo = new IdCardFunc.TicketCardInfo();
                int i      = IdCardFunc.GetTicketData_New(ref icInfo);
                if (i == 0)
                {
                    tempTime = DateTime.Now;
                    icInfo.IDCard.ToSaveLog("读取到IC卡:");
                    //判断是否超过时限
                    if (!icInfo.IDCard.IsNullOrEmpty())
                    {
                        Dispatcher.Invoke(() => MyIdNo.Text = icInfo.IDCard);
                    }
                    var flag = true;
                    Dispatcher.Invoke(() =>
                    { //黑名单检查
                        if (IsCheckBlack && FaceFun.IsInBlack(MyIdNo.Text))
                        {
                            LeftImg.Visibility = Visibility.Visible;
                        }
                        if (IsCheckIdNo && MyIdNo.Text.IsNullOrEmpty())
                        {
                            flag = false;
                        }
                    });
                    if (!flag)
                    {
                        ShowEventMsg("请录入身份证号码.", MsgType.TipErr); return(1);
                    }
                    //检查白名单验证
                    if (!CheckWhite(icInfo.IDCard))
                    {
                        return(1);
                    }
                    PhotoOk = null;
                    lock (Obj)
                    {
                        if (MyCapture != null)
                        {
                            "拍照获取Photo.".ToSaveLog("");
                            using (var myMap = MyCapture.QueryFrame())
                            {
                                if (myMap != null)
                                {
                                    PhotoOk = FaceFun.BitmapToByte(myMap.Bitmap);
                                }
                                else
                                {
                                    "未取得摄像头Mat数据".ToSaveLog("OnlyQrView.BarCode_OnKeyUp:");
                                }
                            }
                        }
                    }
                    //写入本地记录并且通知
                    var info = new SessionsInfo
                    {
                        SessionId    = MyMatch.SessionId,
                        CreateDate   = DateTime.Now,
                        Name         = MyMatch.SessionName,
                        IdNo         = icInfo.IDCard,
                        IdCardPhoto  = null,
                        TakePhoto    = PhotoOk,
                        FaceData     = null,
                        IdAddress    = "",
                        TicketType   = 1,
                        TicketNo     = icInfo.CardNo,
                        Area         = icInfo.StadiumArea,
                        Row          = icInfo.Row,
                        Seat         = icInfo.Position,
                        TelNo        = IrAdvanced.ReadString("TelNo"),
                        TelArea      = IrAdvanced.ReadString("TelArea"),
                        BuyName      = icInfo.Name,
                        BuyPhoto     = null,
                        BuyDate      = null,
                        ValidateType = 4,
                        SyncTime     = null,
                        Status       = 0,
                        Remark       = "",
                        UserName     = AftUserName,
                    };
                    if (FaceFun.AddSessions(info) > 0)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            MyArea.Text = string.Format("区域:{0}区{1}排{2}座", info.Area, info.Row, info.Seat);
                            MyNum.Text  = "票号:" + info.TicketNo;
                            MyType.Text = "类型:年票";
                            MyTime.Text = "时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
                        });
                        ShowEventMsg("检票成功", MsgType.FaceOk);
                        Thread.Sleep(500);
                    }

                    FaceFun.TimeStop("IC读写耗时:");
                }
                else if (i == 16)
                {
                    i.ToString().ToSaveLog("已刷卡:");
                    var str = (tempTime == null) ? "拒绝入场" : string.Format("{0}入场", tempTime);
                    ShowEventMsg("一天只能入场一次!\n" + str, MsgType.FaceErr);
                    Thread.Sleep(500);
                }
                else if (i == 1)    //未放卡
                {
                    tempTime = null;
                }
                else
                {
                    i.ToString().ToSaveLog("IC卡读卡失败:");
                    Thread.Sleep(300);
                }

                icPass = false;
                return(i);
            }
            catch (Exception ex)
            {
                ex.ToSaveLog("CheckICard失败:");
            }
            icPass = false;
            return(0);
        }