Esempio n. 1
0
        protected override void DefWndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case MESSAGE_CAPTURED_OK:
            {
                MemoryStream ms = new MemoryStream();
                BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms);
                Bitmap      bmp     = new Bitmap(ms);
                String      strShow = zkfp2.BlobToBase64(CapTmp, cbCapTmp);
                XmlNodeList _users  = new Users().getAllUsers();
                foreach (XmlNode user in _users)
                {
                    string pass = user.SelectSingleNode("password").InnerText;
                    if (mach(strShow, pass) > 75)
                    {
                        MessageBox.Show(user.SelectSingleNode("username").InnerText);
                        break;
                    }
                }
                break;
            }

            default:
                base.DefWndProc(ref m);
                break;
            }
        }
Esempio n. 2
0
 protected override void DefWndProc(ref Message m)
 {
     if (m.Msg == MESSAGE_CAPTURED_OK && !Properties.Settings.Default.isAdmin && FormHandle == this.Handle)
     {
         MemoryStream ms = new MemoryStream();
         BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms);
         Bitmap      bmp     = new Bitmap(ms);
         String      strShow = zkfp2.BlobToBase64(CapTmp, cbCapTmp);
         XmlNodeList _users  = new Users().getAllUsers();
         foreach (XmlNode user in _users)
         {
             string pass = user.SelectSingleNode("password").InnerText;
             if (mach(strShow, pass) > 75)
             {
                 //MessageBox.Show(user.SelectSingleNode("username").InnerText);
                 Registration reg = new Registration(new Users().getIdByLogin(user.SelectSingleNode("login").InnerText));
                 free();
                 //FormHandle = reg.Handle;
                 //MessageBox.Show(this.Handle.ToString());
                 reg.Show();
                 reg.FormClosed += (o, v) => {
                     FormHandle = this.Handle;
                     bnInit_Click();
                     bnOpen_Click();
                     //MessageBox.Show("");
                 };
             }
         }
     }
     //else if (m.Msg == MESSAGE_CAPTURED_OK)
     //{
     //    MessageBox.Show("OK");
     //    MessageBox.Show(this.Handle.ToString());
     //    MessageBox.Show(FormHandle.ToString());
     //    MessageBox.Show(Properties.Settings.Default.isAdmin.ToString());
     //    base.DefWndProc(ref m);
     //}
     else
     {
         base.DefWndProc(ref m);
     }
 }
Esempio n. 3
0
        protected override void DefWndProc(ref Message m)
        {
            if (m.Msg == MESSAGE_CAPTURED_OK && !Properties.Settings.Default.isAdmin && FormHandle == this.Handle)
            {
                MemoryStream ms1 = new MemoryStream();
                BitmapFormat.GetBitmap(FPBuffer, mfpWidth, mfpHeight, ref ms1);
                Bitmap bmp     = new Bitmap(ms1);
                String strShow = zkfp2.BlobToBase64(CapTmp, cbCapTmp);


                //XmlNodeList _users = new Users().getAllUsers();
                //foreach (XmlNode user in _users)
                //{
                //    string pass = user.SelectSingleNode("password").InnerText;
                //    if (mach(strShow, pass) > 75)
                //    {
                //        //MessageBox.Show(user.SelectSingleNode("username").InnerText);
                //        Registration reg = new Registration(new Users().getIdByLogin(user.SelectSingleNode("login").InnerText));
                //        //free();
                //        //FormHandle = reg.Handle;
                //        MessageBox.Show(this.Handle.ToString());
                //        reg.Show();
                //    }
                //}


                XmlNodeList _users = new Users().getAllUsers();
                foreach (XmlNode user in _users)
                {
                    if (this.id == Convert.ToInt32(user.Attributes["id"].Value))
                    {
                        string pass = user.SelectSingleNode("password").InnerText;
                        //MessageBox.Show(pass);
                        //MessageBox.Show(strShow);
                        //MessageBox.Show(mach(strShow, pass).ToString());
                        if (mach(strShow, pass) > 75)
                        {
                            //MessageBox.Show("Read!!");
                            //прочитал

                            try
                            {
                                Users      user1     = new Users();
                                List <int> documents = user1.getReadOffDocuments(id);
                                string     path      = Directory.GetCurrentDirectory() + @"\Log\Log.txt";
                                string     titleDoc  = new Documents().getDocumentById(documents[ird]).SelectSingleNode("@name").Value;
                                if (camList.Count > 0 && camList[0] != "null")
                                {
                                    CloseVideoSource();
                                    user1.docFromReadOffToReadOn(id, documents[ird]);
                                    uploadReadOffDoc(listBox1);
                                    uploadReadOnDoc(listBox2);
                                    using (Graphics g = Graphics.FromImage(pictureBox1.Image))
                                    {
                                        Pen        p         = new Pen(Color.White);
                                        Font       drawFont  = new Font("Arial", 20);
                                        SolidBrush drawBrush = new SolidBrush(Color.Red);
                                        g.DrawString(label1.Text, drawFont, drawBrush, new Point(390, 450));
                                        Users u = new Users();
                                        g.DrawString(u.getUsernameById(id), drawFont, drawBrush, new Point(10, 450));
                                    }
                                    string namePhoto = DateTime.Now.Day.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
                                    pictureBox1.Image.Save(Directory.GetCurrentDirectory() + @"\Log\Images\" + namePhoto + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

                                    addLogRecord(path, "ПРОЧИТАЛ ДОКУМЕНТ " + titleDoc, namePhoto);
                                    start();
                                }
                                else
                                {
                                    addLogRecord(path, "ПРОЧИТАЛ ДОКУМЕНТ " + titleDoc, "ФОТО НЕ ПРОИЗВЕДЕНО");
                                    user1.docFromReadOffToReadOn(id, documents[ird]);
                                    uploadReadOffDoc(listBox1);
                                    uploadReadOnDoc(listBox2);
                                }
                            }
                            catch
                            {
                            }
                            menuStrip1.Visible  = label1.Visible = listBox2.Visible = listBox1.Visible = button2.Visible = button1.Visible = pictureBox1.Visible = true;
                            axAcroPDF1.Height   = listBox1.Height + listBox1.Location.Y - 25;
                            axAcroPDF1.Location = loc;
                            axAcroPDF1.Location = axLoc;
                            this.BackColor      = col;
                            axAcroPDF1.LoadFile("none");
                            //axAcroPDF1.Dispose();
                        }
                    }
                }
            }
            else
            {
                base.DefWndProc(ref m);
            }
        }