예제 #1
0
        protected void Application_Start()
        {
            string password_md5 = PasswordHelper.MD5Encoding("123456", "HuiQuan@2019");

            // 启动 全局服务
            AppGlobalServerStart.Register();
            AreaRegistration.RegisterAllAreas();


            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
            WebApiConfig.Register(GlobalConfiguration.Configuration);

            var format = GlobalConfiguration.Configuration.Formatters;

            //清除默认xml
            format.XmlFormatter.SupportedMediaTypes.Clear();


            GlobalConfiguration.Configuration.Filters.Add(new WebApiExceptionFilterAttribute());

            if (System.Configuration.ConfigurationManager.AppSettings["IsRedis"] + "" == "0")
            {//将数据缓存到Redis中,当然,如果你不用Redis,自行处理iis回收之后,缓存丢失的问题也是可以的.
                //RedisCacheSaveThread.Instance.Start();
                StartService.Start();
            }

            //new CloudApi.Dueros.ThreadCheckModel().StartThread();

            ThreadCheckModel.GetYunZigStateChangeQueue();
            ThreadCheckModel.GetLotDeviceChangeQueue();
        }
예제 #2
0
        public LoginDialogViewModel(StartService startService)
        {
            this.startService        = startService;
            this.userMessage         = string.Empty;
            this.windowLoadedCommand = DelegateCommand <object> .FromAsyncHandler(OnWindowLoaded);

            this.cancelCommand = new DelegateCommand <object>(OnCancel);
        }
예제 #3
0
        public void LoginAsUser()
        {
            StartService startService = new StartService(ref Repo);


            User userLoggingIn;

            // TODO: Implement Login functionality for existing users

            Console.WriteLine("Please put in your email, then your password to login.");


            userLoggingIn = startService.GetUserByEmail(UserRequestUtility.QueryEmail());

            if (userLoggingIn is null)
            {
                Console.WriteLine("Couldn't find a user matching that email. You can try again if you want, that'll be fun.");
                LoginMenu loginMenuButAgain = new LoginMenu(ref Repo);
                MenuManager.Instance.ReadyNextMenu(loginMenuButAgain);
            }
            else if (userLoggingIn is Customer || userLoggingIn is Manager)
            {
                string userInputPassword = UserRequestUtility.QueryPassword();
                while (userInputPassword != userLoggingIn.Password)
                {
                    userInputPassword = UserRequestUtility.QueryPassword();
                }
            }



            // TODO: When SignUp() ends, add the new customer data to DB/file
            switch (selectedChoice)
            {
            case 1:
                //TODO: Update a database with an added customer using BL.

                break;

            case 2:
                //TODO: Update a database with an added manager using BL.

                break;

            default:
                throw new NotImplementedException();
                //break;
            }

            //TODO: Check at Login() if the inputted email and password match any existing customer or Manager, then make the current user either customer or manager.

            // TODO: Move to next menu.
        }
예제 #4
0
        public void SearchGameTestForGameNotExist()
        {
            string userName = "******";
            Game   game     = null;

            _mockGameRepository = new Mock <IGameRepository>(MockBehavior.Strict);
            _mockGameRepository.Setup(p => p.GetByHumanName(userName)).Returns(Task.FromResult(game));

            _startService = new StartService(_mockGameRepository.Object, null, null, null);
            SearchGameStartView result = _startService.SearchGame(userName).Result;

            Assert.That(result.IsGameExist, Is.EqualTo(false));
        }
예제 #5
0
        public override void ExecuteUserChoice()
        {
            // Sign Up functionality
            StartService startService = new StartService(ref Repo);
            // 1: Ask for email
            string newEmail = UserRequestUtility.QueryEmail();

            // 2: check if email matches with any other customer
            if (startService.DoesUserExistWithEmail(newEmail))
            {
                Console.WriteLine("That email already exists for a user of the program. You really should be logging in instead. \n Taking you back to the start..");
                MenuManager.Instance.ReadyNextMenu(new StartMenu(ref Repo));
                return;
            }

            // 3: ask for password, then name and address
            string newPassword = UserRequestUtility.QueryPasswordAndConfirmation();

            string newName = UserRequestUtility.QueryName();

            // When SignUp() ends, add the new customer data to DB/file
            switch (selectedChoice)
            {
            case 1:
                // Update a database with an added customer using BL.
                string newAddress = UserRequestUtility.QueryAddress();

                Customer newCustomer = new Customer(newName, newEmail, newPassword, newAddress);

                CustomerService customerService = new CustomerService(ref Repo);
                customerService.AddCustomerToRepo(newCustomer);
                break;

            case 2:
                Manager newManager = new Manager(newName, newEmail, newPassword);

                ManagerSignUpSubMenu managerSignUpMenu = new ManagerSignUpSubMenu(ref Repo, ref newManager);
                Manager updatedManager = managerSignUpMenu.RunAndReturnManagerWithSelectedLocation();

                ManagerService managerService = new ManagerService(ref Repo);
                managerService.AddManager(updatedManager);

                break;

            default:
                throw new NotImplementedException();
                //break;
            }
            Console.WriteLine("You've now signed up! Now type all that garbage again to login!");
            MenuManager.Instance.ReadyNextMenu(loginMenu);
        }
예제 #6
0
        public IRouter Init()
        {
            var API = new AspNetApi();

            SubscriptionService = new SubscriptionService(API);
            StartService        = new StartService(API);
            AggregationService  = new AggregationService(API);
            RateService         = new RateService(API);
            ChartService        = new ChartService(API);

            var router = new Router(new RouteExpressionParser());

            _bindRoutes(router);
            return(router);
        }
예제 #7
0
        private void ServiceContextActionButton_Click(object sender, EventArgs e)
        {
            ServiceParameters ServiceParams = new ServiceParameters();

            ServiceParams.ServiceName = SelectedService;
            NetworkParameters NetParams = new NetworkParameters();

            NetParams.RemoteSystemName = MachineName;
            RemoteExecutionManager RemoteExec = new RemoteExecutionManager();

            if (ServiceAction == ServiceActionType.StartService)
            {
                StartService Start = new StartService();
                Start.ServiceParameters = ServiceParams;

                RemoteExec.Command   = Start;
                RemoteExec.NetParams = NetParams;
                IResult StartResult = RemoteExec.Execute();
                if (StartResult.Result == ExecutionResultType.Passed)
                {
                    MessageBox.Show(SelectedService + " has been successfully started on the remote machine " + MachineName, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshServiceList();
                }
                else
                {
                    MessageBox.Show("Failed to start the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StartResult.FailureException.Message, "Start Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            if (ServiceAction == ServiceActionType.StopService)
            {
                StopService Stop = new StopService();
                Stop.ServiceParameters = ServiceParams;
                RemoteExec.Command     = Stop;
                RemoteExec.NetParams   = NetParams;
                IResult StopResult = RemoteExec.Execute();
                if (StopResult.Result == ExecutionResultType.Passed)
                {
                    MessageBox.Show(SelectedService + " has been successfully stopped on the remote machine " + MachineName, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    RefreshServiceList();
                }
                else
                {
                    MessageBox.Show("Failed to stop the service " + SelectedService + " on the remote machine " + MachineName + " due to the following reason : " + StopResult.FailureException.Message, "Stop Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #8
0
        public void StartService()
        {
            string expected = File.ReadAllText(Path.Combine(_requestsTestDataPath, "StartService.xml"));
            var    request  = new StartService
            {
                SessionId = "sid",
                Service   = TServiceType.POP3
            };
            var xml = request.ToXml().InnerXmlFormatted();

            Assert.AreEqual(expected, xml);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(File.ReadAllText(Path.Combine(_responsesTestDataPath, "StartService.xml")));
            var response = request.FromHttpRequestResult(new HttpRequestResult {
                Response = doc.InnerXml
            });

            Assert.AreEqual("result", response.Type);
            Assert.True(response.Success);
        }
예제 #9
0
        public StartDialogViewModel(StartService loginService, EventAggregator eventAggregator)
        {
            this.loginService = loginService;

            eventAggregator.GetEvent <CloseStartDialogEvent>().Subscribe(OnCloseDialog);
        }
예제 #10
0
 public void StartService(StartService cmd)
 {
     _controllers[cmd.ShelfName].Start();
 }