Beispiel #1
0
        private void refreshProductSummaries(bool fromDatabase)
        {
            if (fromDatabase)
            {
                ClientFunctions.ProductsNotForClient = ClientFunctions.UnlinkedProducts(Globals.SelectedClient.ID);
                ClientFunctions.ProductsForClient    = ClientFunctions.LinkedProducts(Globals.SelectedClient.ID);
            }
            ProductFrom.ItemsSource = ClientFunctions.ProductsNotForClient;
            ProductFrom.Items.SortDescriptions.Clear();
            ProductFrom.Items.SortDescriptions.Add(new SortDescription("ProductName", ListSortDirection.Ascending));
            ProductFrom.Items.Refresh();
            ProductFrom.SelectedItem = null;

            ProductTo.ItemsSource = ClientFunctions.ProductsForClient;
            ProductTo.Items.SortDescriptions.Clear();
            ProductTo.Items.SortDescriptions.Add(new SortDescription("ProductName", ListSortDirection.Ascending));
            ProductTo.Items.Refresh();
            ProductTo.SelectedItem = null;

            disableButtons();
            if (Globals.SelectedClient != null)
            {
                PageHeader.Content = "Products for " + Globals.SelectedClient.ClientName;
            }
        }
Beispiel #2
0
        // Other/shared functions //
        private void refreshClientDataGrid()
        {
            try
            {
                int selectedID = (Globals.SelectedClient != null) ? Globals.SelectedClient.ID : 0;

                clientGridList             = ClientFunctions.ClientGridListByProduct(activeOnly, nameContains, selectedProductID, Globals.CurrentEntityID);
                ClientDataGrid.ItemsSource = clientGridList;
                ClientDataGrid.Items.SortDescriptions.Clear();
                ClientDataGrid.Items.SortDescriptions.Add(new SortDescription("ClientCode", ListSortDirection.Ascending));

                if (selectedID > 0)
                {
                    try
                    {
                        if (clientGridList.Exists(c => c.ID == selectedID))
                        {
                            ClientDataGrid.SelectedItem = clientGridList.First(c => c.ID == selectedID);
                            ClientDataGrid.ScrollIntoView(ClientDataGrid.SelectedItem);
                        }
                    }
                    catch (Exception generalException) { MessageFunctions.Error("Error selecting record", generalException); }
                }

                // refreshClientSummaries(true);
            }
            catch (Exception generalException) { MessageFunctions.Error("Error filling client grid", generalException); }
        }
Beispiel #3
0
        private void refreshClientSummaries(bool fromDatabase)
        {
            if (fromDatabase)
            {
                ClientFunctions.ClientsNotForProduct = ClientFunctions.ClientsWithoutProduct(activeOnly, selectedProductID);
                ClientFunctions.ClientsForProduct    = ClientFunctions.ClientsWithProduct(activeOnly, selectedProductID);
            }

            ClientFrom.ItemsSource = ClientFunctions.ClientsNotForProduct;
            ClientFrom.Items.SortDescriptions.Clear();
            ClientFrom.Items.SortDescriptions.Add(new SortDescription("ClientName", ListSortDirection.Ascending));
            ClientFrom.Items.Refresh();
            ClientFrom.SelectedItem = null;

            ClientTo.ItemsSource = ClientFunctions.ClientsForProduct;
            ClientTo.Items.SortDescriptions.Clear();
            ClientTo.Items.SortDescriptions.Add(new SortDescription("ClientName", ListSortDirection.Ascending));
            ClientTo.Items.Refresh();
            ClientTo.SelectedItem = null;

            disableButtons();
            if (selectedProduct != null)
            {
                PageHeader.Content = "Clients with Product '" + selectedProduct.ProductName + "'";
                if (ClientFrom.Visibility == Visibility.Visible)
                {
                    ProductVersionLabel.Content = "The latest version of " + selectedProduct.ProductName + " is " + selectedProduct.LatestVersion.ToString() + ".";
                }
            }
        }
 private void ClientDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (ClientDataGrid.SelectedItem != null)
         {
             selectedClientGridRecord = (ClientProxy)ClientDataGrid.SelectedItem;
             if (pageMode != PageFunctions.Lookup)
             {
                 ClientFunctions.SelectClient(selectedClientGridRecord.ID);
             }
             ContactButton.IsEnabled = true;
             checkForSingleContact();
         }
         else
         {
             clearClientSelection();
         }
     }
     catch (Exception generalException)
     {
         MessageFunctions.Error("Error processing client grid selection", generalException);
         clearClientSelection();
     }
 }
        private void refreshContactGrid()
        {
            try
            {
                int selectedID = 0;
                if (initialContactID > 0)
                {
                    selectedID       = initialContactID;
                    initialContactID = 0; // Only used at page initiation, so this stops it interfering later
                }
                else if (selectedContactGridRecord != null)
                {
                    selectedID = selectedContactGridRecord.ID;
                }

                contactGridList             = ClientFunctions.ContactGridList(contactContains, contactActiveOnly, Globals.SelectedClient.ID, includeJob: true);
                ContactDataGrid.ItemsSource = contactGridList;
                if (selectedID > 0)
                {
                    try
                    {
                        if (contactGridList.Exists(c => c.ID == selectedID))
                        {
                            ContactDataGrid.SelectedItem = contactGridList.First(c => c.ID == selectedID);
                            ContactDataGrid.ScrollIntoView(ContactDataGrid.SelectedItem);
                        }
                    }
                    catch (Exception generalException) { MessageFunctions.Error("Error selecting the current contact row", generalException); }
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error refreshing client contact details in the grid", generalException); }
        }
Beispiel #6
0
        public WSRequest(HttpContext _InContext, Dictionary <string, WSSecurityMeta> _SecurityMap, ClientFunctions _CFunc)
            : base(_InContext)
        {
            Meta = _SecurityMap.Keys.FirstOrDefault(x => x.Equals(DB)) != null ? _SecurityMap[DB] : null;

            CFunc = _CFunc;
        }
Beispiel #7
0
 private void ClientDataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (ClientDataGrid.SelectedItem != null)
         {
             selectedRecord = (ClientProxy)ClientDataGrid.SelectedItem;
             ClientFunctions.SelectClient(selectedRecord.ID);
             toggleSideButtons(true);
             if (pageMode == PageFunctions.Lookup)
             {
                 CommitButton.IsEnabled = true;
             }
         }
         else
         {
             clearSelection();
         }
     }
     catch (Exception generalException)
     {
         MessageFunctions.Error("Error processing client selection", generalException);
         clearSelection();
     }
 }
Beispiel #8
0
 private void suggestFormat()
 {
     try
     {
         int    avoidID         = (selectedRecord != null) ? selectedRecord.ID : 0;
         string suggestedFormat = ClientFunctions.SuggestCode(selectedEntityID, avoidID, "");
         if (suggestedFormat == "")
         {
             MessageFunctions.InvalidMessage(
                 "A format cannot be suggested as there are too few active client records in this Entity to analyse. Please view other client records manually if unsure.",
                 "Insufficient Data to Suggest Code Format");
             if (CodeSuggestion.Visibility == Visibility.Visible)
             {
                 toggleSuggestionMode(false);
             }                                                                                     // Possible if copying a record to another Entity
         }
         else
         {
             CodeSuggestion.Text    = suggestedFormat;
             SuggestionTips.Text    = ClientFunctions.SuggestionTips;
             CodeSuggestion.ToolTip = ClientFunctions.ExplainCode;
             toggleSuggestionMode(true);
         }
     }
     catch (Exception generalException) { MessageFunctions.Error("Error retrieving suggested code", generalException); }
 }
Beispiel #9
0
        private void addClient()
        {
            try
            {
                if (ClientFrom.SelectedItems != null)
                {
                    List <Clients> addList = new List <Clients>();
                    foreach (var selectedRow in ClientFrom.SelectedItems)
                    {
                        addList.Add((Clients)selectedRow);
                    }

                    bool success = ClientFunctions.ToggleProductClients(addList, true, selectedProduct);
                    if (success)
                    {
                        refreshClientSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error adding client to Product: no client selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error adding client to Product", generalException);
            }
        }
Beispiel #10
0
        private void addProducts()
        {
            try
            {
                if (ProductFrom.SelectedItems != null)
                {
                    List <Products> addList = new List <Products>();
                    foreach (var selectedRow in ProductFrom.SelectedItems)
                    {
                        addList.Add((Products)selectedRow);
                    }

                    bool success = ClientFunctions.ToggleClientProducts(addList, true, Globals.SelectedClient);
                    if (success)
                    {
                        refreshProductSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error adding products to client: no product selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error adding products to client", generalException);
            }
        }
Beispiel #11
0
    public void UserInformation(S.UserInformation p)
    {
        User.gameObject.SetActive(true);
        UserGameObject = Instantiate(WarriorModels[0], User.transform.position, Quaternion.identity);

        User.Player        = UserGameObject.GetComponent <PlayerObject>();
        User.Player.name   = p.Name;
        User.Player.Class  = p.Class;
        User.Player.Gender = p.Gender;
        User.Level         = p.Level;

        GameScene.UpdateCharacterIcon();

        User.Player.CurrentLocation       = new Vector2(p.Location.X, p.Location.Y);
        UserGameObject.transform.position = CurrentScene.Cells[(int)User.Player.CurrentLocation.x, (int)User.Player.CurrentLocation.y].position;

        User.Player.Direction = p.Direction;
        User.Player.Model.transform.rotation = ClientFunctions.GetRotation(User.Player.Direction);

        User.Inventory = p.Inventory;
        User.Equipment = p.Equipment;

        User.BindAllItems();

        Players.Add(p.ObjectID, User.Player);
        User.Player.Camera.SetActive(true);

        Tooltip.cam = User.Player.Camera.GetComponent <Camera>();
    }
Beispiel #12
0
    public void ObjectPlayer(S.ObjectPlayer p)
    {
        MapObject    ob;
        PlayerObject player;

        if (ObjectList.TryGetValue(p.ObjectID, out ob))
        {
            player = (PlayerObject)ob;
            player.CurrentLocation          = new Vector2(p.Location.X, p.Location.Y);
            player.Direction                = p.Direction;
            player.transform.position       = CurrentScene.Cells[p.Location.X, p.Location.Y].position;
            player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction);
            player.Armour = p.Armour;
            player.Weapon = p.Weapon;
            player.gameObject.SetActive(true);
            CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(player);
            return;
        }

        player                          = Instantiate(PlayerModel, CurrentScene.Cells[p.Location.X, p.Location.Y].position, Quaternion.identity).GetComponent <PlayerObject>();
        player.gameManager              = this;
        player.Name                     = p.Name;
        player.ObjectID                 = p.ObjectID;
        player.CurrentLocation          = new Vector2(p.Location.X, p.Location.Y);
        player.Direction                = p.Direction;
        player.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction);
        player.Armour                   = p.Armour;
        player.Weapon                   = p.Weapon;
        ObjectList.Add(p.ObjectID, player);
        CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(player);
    }
        // -------------- Data updates -------------- //



        // --------- Other/shared functions --------- //

        private void setCurrentClient(Clients client, ClientProxy clientProxy = null)
        {
            try
            {
                if (client == null && clientProxy == null)
                {
                    Globals.SelectedClient = null;
                    PageHeader.Content     = defaultHeader;
                    if (!projectSelected)
                    {
                        MessageFunctions.CancelInfoAlert();
                    }
                }
                else
                {
                    if (client == null)
                    {
                        client = ClientFunctions.GetClientByID(clientProxy.ID);
                    }
                    Globals.SelectedClient = client;
                    PageHeader.Content     = defaultHeader + " for Client " + client.ClientCode + " (" + client.ClientName + ")";
                    if (!projectSelected)
                    {
                        MessageFunctions.InfoAlert("This effectively sets the current client to " + client.ClientName + " until the name filter is changed/cleared "
                                                   + " or a different project is selected (the projects drop-down list is unaffected)", "Client " + client.ClientCode + " selected");
                    }
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error processing project client selection", generalException); }
        }
Beispiel #14
0
    public void ObjectNPC(S.ObjectNPC p)
    {
        MapObject ob;
        NPCObject npc;

        if (ObjectList.TryGetValue(p.ObjectID, out ob))
        {
            npc                          = (NPCObject)ob;
            npc.Name                     = p.Name;
            npc.CurrentLocation          = new Vector2(p.Location.X, p.Location.Y);
            npc.Direction                = p.Direction;
            npc.transform.position       = CurrentScene.Cells[p.Location.X, p.Location.Y].position;
            npc.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction);
            npc.gameObject.SetActive(true);
            CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(npc);
            return;
        }

        if (p.Image >= NPCModels.Count)
        {
            npc = Instantiate(NPCModels[0], CurrentScene.Cells[p.Location.X, p.Location.Y].position, Quaternion.identity).GetComponent <NPCObject>();
        }
        else
        {
            npc = Instantiate(NPCModels[p.Image], CurrentScene.Cells[p.Location.X, p.Location.Y].position, Quaternion.identity).GetComponent <NPCObject>();
        }
        npc.Name                     = p.Name;
        npc.ObjectID                 = p.ObjectID;
        npc.CurrentLocation          = new Vector2(p.Location.X, p.Location.Y);
        npc.Direction                = p.Direction;
        npc.Model.transform.rotation = ClientFunctions.GetRotation(p.Direction);
        CurrentScene.Cells[p.Location.X, p.Location.Y].AddObject(npc);
        ObjectList.Add(p.ObjectID, npc);
    }
        // ---------------------- //
        // -- Data Management --- //
        // ---------------------- //

        // Data updates //

        // Data retrieval //

        // Other/shared functions //
        private void refreshClientGrid()
        {
            try
            {
                int selectedID = 0;
                if (Globals.SelectedClient != null)
                {
                    selectedID = Globals.SelectedClient.ID;
                }
                if (selectedID == 0 && selectedClientGridRecord != null)
                {
                    selectedID = selectedClientGridRecord.ID;
                }                                                                                                      // Just in case

                clientGridList             = ClientFunctions.ClientGridListByContact(clientActiveOnly, clientContains, contactContains, Globals.CurrentEntityID);
                ClientDataGrid.ItemsSource = clientGridList;
                ClientDataGrid.Items.SortDescriptions.Clear();
                ClientDataGrid.Items.SortDescriptions.Add(new SortDescription("ClientCode", ListSortDirection.Ascending));

                try
                {
                    if (selectedID != 0 && clientGridList.Exists(c => c.ID == selectedID))
                    {
                        ClientDataGrid.SelectedItem = clientGridList.First(c => c.ID == selectedID);
                        ClientDataGrid.ScrollIntoView(ClientDataGrid.SelectedItem);
                    }
                }
                catch (Exception generalException) { MessageFunctions.Error("Error selecting the current client row", generalException); }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error refreshing client details in the grid", generalException); }
        }
Beispiel #16
0
        public void EnterPrivateSession <S>(WSDataContext db, ClientFunctions CFunc, WSTableSource SessionSrc, WSUserToken _user, string _1MinTicket, ref WSStatus statusLines, bool renew = false) where S : WSDynamicEntity
        {
            try
            {
                if (db != null)
                {
                    if (ExitPrivateSession <S>(db, CFunc, SessionSrc, ref statusLines) && renew && _user.IsValid && ValidateOneMinTicket(_1MinTicket))
                    {
                        try
                        {
                            AuthToken.User = _user;

                            S _session = (S)Activator.CreateInstance(typeof(S), new object[] { });

                            setSession(DateTime.Now, SessionID, AuthToken.User.id, ref _session);

                            db.GetTable <S>().InsertOnSubmit(_session);

                            db.SubmitChanges();

                            Func <S, bool> func = s => s.readPropertyValue(WSConstants.PARAMS.SESSIONID.NAME, "").ToString().ToLower().Equals(SessionID.ToLower());

                            Session = db.GetTable <S>().FirstOrDefault(func);
                        }
                        catch (Exception e) { CFunc.RegError(GetType(), e, ref statusLines); Session = null; }
                    }
                }

                if (Session != null)
                {
                    setAuthToken(Session, ref _AuthToken);
                }
            }
            catch (Exception e) { CFunc.RegError(GetType(), e, ref statusLines); }
        }
Beispiel #17
0
        // ---------------------- //
        // -- Data Management --- //
        // ---------------------- //

        // Data updates //

        // Data retrieval //

        // Other/shared functions //
        private void refreshClientGrid()
        {
            try
            {
                gridList = ClientFunctions.ClientGridList(activeOnly, nameContains, accountManagerID, Globals.CurrentEntityID);
                ClientDataGrid.ItemsSource = gridList;
                if (selectedRecord != null || Globals.SelectedClient != null)
                {
                    try
                    {
                        int selectedID = (selectedRecord != null) ? selectedRecord.ID : Globals.SelectedClient.ID;
                        if (gridList.Exists(c => c.ID == selectedID))
                        {
                            ClientDataGrid.SelectedItem = gridList.First(c => c.ID == selectedID);
                            ClientDataGrid.ScrollIntoView(ClientDataGrid.SelectedItem);
                        }
                        else
                        {
                            Globals.SelectedClient = null;
                        }
                    }
                    catch (Exception generalException) { MessageFunctions.Error("Error selecting the current row", generalException); }
                }
            }
            catch (Exception generalException) { MessageFunctions.Error("Error refreshing client details in the grid", generalException); }
        }
Beispiel #18
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedProductID = Int32.Parse(PageFunctions.pageParameter(this, "ProductID"));
                refreshProductCombo(true);
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            if (pageMode == PageFunctions.View)
            {
                ClientButton.Visibility = Visibility.Hidden;
                Instructions.Content    = "Select a client and click 'Products', or select a product to see its clients.";
            }
            else
            {
                Instructions.Content = activeInstructions;
            }

            CommitButton.Visibility = Visibility.Hidden;
            ClientFrom.Visibility   = ClientTo.Visibility = Visibility.Hidden;
            ClientLabel.Margin      = NameContainsLabel.Margin;
            ClientCombo.Margin      = NameContains.Margin;
            if (!Globals.MyPermissions.Allow("ActivateClientProducts"))
            {
                DisableButton.IsEnabled = false;
                DisableButton.ToolTip   = "Your current permissions do not allow activating or disabling client products";
            }

            if (Globals.SelectedClient != null) // Opened from the Clients Page or Project Products
            {
                fromSource            = Globals.ClientSourcePage;
                ClientCombo.IsEnabled = false; // Cannot easily recreate the same selection list
                refreshClientDataGrid();       // Ensure the record we want is listed, though
                viewProductsByClient();
            }
            else if (selectedProductID > 0) // Opened from Project Products
            {
                fromSource             = Globals.ClientSourcePage;
                ProductCombo.IsEnabled = false; // Cannot easily recreate the same selection list
                refreshClientDataGrid();        // Ensure the record we want is listed, though
                viewClientsByProduct();
            }
            else
            {
                fromSource             = Globals.TilesPageName;
                ClientLabel.Visibility = ClientCombo.Visibility = Visibility.Hidden;
                BackButton.Visibility  = Visibility.Hidden;
                ProductFrom.Visibility = ProductTo.Visibility = Visibility.Hidden;

                AddButton.Visibility    = RemoveButton.Visibility = Visibility.Hidden;
                VersionLabel.Visibility = Version.Visibility = DisableButton.Visibility = Visibility.Hidden;
                FromLabel.Visibility    = ToLabel.Visibility = Visibility.Hidden;
            }
        }
Beispiel #19
0
        private void removeProduct()
        {
            try
            {
                if (ProductTo.SelectedItem != null)
                {
                    List <Products>    removeList  = new List <Products>();
                    ClientProductProxy thisRecord  = (ClientProductProxy)ProductTo.SelectedItem;
                    Products           thisProduct = ProductFunctions.GetProductByID(thisRecord.ProductID);
                    removeList.Add(thisProduct);

                    bool success = ClientFunctions.ToggleClientProducts(removeList, false, Globals.SelectedClient);
                    if (success)
                    {
                        refreshProductSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error removing products from client: no product selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error removing products from client", generalException);
            }
        }
Beispiel #20
0
        private void removeClient()
        {
            try
            {
                if (ClientTo.SelectedItem != null)
                {
                    List <Clients>     removeList = new List <Clients>();
                    ClientProductProxy thisRecord = (ClientProductProxy)ClientTo.SelectedItem;
                    Clients            thisClient = ClientFunctions.GetClientByID(thisRecord.ClientID);
                    removeList.Add(thisClient);

                    bool success = ClientFunctions.ToggleProductClients(removeList, false, selectedProduct);
                    if (success)
                    {
                        refreshClientSummaries(false);
                        CommitButton.IsEnabled = true;
                    }
                }
                else
                {
                    MessageFunctions.Error("Error removing client from Product: no client selected.", null);
                }
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error removing client from Product", generalException);
            }
        }
Beispiel #21
0
 public WSRecordJsonConverter(WSParamList _XParams, WSRequest _Request, ClientFunctions _CFunc, WSDataContext _DBContext, params Type[] _types)
 {
     XParams   = _XParams;
     Request   = _Request;
     CFunc     = _CFunc;
     DBContext = _DBContext;
     types     = _types;
 }
 public ClientProducts ClientProduct()
 {
     if (Product == null || ClientID <= 0)
     {
         return(null);
     }
     return(ClientFunctions.GetClientProduct(ClientID, ProductID));
 }
Beispiel #23
0
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (ClientFunctions.IgnoreAnyChanges())
     {
         clearChanges();
         ClientFunctions.ReturnToTilesPage();
     }
 }
Beispiel #24
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            FirstName.Focus();
            if (!Globals.MyPermissions.Allow("ActivateClientStaff"))
            {
                ActiveCheckBox.IsEnabled = false;
                ActiveCheckBox.ToolTip   = ActiveLabel.ToolTip = "Your current permissions do not allow activating or disabling contacts";
            }
            try
            {
                pageMode          = PageFunctions.pageParameter(this, "Mode");
                selectedContactID = Int32.Parse(PageFunctions.pageParameter(this, "ContactID"));
                //selectedClientID = Int32.Parse(PageFunctions.pageParameter(this, "ClientID"));
            }
            catch (Exception generalException)
            {
                MessageFunctions.Error("Error retrieving query details", generalException);
                ClientFunctions.ReturnToTilesPage();
            }

            //Clients thisClient = ClientFunctions.GetClientByID(selectedClientID, true);
            ClientCode.Text = Globals.SelectedClient.ClientCode;
            ClientName.Text = Globals.SelectedClient.ClientName;

            if (pageMode == PageFunctions.New)
            {
                PageHeader.Content = "Create New Contact";
                HeaderImage2.SetResourceReference(Image.SourceProperty, "AddIcon");
                Instructions.Content = "Fill in the details as required and then click 'Save' to create the record.";
            }
            else if (pageMode == PageFunctions.Amend)
            {
                if (selectedContactID > 0)
                {
                    try
                    {
                        thisContact              = ClientFunctions.GetContact(selectedContactID);
                        FirstName.Text           = thisContact.FirstName;
                        Surname.Text             = thisContact.Surname;
                        JobTitle.Text            = thisContact.JobTitle;
                        ActiveCheckBox.IsChecked = thisContact.Active;
                        PhoneNumber.Text         = thisContact.PhoneNumber;
                        Email.Text = thisContact.Email;
                    }

                    catch (Exception generalException)
                    {
                        MessageFunctions.Error("Error populating contact data", generalException);
                        ClientFunctions.ReturnToContactPage(selectedContactID);
                    }
                }
                else
                {
                    MessageFunctions.Error("Load error: no contact loaded.", null);
                    ClientFunctions.ReturnToContactPage(selectedContactID);
                }
            }
        }
Beispiel #25
0
        // ---------------------- //
        // -- Event Management -- //
        // ---------------------- //

        // Control-specific events //
        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            bool confirm = MessageFunctions.WarningYesNo("This returns back to the application's Main Menu without saving any changes. Are you sure?", "Return to main menu?");

            if (confirm)
            {
                ClientFunctions.ReturnToTilesPage();
            }
        }
Beispiel #26
0
    public static void CheckMouseInput()
    {
        if (CurrentScene == null)
        {
            return;
        }
        if (User.Player == null)
        {
            return;
        }
        if (UIDragging)
        {
            return;
        }

        if (User.Player.ActionFeed.Count == 0 && Time.time > InputDelay)
        {
            if (Input.GetMouseButton(0))
            {
                MirDirection direction   = MouseDirection();
                Vector2      newlocation = ClientFunctions.VectorMove(User.Player.CurrentLocation, direction, 1);
                if (CanWalk(newlocation))
                {
                    User.Player.ActionFeed.Add(new QueuedAction {
                        Action = MirAction.Walking, Direction = direction, Location = newlocation
                    });
                }
            }
            else if (Input.GetMouseButton(1))
            {
                MirDirection direction   = MouseDirection();
                Vector2      newlocation = ClientFunctions.VectorMove(User.Player.CurrentLocation, direction, 1);
                if (User.WalkStep < 1)
                {
                    if (CanWalk(newlocation))
                    {
                        User.Player.ActionFeed.Add(new QueuedAction {
                            Action = MirAction.Walking, Direction = direction, Location = newlocation
                        });
                    }
                    User.WalkStep++;
                }
                else
                {
                    Vector2 farlocation = ClientFunctions.VectorMove(User.Player.CurrentLocation, direction, 2);
                    if (CanWalk(newlocation) && CanWalk(farlocation))
                    {
                        User.Player.ActionFeed.Add(new QueuedAction {
                            Action = MirAction.Running, Direction = direction, Location = farlocation
                        });
                    }
                }
            }
        }
    }
 private void CancelButton_Click(object sender, RoutedEventArgs e)
 {
     if (pageMode == PageFunctions.Lookup)
     {
         ClientFunctions.CancelTeamContactSelection();
     }
     else
     {
         ClientFunctions.ReturnToTilesPage();
     }
 }
Beispiel #28
0
 public string SuggestedRole()
 {
     if (StaffRoleCode == AccountManagerCode && StaffID != ClientFunctions.GetAccountManagerID(ClientID))
     {
         return("");
     }
     else
     {
         return(DefaultRole());
     }
 }
 private void DisableButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bool?blnEnabled = ClientFunctions.EnableOrDisable(selectedContact.ID);
         if (blnEnabled != null)
         {
             refreshContactGrid();
         }
     }
     catch (Exception generalException) { MessageFunctions.Error("Error changing status", generalException); }
 }
 public string ClientName()
 {
     if (Project == null)
     {
         return("");
     }
     else if (ClientID <= 0)
     {
         return("");
     }
     return(ClientFunctions.GetClientByID(ClientID).ClientName);
 }