Exemplo n.º 1
0
        private void update_UserInfo(string id)
        {
            if (InvokeRequired)
            {
                update_UserInfo_Delegate task = new update_UserInfo_Delegate(update_UserInfo);
                BeginInvoke(task, new object[] { id });
            }
            else
            {
                lock (guiLock)
                {
                    if (txtID.Text.Equals(id) == false)
                    {
                        reader.saveToLogInfo(String.Format("{0}, {1}", txtID.Text, id));
                        DataRow[] rows = UserInfoTable.Select(String.Format("ID = '{0}'", id));

                        if (rows.Length > 0)
                        {
                            string time = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());

                            txtID.Text = rows[0].ItemArray[0].ToString();

                            try
                            {
                            }
                            catch
                            {
                            }

                            try
                            {
                            }
                            catch
                            {
                            }
                        }
                        else
                        {
                            txtID.Text = id;

                            try
                            {
                            }
                            catch
                            {
                            }
                        }
                    }
                    else
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void update_UserInfo(string id)
        {
            if (InvokeRequired)
            {
                update_UserInfo_Delegate task = new update_UserInfo_Delegate(update_UserInfo);
                BeginInvoke(task, new object[] { id });
            }
            else
            {
                lock (guiLock)
                {
                    if (txtID.Text.Equals(id) == false)
                    {
                        reader.saveToLogInfo(String.Format("{0}, {1}", txtID.Text, id));
                        string mediaFile = null;
                        DataRow[] rows = UserInfoTable.Select(String.Format("ID = '{0}'", id));

                        if (rows.Length > 0)
                        {
                            btnAccessLog.Enabled = true;
                            string time = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
                            txtTime.Text = time;
                            txtID.Text = rows[0].ItemArray[0].ToString();
                            txtName.Text = rows[0].ItemArray[1].ToString();
                            txtTitle.Text = rows[0].ItemArray[2].ToString();
                            txtCompany.Text = rows[0].ItemArray[3].ToString();
                            txtLocation.Text = rows[0].ItemArray[4].ToString();
                            mediaFile = System.Environment.CurrentDirectory + "\\Photo\\" + rows[0].ItemArray[5].ToString();
                            try
                            {
                                picPhoto.ImageLocation = mediaFile;
                                picPhoto.Load();
                            }
                            catch
                            {
                                tsslStatus.Text = String.Format("Cannot load picture {0}", rows[0].ItemArray[5].ToString());
                            }
                            mediaFile = System.Environment.CurrentDirectory + "\\Audio\\" + rows[0].ItemArray[6].ToString();
                            try
                            {
                                player.SoundLocation = mediaFile;
                                player.Load();
                                Application.DoEvents();
                                player.Play();
                                Application.DoEvents();
                            }
                            catch
                            {
                                tsslStatus.Text = String.Format("Cannot play file {0}", rows[0].ItemArray[6].ToString());
                            }

                            tmrTimeout.Enabled = false;
                            tmrTimeout.Enabled = true;
                            saveAccessTime(id, time, txtLocation.Text);
                        }
                        else
                        {
                            btnAccessLog.Enabled = false;
                            txtID.Text = id;
                            txtCompany.Text = "";
                            txtName.Text = "";
                            txtTitle.Text = "";
                            txtLocation.Text = "";
                            txtTime.Text = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
                            picPhoto.ImageLocation = System.Environment.CurrentDirectory + "\\Photo\\noAccess.jpg";
                            player.SoundLocation = System.Environment.CurrentDirectory + "\\Audio\\noAccess.wav";
                            try
                            {
                                player.Play();
                                Application.DoEvents();
                            }
                            catch
                            {
                            }
                            tmrTimeout.Enabled = false;
                            tmrTimeout.Enabled = true;
                        }
                    }
                    else
                    {
                        tmrTimeout.Enabled = false;
                        tmrTimeout.Enabled = true;
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void update_UserInfo(string id)
        {
            if (InvokeRequired)
            {
                update_UserInfo_Delegate task = new update_UserInfo_Delegate(update_UserInfo);
                BeginInvoke(task, new object[] { id });
            }
            else
            {
                lock (guiLock)
                {
                    if (txtID.Text.Equals(id) == false)
                    {
                        reader.saveToLogInfo(String.Format("{0}, {1}", txtID.Text, id));
                        DataRow[] rows = UserInfoTable.Select(String.Format("ID = '{0}'", id));

                        if (rows.Length > 0)
                        {

                            string time = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());

                            txtID.Text = rows[0].ItemArray[0].ToString();

                            try
                            {

                            }
                            catch
                            {

                            }

                            try
                            {

                            }
                            catch
                            {

                            }

                        }
                        else
                        {

                            txtID.Text = id;

                            try
                            {

                            }
                            catch
                            {
                            }

                        }
                    }
                    else
                    {

                    }
                }
            }
        }
Exemplo n.º 4
0
        private void update_UserInfo(string id)
        {
            if (InvokeRequired)
            {
                update_UserInfo_Delegate task = new update_UserInfo_Delegate(update_UserInfo);
                BeginInvoke(task, new object[] { id });
            }
            else
            {
                lock (guiLock)
                {
                    if (txtID.Text.Equals(id) == false)
                    {
                        reader.saveToLogInfo(String.Format("{0}, {1}", txtID.Text, id));
                        string    mediaFile = null;
                        DataRow[] rows      = UserInfoTable.Select(String.Format("ID = '{0}'", id));

                        if (rows.Length > 0)
                        {
                            btnAccessLog.Enabled = true;
                            string time = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
                            txtTime.Text     = time;
                            txtID.Text       = rows[0].ItemArray[0].ToString();
                            txtName.Text     = rows[0].ItemArray[1].ToString();
                            txtTitle.Text    = rows[0].ItemArray[2].ToString();
                            txtCompany.Text  = rows[0].ItemArray[3].ToString();
                            txtLocation.Text = rows[0].ItemArray[4].ToString();
                            mediaFile        = System.Environment.CurrentDirectory + "\\Photo\\" + rows[0].ItemArray[5].ToString();
                            try
                            {
                                picPhoto.ImageLocation = mediaFile;
                                picPhoto.Load();
                            }
                            catch
                            {
                                tsslStatus.Text = String.Format("Cannot load picture {0}", rows[0].ItemArray[5].ToString());
                            }
                            mediaFile = System.Environment.CurrentDirectory + "\\Audio\\" + rows[0].ItemArray[6].ToString();
                            try
                            {
                                player.SoundLocation = mediaFile;
                                player.Load();
                                Application.DoEvents();
                                player.Play();
                                Application.DoEvents();
                            }
                            catch
                            {
                                tsslStatus.Text = String.Format("Cannot play file {0}", rows[0].ItemArray[6].ToString());
                            }

                            tmrTimeout.Enabled = false;
                            tmrTimeout.Enabled = true;
                            saveAccessTime(id, time, txtLocation.Text);
                        }
                        else
                        {
                            btnAccessLog.Enabled   = false;
                            txtID.Text             = id;
                            txtCompany.Text        = "";
                            txtName.Text           = "";
                            txtTitle.Text          = "";
                            txtLocation.Text       = "";
                            txtTime.Text           = String.Format("{0} {1}", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString());
                            picPhoto.ImageLocation = System.Environment.CurrentDirectory + "\\Photo\\noAccess.jpg";
                            player.SoundLocation   = System.Environment.CurrentDirectory + "\\Audio\\noAccess.wav";
                            try
                            {
                                player.Play();
                                Application.DoEvents();
                            }
                            catch
                            {
                            }
                            tmrTimeout.Enabled = false;
                            tmrTimeout.Enabled = true;
                        }
                    }
                    else
                    {
                        tmrTimeout.Enabled = false;
                        tmrTimeout.Enabled = true;
                    }
                }
            }
        }