Пример #1
0
        public AuthenticationResponse Authenticate(string username, string password)
        {
            WebServiceUser found = new WebServiceUser()
            {
                Username = "******", Password = "******"
            };
            AuthenticationResponse rsp = new AuthenticationResponse();

            if (found != null)
            {
                string SessionID = WebServiceSession.Start(found);

                WebOperationContext.Current.OutgoingResponse.Headers.Add(WebServiceAuthorization.SessionIDHeader + ": " + SessionID);
                WebOperationContext.Current.OutgoingResponse.Headers.Add(WebServiceAuthorization.UserIDHeader + ": " + found.ID);

                rsp.Status  = (int)0;
                rsp.Token   = SessionID;
                rsp.UserID  = found.ID.ToString();
                rsp.Message = "Success";
            }
            else
            {
                rsp.Status  = 404;
                rsp.Message = "Not authorized";
            }
            return(rsp);
        }
Пример #2
0
        private static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            aTimer.Enabled = false;

            Status.TickCount++;

            // Check for timeout
            WebServiceSession.Refresh();

            // Read Messages

            if ((DateTime.Now > Status.NextTaskTime))
            {
                Status.NextTaskTime = DateTime.Now.AddMinutes(Status.IntervalMinutes);
                // do timed stuff here
                ServiceLogger.Info("***** OnTimedEvent START short interval");
                DoTasks();
                ServiceLogger.Info("***** OnTimedEvent END short interval");
            }

            if ((DateTime.Now > Status.NextLongTaskTime))
            {
                //aTimer.Enabled = false;
                Status.NextLongTaskTime = DateTime.Now.AddMinutes(Status.IntervalMinutesLong);
                ServiceLogger.Info("***** OnTimedEvent START long interval");
                DoTasksLong();
                ServiceLogger.Info("***** OnTimedEvent END long interval");
                //aTimer.Enabled = true;
            }

            // Do Scheduled
            DoScheduled();

            aTimer.Enabled = true;
        }
Пример #3
0
 public bool SignOut()
 {
     return(WebServiceSession.Terminate());
 }