示例#1
0
        public void LoadData()
        {
            this.MainWindow.Cursor = Cursors.Wait;
            try
            {
                AMSEvent accessEvent = new AMSEvent();
                try
                {
                    accessEvent = AMSUtil.GetLastEventAMS();
                }
                catch (Exception exception)
                {
                    Logger.Log(exception.StackTrace);
                }

                if (accessEvent.EventOn != null)
                {
                    var rowCount = MyDataContext.AMSEvents.Where(x => x.EventType == accessEvent.EventType && x.EventOn == accessEvent.EventOn && x.ElapsedTimeTxt == accessEvent.ElapsedTimeTxt).Count();
                    if (rowCount == 0)
                    {
                        MyDataContext.AddAMSEvent(accessEvent);
                    }
                }

                SyncWithComputerEvents();
            }
            catch (Exception exception)
            {
                Logger.Log(exception.StackTrace);
            }
            finally
            {
                this.MainWindow.Cursor = Cursors.Arrow;
            }
        }
示例#2
0
        private static AMSEvent ParseLastEventFromString(string eventData)
        {
            AMSEvent accessEvent = new AMSEvent();

            accessEvent.EventType   = (byte)GetEvenTTypeFromString(eventData);
            accessEvent.EventOn     = GetEventDateFromString(eventData);
            accessEvent.Description = getEventDescriptionFromString(eventData);
            accessEvent.ElapsedTime = GetElapsedTimeFromAMS();
            return(accessEvent);
        }
        public void AddAMSEvent(AMSEvent event1)
        {
            SqlCeConnection conn = null;

            using (conn = new SqlCeConnection(ConnectionString))
            {
                conn.Open();

                SqlCeCommand cmd = conn.CreateCommand();
                cmd.CommandText = "INSERT INTO AMSEvents ([EventType],[EventOn] ,[Description],[ElapsedTimeTxt],[IsActual]) Values('"
                                  + event1.EventType + "','" + event1.EventOn.ToString("yyyy-MM-dd HH:mm:ss") + "','"
                                  + event1.Description + "','" + event1.ElapsedTimeTxt + "'," + (event1.IsActual ? "1" : "0") + ")";

                cmd.ExecuteNonQuery();

                // Close the connection
                conn.Close();
            }
        }
示例#4
0
        public void LoadData()
        {
            this.MainWindow.Cursor = Cursors.Wait;
            try
            {
                AMSEvent accessEvent = new AMSEvent();
                try
                {
                    accessEvent = AMSUtil.GetLastEventAMS();
                }
                catch (Exception exception)
                {

                    Logger.Log(exception.StackTrace);
                }

                if (accessEvent.EventOn != null)
                {
                    var rowCount = MyDataContext.AMSEvents.Where(x => x.EventType == accessEvent.EventType && x.EventOn == accessEvent.EventOn && x.ElapsedTimeTxt == accessEvent.ElapsedTimeTxt).Count();
                    if (rowCount == 0)
                    {

                        MyDataContext.AddAMSEvent(accessEvent);

                    }
                }

                SyncWithComputerEvents();

            }
            catch (Exception exception)
            {

                Logger.Log(exception.StackTrace);
            }
            finally
            {
                this.MainWindow.Cursor = Cursors.Arrow;
            }
        }
示例#5
0
        public void LoadData()
        {
            ClearFields();
            try
            {
                AMSEvent accessEvent = ((App)App.Current).GetLastEvent();

                tooltipText = accessEvent.Description;
                if (accessEvent.EventType != (byte)AccessEventType.Unknown)
                {
                    if (accessEvent.EventType == (byte)AccessEventType.Exit)
                    {
                        Inside = false;
                    }
                    else if (accessEvent.EventType == (byte)AccessEventType.Entry)
                    {
                        Inside = true;
                    }


                    if (accessEvent.EventOn != null)
                    {
                        DateInSite = (DateTime)accessEvent.EventOn;
                    }

                    Last_Login_Time.Content       = DateInSite.ToDisplayTimeString();
                    Time_In_Office_Logged.Content = accessEvent.ElapsedTime.ToDisplayString();

                    RefreshTimeRemaining();
                }

                SetToolTip();
            }
            catch (Exception ex)
            {
                tooltipText = "Not able to Access Site";
                Logger.Log(ex.StackTrace);
            }
        }
示例#6
0
 private static AMSEvent ParseLastEventFromString(string eventData)
 {
     AMSEvent accessEvent = new AMSEvent();
     accessEvent.EventType = (byte)GetEvenTTypeFromString(eventData);
     accessEvent.EventOn = GetEventDateFromString(eventData);
     accessEvent.Description = getEventDescriptionFromString(eventData);
     accessEvent.ElapsedTime = GetElapsedTimeFromAMS();
     return accessEvent;
 }