Example #1
0
 private Actions(PurchaseActions pActions, UserActions uActions, StoreActions sActions, NotificationManager notification)
 {
     Purchase     = pActions;
     User         = uActions;
     Store        = sActions;
     Notification = notification;
 }
Example #2
0
        public void AuthenticateUser_4()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("aA!12345");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            DataSet GotOutput;

            try
            {
                GotOutput = new SecurityDataLayer(UserProfileObj).GetUserToken();
            }
            catch (Exception)
            {
                GotOutput = null;
            }
            Assert.AreEqual(int.Parse(GotOutput.Tables[0].Rows[0][0].ToString()) > 0, true);
        }
        public void Post([FromBody] MUser value)
        {
            UserActions ua = new UserActions();

            value.Role_FK = 3;
            ua.AddUser(value);
        }
Example #4
0
    //牌を引く
    private int DrawCard(int turn, AI[] ai, bool usual)
    {
        if (usual)
        {
            hands[turn].Add(deck.DrawCard());      //手番のプレイヤーの手牌に追加
        }
        else
        {
            hands[turn].Add(deck.DrawKanCard()); //手番のプレイヤーの手牌に追加
        }
        ShowOrHideHand_Only(turn);               //手番プレイヤーの手牌を表示

        if (turn == 0 && UserActions.Playing())
        {
            UserActions.SelectingDiscard();

            if (AI.CanClosedKan(hands[0]).Count >= 1)
            {
                UserActions.canClosedKan = true;
            }
            if (AI.CanAddKan(hands[0], calls[0]).Count >= 1)
            {
                UserActions.canAddKan = true;
            }

            return(AI.WAIT_INPUT);
        }
        else
        {
            return(ai[turn].DecideDiscardOrKan(hands[turn], calls[turn]));
        }
    }
Example #5
0
        protected void PerformAction(UserActions action)
        {
            switch (action)
            {
            case UserActions.Help:
                userNeedsDirections = true;
                break;

            case UserActions.Create:
                CreateTask();
                break;

            case UserActions.Display:
                Display();
                break;

            case UserActions.Complete:
                CompleteTask();
                break;

            case UserActions.Load:
                //list = file.Load(input.Arguments);
                break;

            case UserActions.Save:
                file.Save(list, input);
                break;
            }
        }
Example #6
0
 private void CompleteAction(UserActions action)
 {
     if (!isVolatile && stateMachine.SetSystemState(action))
     {
         ModifyPage(stateMachine.GetSystemState());
     }
 }
 public void Ti_PL()
 {
     if (((phases.GetTurn() + 1) % 4 == 0 && UserActions.Playing()))
     {
         Ti();
     }
 }
Example #8
0
        // GET: User
        public ActionResult Index()
        {
            var userBL   = new UserActions();
            var userData = userBL.UserList();

            return(View(userData));
        }
    //ポン
    private void Pon()
    {
        if (callPlayer == 0 && UserActions.Playing())
        {
            if (cards.Pon(phases.GetTurn(), callPlayer, AI.Bonus5(UserActions.GetIndexOnly())) == false)
            {
                return;
            }

            methodsTimer.Reset();
        }
        else
        {
            cards.Pon(phases.GetTurn(), callPlayer, ai[callPlayer].GetUseBonusCardForPon());
            methodsTimer.AddTimer(Discard, Times.Wait_DrawToDiscard());
        }
        phases.ChangeTurn_Call(callPlayer);
        UserActions.ResetCanCall();
        UserActions.ResetSelect();

        if (callPlayer == 0 && UserActions.Playing())
        {
            UserActions.SelectingDiscard();
        }
    }
        public void GetTokenList_4()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            UserProfileObj.SetPassword("aA!12345");
            List <string> TokenList = null;

            try
            {
                TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
                if (TokenList.Count == 0)
                {
                    // token count = 0 means that the account is not logged in or all sessions destroyed
                    // generate the token
                    LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                    TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
                }
            }
            catch (Exception)
            {
                TokenList = null;
            }
            Assert.AreEqual(TokenList.Count > 0, true);
        }
Example #11
0
        private async Task AssignRole(Cacheable <IUserMessage, ulong> cacheable, SocketReaction reaction,
                                      IGuildUser user, UserActions action)
        {
            string message;

            switch (action)
            {
            case UserActions.ClassC:
                await user.AddRoleAsync(user.Guild.GetRole(_classCRoleId));

                message = $"**Přijat nový člen {user.Mention}!** [{user.Id}]\n" +
                          $"```{cacheable.Value.Content}```";
                break;

            case UserActions.Int:
                await user.AddRoleAsync(user.Guild.GetRole(_intRoleId));

                message = $"**Přijat nový *INT* člen {user.Mention}!** [{user.Id}]\n" +
                          $"```{cacheable.Value.Content}```";
                break;

            case UserActions.Underage:
                message = $"**Uživatel {user.Mention} pod věkovou hranicí!** [{user.Id}]\n" +
                          $"```{cacheable.Value.Content}```";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(action), action, null);
            }

            await reaction.Message.Value.DeleteAsync();

            await((ISocketMessageChannel)_client.GetChannel(_loggingChannelId)).SendMessageAsync(message);
            Logger.LogInformation("{ReactionUser} made action in #welcome: {Message}", reaction.User, message);
        }
        public void OrderDetailsByTypeAndStatus_10()
        {
            IUserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("Root@123");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            IOrder OrderObj = new Order();

            OrderObj.SetOrderType("Individual");
            OrderObj.SetStatusName("ABCD");
            IOrderDetailsDataLayer OrderDetailsDataLayerObj = new OrderDetailsDataLayer(UserProfileObj, OrderObj);
            DataSet Output = OrderDetailsDataLayerObj.FetchOrderDetailsByTypeAndStatus();

            Assert.AreEqual(Output.Tables[0].Rows.Count == 0, true);
        }
Example #13
0
        public List <UserActions> GetUserActions
            (List <FileEmployee> fileEmployees, FileDayActions dayActions)
        {
            var ids    = new List <string>();
            var result = new List <UserActions>();

            foreach (var employee in fileEmployees)
            {
                ids.Add(employee.EmployeeId);
            }

            var dbEmployees = _context.Employees
                              .Where(e => ids.Contains(e.EmployeeId))
                              .ToList();

            foreach (var userActions in dayActions.UsersActions)
            {
                var newUserActions = new UserActions(userActions);

                newUserActions.Employee = dbEmployees.Where
                                              (e => e.EmployeeId == userActions.EmployeeId).Single();

                result.Add(newUserActions);
            }

            return(result);
        }
Example #14
0
        public void Post([FromBody] MUser value)
        {
            UserActions ua = new UserActions();

            value.Role = "Зареєстрований";
            ua.AddUser(value);
        }
        public void OrderDetailsByTypeAndStatus_9()
        {
            int          ExpectedOutput = -2;
            int          GotOutput      = 0;
            IUserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("Root@123");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            IOrder OrderObj = new Order();

            OrderObj.SetOrderType("Individual");
            OrderObj.SetStatusName("");
            IOrderDetailsDataLayer OrderDetailsDataLayerObj = new OrderDetailsDataLayer(UserProfileObj, OrderObj);

            try
            {
                DataSet Output = OrderDetailsDataLayerObj.FetchOrderDetailsByTypeAndStatus();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
Example #16
0
        private void GenerateIncidence()
        {
            try
            {
                User   user = UserActions.GetUser();
                string valId;
                Console.WriteLine("GET PENDING VALIDATION");
                Console.WriteLine("----------------------");

                ListPendingValidations(user);
                Console.WriteLine("INSERT PENDING TO VALIDATE SERVICE ID OR BLANK TO EXIT : ");
                valId = Console.ReadLine().ToUpper();
                if (String.IsNullOrWhiteSpace(valId))
                {
                    ShowServicesMenu();
                    return;
                }
                if (CommonLib.ValidateNumEntrance(valId))
                {
                    IncidenceDetails(long.Parse(valId));
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Example #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IUserProfile            UserProfileObj = new UserProfile();
        UserProfileMenuResponse ProfileMenu    = new UserProfileMenuResponse();

        try
        {
            ProfileMenu.IsProfileAvailable = false;
            if (CookieProxy.Instance().HasKey("t"))
            {
                UserProfileObj.SetToken(CookieProxy.Instance().GetValue("t").ToString());
                if (CookieProxy.Instance().HasKey("um"))
                {
                    ProfileMenu = new UserActions(UserProfileObj).GetProfileMenu(CookieProxy.Instance().GetValue("um").ToString());
                }
                else
                {
                    ProfileMenu = new UserActions(UserProfileObj).GetProfileMenu(null);
                }
                if (ProfileMenu.ShouldReupdate)
                {
                    RemoveProfileCookie();
                    ProfileMenu = new UserActions(null).GetProfileMenu(null);
                }
                CookieProxy.Instance().SetValue("um", new JavaScriptSerializer().Serialize(ProfileMenu), DateTime.Now.AddDays(2));
            }
        }
        catch (Exception ex)
        {
            ProfileMenu.IsProfileAvailable = false;
        }

        Response.Write(new JavaScriptSerializer().Serialize(ProfileMenu));
    }
Example #18
0
        public ActionResult Create(User obj)
        {
            var userBL = new UserActions();

            userBL.AddUser(obj);
            return(RedirectToAction("Index"));
        }
Example #19
0
    //チー
    private void Ti()
    {
        int tiPlayer = (phases.GetTurn() + 1) % 4;

        if (tiPlayer == 0 && UserActions.Playing())
        {
            if (cards.Ti(phases.GetTurn(), UserActions.handIndexes_forCall) == false)
            {
                return;
            }

            UserActions.ResetSelect();
            methodsTimer.Reset();

            phases.ChangeTurn_Default();

            UserActions.SelectingDiscard();
        }
        else
        {
            cards.Ti(phases.GetTurn(), ai[tiPlayer].GetCallIndexesForTi());
            phases.ChangeTurn_Default();
            methodsTimer.AddTimer(Discard, Times.Wait_DrawToDiscard());
        }

        UserActions.ResetCanCall();
    }
Example #20
0
        private void setPartyCustomActions(bool isgroup, string groupId)
        {
            userService.GetAllUserActionTypes((res, exp) => appController.BeginInvokeOnDispatcher(() =>
            {
                HideBusyIndicator();
                if (exp == null)
                {
                    res.ForEach(c =>
                    {
                        UserActions.Add((int)c, true);
                    });


                    PrivilegeList.Where(all => UserActions.Where(c => c.Value).Select(c => c.Key).Contains((int)all.ActionType))
                    .ToList().ForEach(p => p.IsGrant = true);

                    PrivilegeList.Where(all => UserActions.Where(c => !c.Value).Select(c => c.Key).Contains((int)all.ActionType))
                    .ToList().ForEach(p => p.IsGrant = false);
                }
                else
                {
                    appController.HandleException(exp);
                }
            }), Party.PartyName, isgroup, groupId);

            //PrivilegeList.Where(all => Party.CustomActions.Where(c => c.Value).Select(c => c.Key).Contains(all.ActionType.Id))
            //     .ToList().ForEach(p => p.IsGrant = true);

            // PrivilegeList.Where(all => Party.CustomActions.Where(c => !c.Value).Select(c => c.Key).Contains(all.ActionType.Id))
            //     .ToList().ForEach(p => p.IsDeny = true);
        }
        private void InitEntrypoints(UserActions action)
        {
            ApplicationEntryPoints.Clear();
            switch (action)
            {
            case UserActions.New:
                var rootDirectory = new DirectoryInfo(SelectedFolder.FullPath);
                var entrypoints   =
                    rootDirectory.GetFiles("*.exe")
                    .Union(rootDirectory.GetFiles($"*.{Constants.DeployFileExtension}"))
                    .ToArray();

                foreach (var entrypointFile in entrypoints)
                {
                    ApplicationEntryPoints.Add(ReferenceUtils.GetNormalFilePath(entrypointFile.Name));
                }

                SelectedEntrypoint = entrypoints.Select(entry => entry.Name).FirstOrDefault();
                break;

            case UserActions.Update:
                var entrypoint = SelectedFolder.ApplicationManifest?.EntryPoint;
                if (entrypoint != null)
                {
                    ApplicationEntryPoints.Add(entrypoint.TargetPath);
                    SelectedEntrypoint = entrypoint.TargetPath;
                }
                break;
            }
        }
Example #22
0
        private void ShotWithoutIntellegence(ref UserActions chosenAction)
        {
            do
            {
                UserInterface.ShowMessage(_enemyTurn);
                System.Threading.Thread.Sleep(1000);

                if (CheckExit())
                {
                    chosenAction = UserActions.GameOver;
                    break;
                }

                RandomCoords.SearchRandomCoords(_playerMap);
                _isTargetPlayer = _playerMap.HitTarget(ref _isAlivePlayerAfterRigthShoot);

                int cursorLeft = UserInterface.DISTANCE_BETWEEN_MAP;
                int cursorTop  = UserInterface.START_TOP_CURSOR;
                UserInterface.PrintShipPlayer(_playerMap, cursorLeft, cursorTop);
                UserInterface.ShowResultOfShot(_isAlivePlayerAfterRigthShoot, _isTargetPlayer);
                UserInterface.PrintExitSymbol();

                System.Threading.Thread.Sleep(1500);
                bool shipSearched = _playerMap.SearchShips();

                if (!shipSearched)
                {
                    break;
                }
            } while (_isTargetPlayer);
        }
Example #23
0
    // - mors

    public void EditEvent(UserActions EventName)
    {
        if (!Box)
        {
            return;
        }


        switch (EventName)
        {
        case UserActions.Action:
//				Box.UserAction();
            break;

        case UserActions.Come:
            Box.UserStay();
            break;

        // + mors
        case UserActions.Spawn:
            Box.OnSpawn();
            break;
        // - mors

        default:
            return;
        }
    }
Example #24
0
        protected void LoginBtnID_Click(object sender, EventArgs e)
        {
            UserActions regu = new UserActions();

            string s = regu.userLogin(LoginTextBoxID.Text + "@amphorainc.com", PasswordTextBoxID.Text);

            if (s == PasswordTextBoxID.Text)
            {
                Response.Redirect("/Account/Login.aspx");
                //result.Visible = true;
                //result.Text = "Suceesfully retrived data :" + s;
            }
            else if (s == "User is **NOT REGISTERED** yet")
            {
                result.Visible   = true;
                result.ForeColor = System.Drawing.Color.Red;
                result.Text      = s;
            }
            else
            {
                result.Visible   = true;
                result.ForeColor = System.Drawing.Color.RoyalBlue;
                result.Text      = "You have entered **WRONG PASSWORD**";
            }
        }
Example #25
0
        public string Post([FromBody] string value)
        {
            UserActions u1 = new UserActions();
            string      i  = u1.GetUsers().Where(o => o.Login == value).FirstOrDefault().UserID.ToString();

            return(i);
        }
 public HomeController(IndieContext context, UserManager <User> userManager, SignInManager <User> signInManager)
 {
     this.context   = context;
     _userManager   = userManager;
     _signInManager = signInManager;
     actions        = new UserActions();
 }
Example #27
0
 public override void OnDestroy()
 {
     Hide();
     base.OnDestroy();
     UserActions.UnsubscribeAll();
     Finish();
 }
    //Esta función es llamada por los items de los menues contextuales
    void ContextMenuActions(object o)
    {
        //Como GenericMenu.AddItem() pide una función que devuelva void y reciba un object,
        //hay que upcastear de object al tipo de variable u objeto que estas queriendo usar.
        UserActions a = (UserActions)o;

        switch (a)
        {
        case UserActions.addProductNode:
            AddNode <ProductNode>(new Rect(_mousePosition.x, _mousePosition.y, 300, 250), GetNewId());
            break;

        case UserActions.addConnection:
            BeginInteractiveConnectionMode();
            break;

        case UserActions.deleteNode:
            DeleteNode();
            break;

        case UserActions.addComparisonNode:
            AddNode <ComparativeNode>(new Rect(_mousePosition.x, _mousePosition.y, 180, 100), GetNewId());
            break;

        case UserActions.addConnectionAsFalse:
            BeginInteractiveConnectionMode(false);
            break;

        case UserActions.resetScroll:
            ResetScroll();
            break;
        }

        NotifyChangesWereMade();
    }
Example #29
0
    IEnumerator Start()
    {
        _instance = this;

        // create a sample store using the UserState class as a model for the state
        var userStore = new RuxStore <UserState>(UserState.GetDefaultState <UserState>(), new UserProvider());

        // create an instance of our Actions
        var userActions = new UserActions(userStore);

        yield return(new WaitForSeconds(1));

        // subscribe to state changes
        userStore.onStateChanged += (UserState obj) => {
            if (UITextBindings.ContainsKey("Text"))
            {
                UITextBindings["Text"].text = obj.ToString();
            }
            ;
            // Debug.Log("CALLBACK <color=green>" + obj.ToString() + "</color>");
        };


        // fire some actions!
        userActions.Login("adminwrong", "test");
        userActions.Login("adminwrong", "test123123");
        userActions.Login("admin", "test");
        userActions.Login("admin", "test");
    }
        protected override void CreateEvent(UserActions action, CompleteType type)
        {
            var args = new RequestCompleteArgs();

            args.Action          = action;
            args.DisplayResponse = false;
            args.RefreshUI       = false;
            args.LoggedIn        = false;

            if (type == CompleteType.THREAD && action == UserActions.SUCCESS)
            {
                args.Response        = successMessage;
                args.DisplayResponse = true;
                args.RefreshUI       = true;
            }
            else if (type == CompleteType.THREAD && action == UserActions.FAILURE)
            {
                args.Response        = failureMessage;
                args.DisplayResponse = true;
            }
            else
            {
                args.Response        = timeoutMessage;
                args.DisplayResponse = true;
            }

            OnRequestComplete(args);
        }
Example #31
0
    public WebAPI(IRequestSender requestSender)
    {
        requestSender_ = requestSender;

        admin_ = new AdminActions (requestSender);
        appstore_ = new AppstoreActions (requestSender);
        chrome_web_store_ = new ChromeWebStoreActions (requestSender);
        facebook_ = new FacebookActions (requestSender);
        friends_ = new FriendsActions (requestSender);
        google_ = new GoogleActions (requestSender);
        info_ = new InfoActions (requestSender);
        items_ = new ItemsActions (requestSender);
        leaderboards_ = new LeaderboardsActions (requestSender);
        mail_ = new MailActions (requestSender);
        shop_ = new ShopActions (requestSender);
        scripts_ = new ScriptsActions (requestSender);
        tasks_ = new TasksActions (requestSender);
        user_ = new UserActions (requestSender);
        urbanairship_ = new UrbanairshipActions (requestSender);
    }
Example #32
0
        /// <summary>
        /// Add notification about action to db.
        /// </summary>
        /// <param name="userOneId">user one id.</param>
        /// <param name="userTwoId">user two id.</param>
        /// <param name="action">action.</param>
        /// <param name="actionTime">time of action.</param>
        /// <returns>true if operations success; otherwise, false.</returns>
        public static bool AddNotification(int userOneId, int userTwoId, UserActions action, DateTime actionTime)
        {
            using (var DBcontext = new LinqToSqlDataContext())
            {
                // new notification
                Notification newNotification;
                switch (action)
                {
                    case UserActions.AcceptFriendship:
                        newNotification = new Notification
                        {
                            user_one = userOneId,
                            user_two = userTwoId,
                            time = actionTime,
                            accept_friendship = true
                        };
                        break;

                    case UserActions.RejectFriendship:
                        newNotification = new Notification
                        {
                            user_one = userOneId,
                            user_two = userTwoId,
                            time = actionTime,
                            reject_friendship = true
                        };
                        break;

                    case UserActions.SendFriendshipRequest:
                        newNotification = new Notification
                        {
                            user_one = userOneId,
                            user_two = userTwoId,
                            time = actionTime,
                            send_friendship = true
                        };
                        break;

                    case UserActions.CancelFriendshipRequest:
                        newNotification = new Notification
                        {
                            user_one = userOneId,
                            user_two = userTwoId,
                            time = actionTime,
                            cancel_friendship = true
                        };
                        break;

                    case UserActions.RemoveFromFriends:
                        newNotification = new Notification
                        {
                            user_one = userOneId,
                            user_two = userTwoId,
                            time = actionTime,
                            remove_friend = true
                        };
                        break;

                    default:
                        return false;
                }

                DBcontext.Notifications.InsertOnSubmit(newNotification);
                try
                {
                    DBcontext.SubmitChanges();
                    return true;
                }
                catch (Exception e)
                {
                    log.Error(e);
                    return false;
                }
            }
        }
Example #33
0
 public static void Log(int? UserId, UserActions action , string ActionDetails)
 {
     string Ticks = DateTime.Now.Ticks.ToString();
     Log(Ticks, Convert.ToString(UserId), Convert.ToString((int)action), ActionDetails);
 }
 public UserStatus()
 {
     Action		= UserActions.Editing;
     Template	= null;
 }
        //delegate void EndInvokeDelegate(IAsyncResult result);
        // **************************************
        // LogUserEvent: UserActionEvent
        // **************************************
        public static void LogUserEvent(UserActions action)
        {
            var user = Account.User();
            if (SystemConfig.LogUserActions && user != null) {
                var actionEvent = new UserActionEvent() {
                    UserActionId = (int)action,
                    UserId = user.UserId,
                    UserActionEventDate = DateTime.Now,
                    SessionId = CurrentSessionId()
                };

                LogActionEventDelegate<UserActionEvent> logActionEventDelegate = new LogActionEventDelegate<UserActionEvent>(LogEvent);

                logActionEventDelegate.BeginInvoke(actionEvent, null, null);
            }
        }