예제 #1
0
        public void GenerateAssembleKeys()
        {
            IConfigProxy configProxy = new ConfigProxy(null);
            IKeyProxy keyProxy = new KeyProxy(null, null);
            var count = keyProxy.SearchKeys(new KeySearchCriteria() { KeyState = KeyState.Fulfilled }).Count;
            if (count > 0) {
                var newTest = new Test() {
                    TestName = AssembleKeyName,
                    IsPositive = true,
                    TestStatus = TestStatus.Ready,
                };
                repository.InsertTest(newTest);

                if (testPramertersSection.Count > 0) {
                    var newTestParameters = new List<TestParameter>();
                    for (int i = 0; i < testPramertersSection.Count; i++) {
                        var newTestParameter = new TestParameter() {
                            TestId = newTest.TestId,
                            Index = i,
                            Name = testPramertersSection.GetKey(i),
                            Value = testPramertersSection.Get(i),
                        };
                        newTestParameters.Add(newTestParameter);
                    }
                    repository.InsertTestParameters(newTestParameters);
                }
            }
        }
예제 #2
0
        private void Login()
        {
            IsBusy = true;
            WorkInBackground((s, e) =>
            {
                try
                {
                    IUserProxy userProxy = new UserProxy();
                    KmtConstants.LoginUser = userProxy.Login(LoginId, Password);
                    if (KmtConstants.LoginUser != null)
                    {
                        MessageLogger.LogOperation(KmtConstants.LoginUser.LoginId, "Logged in.");

                        IConfigProxy configProxy = new ConfigProxy(KmtConstants.LoginUser);
                        KmtConstants.OldTimeline = configProxy.GetOldTimeline();

                        IHeadQuarterProxy headQuarterProxy = new HeadQuarterProxy();

                        var headQuarters = headQuarterProxy.GetHeadQuarters(KmtConstants.LoginUser);
                        if (headQuarters.Count > 0)
                        {
                            KmtConstants.CurrentHeadQuarter = headQuarters.Single(
                               hq => hq.UserHeadQuarters.First().IsDefault);
                        }

                        Dispatch(() =>
                        {
                            Thread.CurrentThread.CurrentUICulture = KmtConstants.CurrentCulture;
                            Thread.CurrentThread.CurrentCulture = KmtConstants.CurrentCulture;
                            MainWindow mainWindow = new MainWindow();
                            View.Close();
                            mainWindow.Show();
                        });
                    }
                    IsBusy = false;
                }
                catch (Exception ex)
                {
                    IsBusy = false;
                    ex.ShowDialog();
                    ExceptionHandler.HandleException(ex);
                }
            });
        }