예제 #1
0
 private void ButtonLogOut_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Log out?", "Log out", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         LogOut?.Invoke(this, EventArgs.Empty);
     }
 }
        public static async Task <T> GetObjectFor <T>(HttpResponseMessage response)
        {
            if (response.IsSuccessStatusCode)
            {
                var serialized = await response.Content.ReadAsStringAsync();

                return(JsonConvert.DeserializeObject <T>(serialized));
            }
            else if (response.StatusCode == System.Net.HttpStatusCode.BadRequest)
            {
                var errorMessage = await GetErrorMessage(response);

                string displayMessage = GetDisplayMessage(errorMessage);
                if (!string.IsNullOrWhiteSpace(displayMessage))
                {
                    UserDialogsHelper.ShowNotification(displayMessage.ToString(), NotificationTypeEnum.Error, TimeSpan.FromSeconds(3));
                }
            }
            else if (response.StatusCode == System.Net.HttpStatusCode.Unauthorized)
            {
                LogOut?.Invoke(httpResponsHelper, new EventArgs());
            }
            else if (response.StatusCode == System.Net.HttpStatusCode.Forbidden)
            {
                UserDialogsHelper.ShowNotification("There was an error in processing your request.", NotificationTypeEnum.Error);
            }
            else if (!response.IsSuccessStatusCode)
            {
                UserDialogsHelper.ShowNotification("There was an error while fetching data.", NotificationTypeEnum.Error);
            }
            return(default(T));
        }
예제 #3
0
        public async Task <ResponseModel> LogOut([FromBody] LogOut request)
        {
            if (!ModelState.IsValid)
            {
                return(Response(400, null, INVALID_PARAMETER));
            }
            if (request.Status == 2)
            {
                return(Response(400, null, "Error can't log out"));
            }
            var user = await userService.GetUserById(request.Id);

            if (user == null)
            {
                return(Response(400, null, "User not found."));
            }
            // add transaction for signout type
            await transactionService.AddTransaction(new Transaction()
            {
                UserId = user.Id, Type = TransactionType.SIGNOUT, Remark = $"status = {request.Status}"
            });

            return(Response(200, new ResponseData()
            {
                statusMessage = "LogOut success."
            }));
        }
예제 #4
0
 public void ClickOnLogout()
 {
     if (LogOut.Displayed)
     {
         LogOut.Click();
         Thread.Sleep(3000);
     }
     else
     {
         throw new Exception("Element is not found or not clickable");
     }
 }
예제 #5
0
 public void Log(string msg, int i = -1, bool vital = true)
 {
     wr.WriteLine(msg);
     LogOut?.Invoke(msg, vital);
     if (i != -1)
     {
         string line = GenLine(i);
         wr.WriteLine(line);
         LogOut?.Invoke(line, vital);
     }
     wr.WriteLine("");
     LogOut?.Invoke("", vital);
 }
        private LoggedOut UnregisterPlayer(LogOut logOut)
        {
            _playerModels.Remove(logOut.PlayerId);

            if (_gameStarted)
            {
                _multiplayerScene.DespawnPlayer(logOut.PlayerId);
            }

            EventManager.Singleton.Publish(GameEventType.PlayerUnregistered, logOut.PlayerId);

            Debug.LogFormat("MULTIPLAYER_MANAGER::Player {0} unregistered", logOut.PlayerId);
            return(new LoggedOut());
        }
예제 #7
0
        public void PlanSave()
        {
            SaveButton("Save").Clicks(); WaitforIt(Properties.InactivePhase);

            SavedElement.WaitUntil();

            Assert.That(SavedElement, Is.Not.Null);

            Assert.That(PlanStatus("New").Displayed);

            LogOut.Clicks(); WaitforIt(Properties.InactivePhase);

            Login("automationuser1", "eMos123!");

            RePlanLog(); WaitforIt(Properties.InactivePhase); //WaitforIt(Properties.InactivePhase);
        }
예제 #8
0
        public async Task <NiconicoSignInStatus> SignOut()
        {
            NiconicoSignInStatus result = NiconicoSignInStatus.Failed;

            using (var releaser = await SigninLock.LockAsync())
            {
                UserId      = null;
                UserName    = null;
                UserIconUrl = null;

                IsLoggedIn = false;

                UpdateServiceStatus();

                if (Context == null)
                {
                    return(result);
                }

                try
                {
                    if (Helpers.InternetConnection.IsInternet())
                    {
                        result = await Context.SignOutOffAsync();
                    }
                    else
                    {
                        result = NiconicoSignInStatus.Success;
                    }

                    Context.Dispose();
                }
                finally
                {
                    Context = new NiconicoContext();

                    _UserId = null;
                }
            }

            LogOut?.Invoke(this, EventArgs.Empty);

            return(result);
        }
예제 #9
0
        public void LogApprove()

        {
            WaitforIt(Properties.InactivePhase); SaveButton("Approve Log").WaitUntil();

            SaveButton("Approve Log").Clicks();

            SavedElement.WaitUntil();

            Assert.That(SavedElement, Is.Not.Null);

            Assert.That(PlanStatus("Log Approved").Displayed);

            LogOut.Clicks(); WaitforIt(Properties.InactivePhase);

            Login("automationuser3", "eMos123!");

            RePlanLog(); WaitforIt(Properties.InactivePhase);
        }
예제 #10
0
        public void PlanApprove(string userName)

        {
            WaitforIt(Properties.InactivePhase); SaveButton("Approve").WaitUntil();

            SaveButton("Approve").Clicks();

            SavedElement.WaitUntil();

            Assert.That(SavedElement, Is.Not.Null);

            Assert.That(PlanStatus("Plan Approved").Displayed);

            LogOut.Clicks(); WaitforIt(Properties.InactivePhase);

            Login(userName, "eMos123!");

            RePlanLog(); WaitforIt(Properties.InactivePhase);
        }
예제 #11
0
        public void DashboardShare()

        {
            ComplianceHeatMap(); WaitforIt(Properties.LittlePause);

            DashboardGear.Clicks(); AdminSettings.Clicks(); WaitforIt(Properties.LittlePause);

            CopyfromAdmin("Shared", "share").Clicks(); WaitforIt(Properties.LittlePause);

            DahsboardSelect("Shared").Clicks();

            SelectUser.SelectDropdown("Automation User 2");

            AddUser.Clicks(); SaveShare.Clicks();

            LogOut.Clicks();

            PlanLog.Login("automationuser2", "eMos123!"); WaitforIt(Properties.LittlePause);

            DashboardTab.Clicks();
        }
예제 #12
0
 private void OnLogoutTapped()
 {
     LogOut?.Invoke();
     Present(_loginVC);
 }
 public LogOutViewModel(LogOut logoutWindow)
 {
     _logOUtWindow  = logoutWindow;
     _posRepository = SettingHelpers.GetRepositoryImplementation();
 }
예제 #14
0
 private void OnLogOut(object input)
 {
     LogOut?.Invoke(this, EventArgs.Empty);
 }
예제 #15
0
 public void UserNotRegisteredTest()
 {
     Assert.Throws <ErrorMessageException>(() => LogOut.Logout(UserId_Nati));
 }
        public void ReadFromStateFile(string Path)
        {
            string line;
            string FunctionName;

            try
            {
                int          userId = CreateAndGetUser.CreateUser();
                StreamReader sr     = new StreamReader(Path + ".txt");
                line = sr.ReadLine();
                while (line != null)
                {
                    string[] funcAndParam = line.Split(':');
                    FunctionName = funcAndParam[0].Trim();
                    string[] param = funcAndParam[1].Split(',');
                    switch (FunctionName)
                    {
                    case "Login":
                    {
                        LogIn.Login(param[0], param[1], userId);
                        break;
                    }

                    case "Register":
                    {
                        Register.Registration(param[0], param[1], userId);
                        break;
                    }

                    case "SaveProductToCart":
                    {
                        SaveProductToCart.SaveProduct(int.Parse(param[0]), userId, int.Parse(param[1]));
                        break;
                    }

                    case "Edit":
                    {
                        WatchAndEdit.Edit(param[0], int.Parse(param[1]), userId);
                        break;
                    }

                    case "Logout":
                    {
                        LogOut.Logout(userId);
                        break;
                    }

                    case "OpenStore":
                    {
                        OpenStore.openStore(param[0], userId);
                        break;
                    }

                    case "AssignStoreOwner":
                    {
                        AssignStoreOwner.assignStoreOwner(userId, param[1], param[2]);
                        break;
                    }

                    case "AssignStoreManager":
                    {
                        string[] boolArray  = param[3].Split(';');
                        bool[]   privileges = new bool[7];
                        int      index      = 0;
                        foreach (string X in boolArray)
                        {
                            if (X.Equals("T"))
                            {
                                privileges[index] = true;
                            }
                            else
                            {
                                privileges[index] = false;
                            }

                            index++;
                        }

                        AssignStoreManager.AsssignManager(userId, param[1], param[2], privileges);
                        break;
                    }

                    case "RemoveStoreManager":
                    {
                        RemoveStoreManager.removeStoreManager(userId, param[1], param[2]);
                        break;
                    }

                    case "AcceptAppointment":
                    {
                        HandlerRequestAppointment.AcceptAppointment(param[0], userId, param[2]);
                        break;
                    }

                    case "DeclineAppointment":
                    {
                        HandlerRequestAppointment.DeclineAppointment(param[0], userId, param[2]);
                        break;
                    }

                    case "RemoveUserFromSystem":
                    {
                        RemoveUserFromSystem.RemoveUser(userId, param[1]);
                        break;
                    }
                    }

                    line = sr.ReadLine();
                }
                sr.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
예제 #17
0
        /// <inheritdoc/>
        public void HandlePacket(Player player, Span <byte> packet)
        {
            LogOut message = packet;

            this.logoutAction.Logout(player, (LogoutType)message.Type);
        }
 private void executeLogOutCommand()
 {
     LogOut?.Invoke(this, new EventArgs());
 }
예제 #19
0
 public void UserNotLoggedInTest()
 {
     Register.Registration("nati", "1111111", UserId_Nati);
     Assert.Throws <ErrorMessageException>(() => LogOut.Logout(UserId_Nati));
 }
예제 #20
0
 private void UserSettingPage_LogOut(object sender, EventArgs e)
 {
     LogOut?.Invoke(this, EventArgs.Empty);
 }
예제 #21
0
        public void ProcessRequest(HttpContext Context)
        {
            #region 阻止缓存
            Context.Response.Clear();
            Context.Response.ClearHeaders();
            Context.Response.ClearContent();
            Context.Response.ContentType = "text/html";

            //页面后退刷新的关键
            Context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Context.Response.Cache.SetNoStore();
            #endregion

            #region 定义变量
            //请求文件 /imageslib/a.jpg
            string imagefile = Context.Request.Path;
            #endregion

            #region 跳转判断
            //来源判断
            Uri url = Context.Request.UrlReferrer;

            if (url != null)
            {
                string refurl = url.ToString().ToLower();

                if (!string.IsNullOrEmpty(refurl))
                {
                    LogOut.Info("UrlReferrer:" + refurl);

                    if (refurl.Contains("facebook.com"))
                    {
                        //获取图片
                        FBImageInfo image = FBCommon.GetFBImageInfo(imagefile, imageDataPath);

                        if (image != null)
                        {
                            if (image.ImageSkipUrl != "skipurl")
                            {
                                #region 记录日志
                                LogOut.Info(("Images:" + imagefile).PadRight(100) + "," + url.ToString());
                                #endregion

                                #region 301 跳转
                                //301跳转方式
                                Utils.SetURL301(Context, image.ImageSkipUrl);
                                #endregion

                                #region 脚本跳转
                                //响应脚本跳转
                                //Context.Response.ContentType = "application/x-javascript";
                                //Context.Response.ContentType = "text/html";
                                //Context.Response.Write(Common.ReadTextToendByUTF8(js));
                                //VTSCommon.TraceLog("图片:" + imagefile + "," + url.ToString(), logPath, true, null);
                                //Context.Response.End();
                                #endregion
                            }
                        }
                    }
                }
            }
            #endregion

            #region 展示图片
            string filePath = Context.Server.MapPath(imagefile);//Context.Request.PhysicalPath;

            if (File.Exists(filePath))
            {
                InitContentType(Context, filePath);
                int Length;
                Context.Response.OutputStream.Write(CacheImage(filePath, out Length), 0, Length);
            }
            else
            {
                Context.Response.ContentType = "text/html";
                Context.Response.Write("No found!");
            }
            #endregion
        }
예제 #22
0
파일: log.cs 프로젝트: RyogaMasaki/dumpster
 private uint add(LogOut newlog)
 {
     this.hndlptr++;
     this._outputs.Add(this.hndlptr, newlog);
     return hndlptr;
 }
예제 #23
0
 public void DoubleLogOutTest()
 {
     Assert.AreEqual(LogOut.Logout(UserId_Orel), true);
     Assert.Throws <ErrorMessageException>(() => LogOut.Logout(UserId_Orel));
 }
예제 #24
0
파일: log.cs 프로젝트: drojaazu/dumpster
        public uint Open()
        {
            var newlog = new LogOut();

            return(this.add(newlog));
        }
예제 #25
0
 private void buttonLogOut_Click(object sender, EventArgs e)
 {
     LogOut?.Invoke();
 }
예제 #26
0
파일: log.cs 프로젝트: drojaazu/dumpster
 private uint add(LogOut newlog)
 {
     this.hndlptr++;
     this._outputs.Add(this.hndlptr, newlog);
     return(hndlptr);
 }
예제 #27
0
        //[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\\Bag_Receipt_Data\\Bag_Receipt.csv", "Bag_Receipt#csv", DataAccessMethod.Sequential), TestMethod]
        public void CodedUITestMethod1()
        {
            Log.Write("Test Case Execution Started");
            Log.Write("==========================================================");
            Log.Write("\n");
            for (int testcaseCount = 1; testcaseCount < Users.listA.Count; testcaseCount++)
            {
                Log.Write("Test Case:" + testcaseCount);
                Log.Write("-----------------------------------------------------------");
                try
                {
                    string aTMID = Users.listA[testcaseCount];


                    if (Users.listA[testcaseCount].Length > 2)
                    {
                        aTMID = Users.listA[testcaseCount].Substring(1, 4);
                    }

                    string operations = Users.listC[testcaseCount];
                    if (operations.Contains("Logout"))
                    {
                        operations = Users.listC[testcaseCount].Substring(1, 6);
                    }

                    else
                    {
                        operations = Users.listC[testcaseCount].Substring(1, 8);
                    }

                    string date = Users.listB[testcaseCount];
                    if (Users.listB[testcaseCount].Length > 2)
                    {
                        date = Users.listB[testcaseCount].Substring(1, 10);
                    }
                    if (aTMID.Length > 2)
                    {
                        aTMID = aTMID.Substring(0, 4);
                    }
                    this.UIMap.Bag_ReciptParams.UIItemEditText = aTMID;
                    this.UIMap.Bag_ReciptParams.UIItemListSelectedItemsAsString = date;

                    if (operations == "Fill ATM")
                    {
                        try
                        {
                            if (counter == 0)
                            {
                                //Process.Start(@"D:\ImageMark\bin\TskMgrOI.exe");
                                //this.UIMap.ListItemABMDEP3();
                                //this.UIMap.ListItemATMAdmin();
                                //System.Threading.Thread.Sleep(5000);
                            }

                            this.UIMap.Bag_Recipt();
                            Log.Write("Test Case:" + testcaseCount + "succeed");
                            Log.Write("-----------------------------------------------------------");
                            Log.Write("\n");
                            counter++;
                        }
                        catch (Exception ex)
                        {
                            Log.Write("Test case:" + testcaseCount + "Encountered Exception For ATM Already been processed or for Invalid ATM");
                            Log.Write("-----------------------------------------------------------");
                            Log.Write("\n");
                            counter++;
                            ExtraControls objExtraControls = new ExtraControls();

                            bool noRecordFound = objExtraControls.NoRecordFoundText();
                            if (noRecordFound == true)
                            {
                                Log.Write("No Record for the ATM found or ATM already been processed");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                                objExtraControls.NoRecordFoundOkBtn();
                            }

                            iNVALIDaTM objiNVALIDaTM = new iNVALIDaTM();
                            bool       invalidAtm    = objiNVALIDaTM.InvlidAtmText();
                            if (invalidAtm == true)
                            {
                                Log.Write("ATM is InValid");
                                Log.Write("-----------------------------------------------------------");
                                Log.Write("\n");
                                objiNVALIDaTM.InvlidAtmBtn();
                            }
                        }
                    }

                    else if (operations == "Logout")
                    {
                        Log.Write("==========================================================");
                        Log.Write("Logout");
                        Log.Write("==========================================================");
                        LogOut objLogOut = new LogOut();
                        objLogOut.LogOut1();
                        //ExitApplication objExitApplication = new ExitApplication();
                        //objExitApplication.CloseApplication();
                        //System.Threading.Thread.Sleep(1000);
                        //objExitApplication.ConfirmationYes();
                    }
                }
                catch (Exception ex)
                {
                    Log.Write("test Case:" + testcaseCount + "Failed");
                    Log.Write(ex.ToString());
                    Log.Write("-----------------------------------------------------------");
                    Log.Write("\n");
                    continue;
                }
            }
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see http://go.microsoft.com/fwlink/?LinkId=179463
            Log.Write("==========================================================");
            Logger.Log.Write("Test case execution completed");
            Log.Write("\n");
            Log.Write("==========================================================");
            Log.Write("File Closed");
            Log.Write("==========================================================");
            Logger.Log.CloseFile();
        }
예제 #28
0
        private void bunifuFlatButton1_Click(object sender, EventArgs e)
        {
            LogOut newForm = new LogOut();

            newForm.ShowDialog();
        }
예제 #29
0
 public void LogoutUser()
 {
     LogOut.Click(LogIn.WaitForAppear);
 }
예제 #30
0
파일: log.cs 프로젝트: RyogaMasaki/dumpster
 public uint Open()
 {
     var newlog = new LogOut();
     return this.add(newlog);
 }
예제 #31
0
 public void SuccessLogOutTest()
 {
     Assert.AreEqual(LogOut.Logout(UserId_Orel), true);
 }