Beispiel #1
0
        private void btnAdd_click(object sender, RoutedEventArgs e)
        {
            if (!Check())
                return;

            var cardno = txtCardNo.Text.Trim();

            if (CardPhoto.IsCardNoExist(cardno))
            {
                MessageBox.Show("卡号已存在!");
                txtCardNo.Focus();
                return;
            }

            Employee emp = new Employee
            {
                Name = txtName.Text,
                CardNo = cardno,
                Photo = txtPhoto.Text
            };
            FaceCore.Koala.CreateSubject(emp);

            CardPhoto.Add(emp.ID, cardno, txtName.Text.Trim(), txtPhoto.Text.Trim());

            ShowPersons(string.Empty);

            txtCardNo.Clear();
            txtName.Clear();
            txtPhoto.Clear();
        }
Beispiel #2
0
        public FaceCore()
        {
            Employee = new Employee();
            AlarmEmployee = new Employee();
            delayCall = new FuncTimeout();

            AlarmVisibility = Visibility.Collapsed;
            ReadyVisibility = Visibility.Visible;
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (txtName.IsEmpty() || txtJobNumber.IsEmpty() || txtPhoto.IsEmpty())
            {
                CMessageBox.Show("请填写属性信息!");
                return;
            }

            Employee emp = new Employee();
            emp.Name = txtName.Text;
            emp.CardNo = txtJobNumber.Text;
            emp.Photo = txtPhoto.Text;

            var ret = koala.CreateSubject(emp);
            if (ret)
            {
                txtID.Text = emp.ID.ToString();
                CMessageBox.Show("创建用户成功!");
            }
        }
Beispiel #4
0
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="emp"></param>
        public bool CreateSubject(Employee emp)
        {
            var dict = new Dictionary<string, string>();
            //0:员工 1:访客 2:VIP
            dict.Add("subject_type", "0");
            dict.Add("name", emp.Name);
            dict.Add("job_number", emp.CardNo);

            var request = new HttpMethod();
            var responseStr = request.Post(subject_url, session, dict);

            if (responseStr.IsEmpty())
            {
                return false;
            }

            var json = responseStr.Deserialize<Subject>();
            emp.ID = json.data.id;

            UpdatePhoto(emp);

            return true;
        }
Beispiel #5
0
 public PhotoWindow(Employee emp)
 {
     InitializeComponent();
     this.DataContext = emp;
 }
Beispiel #6
0
 private void SaveEmployee(Employee emp)
 {
     if (!allowEmployees.ContainsKey(emp.CardNo))
     {
         emp.IsOK = true;
         emp.EnteranceTime = DateTime.Now;
         allowEmployees.Add(emp.CardNo, emp);
         LogHelper.Info("增加刷卡[" + emp.CardNo + "]");
     }
     else
     {
         LogHelper.Info("更新刷卡[" + emp.CardNo + "]");
         allowEmployees[emp.CardNo].IsOK = true;
         allowEmployees[emp.CardNo].EnteranceTime = DateTime.Now;
     }
 }
Beispiel #7
0
 public FaceCore()
 {
     Employee = new Employee();
     delayCall = new FuncTimeout();
     server = new UdpComServer(server_port);
 }
Beispiel #8
0
        /// <summary>
        /// 上传识别用户图像
        /// </summary>
        /// <param name="emp"></param>
        private void UpdatePhoto(Employee emp)
        {
            var dict = new Dictionary<string, string>();
            dict.Add("subject_id", emp.ID.ToString());

            var image = emp.Photo.FileToByte();
            var request = new HttpMethod();
            var responseStr = request.PostPhoto(subjectphoto_url, image, session, dict);

            var json = responseStr.Deserialize<UploadPhoto>();
            if (json.code == 0)
            {
            }
        }