private void listUserTabUserGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (_isFillingList || SelectedUser == null)
            {
                return;
            }
            if (listUserTabUserGroups.SelectedItems.OfType <ODBoxItem <UserGroup> >().Select(x => x.Tag.UserGroupNum).Count() == 0)
            {
                MsgBox.Show(this, "A user must have at least one User Group attached.");
                RefreshUserTabGroups();                 //set the groups back to what they were before.
                return;
            }
            List <long> listSelectedUserUserGroupsOld = SelectedUser.GetGroups(IsForCEMT).Select(x => x.UserGroupNum).ToList();
            List <long> listSelectedUserUserGroups    = listUserTabUserGroups.SelectedTags <UserGroup>().Select(x => x.UserGroupNum).ToList();

            if (           //Current selected groups do not contain SecurityAdmin permission
                GroupPermissions.GetForUserGroups(listSelectedUserUserGroups, Permissions.SecurityAdmin).Count == 0
                //Selected user had SecurityAdmin permission before new selections
                && GroupPermissions.GetForUserGroups(listSelectedUserUserGroupsOld, Permissions.SecurityAdmin).Count > 0)
            {
                //The SelectedUser is no longer part of SecurityAdmin group. Check that at least one other user is part of a SecurityAdmin Group.
                if (!Userods.IsSomeoneElseSecurityAdmin(SelectedUser))
                {
                    MsgBox.Show(this, Lan.g(this, "At least one user must have Security Admin permission."));
                    RefreshUserTabGroups();                     //set the groups back to what they were before.
                    return;
                }
            }
            if (UserGroupAttaches.SyncForUser(SelectedUser, listSelectedUserUserGroups) != 0)
            {
                UserGroupAttaches.RefreshCache();                //only refreshes local cache.
            }
            RefreshUserTree();
        }
        void chatAdmin_Clicked(System.Object sender, System.EventArgs e)
        {
            ShowListsSpecs Rs = new ShowListsSpecs();
            SelectedUser   ob = new SelectedUser();

            ob.travelerSpecs = _travelerSpecs;
            Profile      profile = DatabaseHelper.GetProfile(App.Os_Folder);
            RequestSpecs Rspecs  = new RequestSpecs();

            apiService = new ApiService();
            Users user = new Users();



            var menuItem = sender as Button;

            Rs = menuItem.CommandParameter as ShowListsSpecs;

            Rspecs.Id    = Rs.travelerSpecs.Id;
            Rspecs.Email = profile.Email;

            using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black))
            {
                Task.Run(async() => {
                    user = await apiService.LoginAsync(Rs.travelerSpecs.Email);
                }).Wait();
            }

            ob.image = (user.UserPhoto != null) ? ImageManager.BytesToImage(user.UserPhoto) : "giphy.gif";

            Navigation.PushModalAsync(new ChatPage(ob, user.FirstName + " " + user.LastName, Rspecs));
        }
        void Handle_Clicked_4(object sender, System.EventArgs e)
        {
            RequestSpecs Rs = new RequestSpecs();
            SelectedUser ob = new SelectedUser();

            ob.travelerSpecs = IdInfo;
            Profile profile = DatabaseHelper.GetProfile(App.Os_Folder);

            apiService = new ApiService();
            Users user = new Users();



            var menuItem = sender as Button;

            Rs = menuItem.CommandParameter as RequestSpecs;

            using (UserDialogs.Instance.Loading(Translator.getText("Loading"), null, null, true, MaskType.Black))
            {
                Task.Run(async() => {
                    user = await apiService.LoginAsync(Rs.Email);
                }).Wait();
            }

            ob.image = ImageManager.BytesToImage(user.UserPhoto);
            Navigation.PushModalAsync(new ChatPage(ob, user.FirstName + " " + user.LastName, Rs));
        }
 ///<summary>Refreshes the UserGroups list box on the "User" tab. Also refreshes the security tree.
 ///Public so that it can be called from the Form that implements this control.</summary>
 public void RefreshUserTabGroups()
 {
     _isFillingList = true;
     listUserTabUserGroups.ClearSelected();
     if (SelectedUser == null)           //No selected user, disable because modifying selections woudn't make sense.
     {
         listUserTabUserGroups.Enabled = false;
     }
     else
     {
         listUserTabUserGroups.Enabled = true;
         List <long> listUserGroupNums = SelectedUser.GetGroups(IsForCEMT).Select(x => x.UserGroupNum).ToList();
         for (int i = 0; i < listUserTabUserGroups.Items.Count; i++)
         {
             if (listUserGroupNums.Contains(((ODBoxItem <UserGroup>)listUserTabUserGroups.Items[i]).Tag.UserGroupNum))
             {
                 listUserTabUserGroups.SetSelected(i, true);
             }
         }
     }
     _isFillingList = false;
     //RefreshTree takes a while (it has to draw many images) so this is to show the usergroup selections before loading the tree.
     Application.DoEvents();
     RefreshUserTree();
 }
예제 #5
0
        private void DisplayUser()
        {
            btnChangePassword.Visibility = Visibility.Hidden;
            txtUsername.Text             = "";
            txtTags.Text              = "";
            chkIsAdmin.IsChecked      = false;
            chkIsAniDB.IsChecked      = false;
            chkIsTrakt.IsChecked      = false;
            chkEditSettings.IsChecked = false;
            txtPlexUsers.Text         = "";
            txtUsername.Focus();

            if (SelectedUser?.JMMUserID == null)
            {
                return;
            }

            btnChangePassword.Visibility = Visibility.Visible;
            txtUsername.Text             = SelectedUser.Username;
            SelectedUserPassword         = SelectedUser.Password;
            txtTags.Text              = string.Join(", ", SelectedUser.GetHideCategories());
            chkIsAdmin.IsChecked      = SelectedUser.IsAdminUser;
            chkIsAniDB.IsChecked      = SelectedUser.IsAniDBUserBool;
            chkIsTrakt.IsChecked      = SelectedUser.IsTraktUserBool;
            chkEditSettings.IsChecked = SelectedUser.CanEditSettings;
            txtPlexUsers.Text         = string.Join(", ", SelectedUser.GetPlexUsers());
        }
        private void SavePatient()
        {
            //var user = (Patient)FindUserByCid(_hyPrDevice.CurrentRfid);
            var user = (Patient)FindUserByCid(SelectedUser.Cid);

            if (user != null)
            {
                user.UpdateAllProperties(SelectedUser.Patient);
                SelectedUser = new PatientViewModel(user);
                _wardNode.UpdatePatient(user);
            }
            else
            {
                user = new Patient
                {
                    Name  = SelectedUser.Name,
                    Color = SelectedUser.Color,
                    Cid   = SelectedUser.Cid,
                    Tag   = SelectedUser.Tag
                };

                _wardNode.AddPatient(user);

                SelectedUser.UpdateAllProperties(user);
            }
        }
예제 #7
0
        /// <summary>
        /// Wenn ein neuer User selektiert wird
        /// </summary>
        public void UserSelectionChanged()
        {
            // Erstellt eine neue Liste mit den neuen Infos
            UserInfos = new ObservableCollection <UserInfoEntry>
            {
                new UserInfoEntry("Name", SelectedUser.DisplayName),
                new UserInfoEntry("Email", SelectedUser.EmailAddress),
                new UserInfoEntry("Letzter Login", SelectedUser.LastLogon.ToString())
            };

            List <GroupPrincipal> tmpList = new List <GroupPrincipal>();;
            // Liest alle Gruppen aus in dennen der SelectedUser Mitglied ist
            PrincipalSearchResult <Principal> grp = SelectedUser.GetGroups();

            // Geht über alle Gruppen und fügt sie zur Liste hinzu
            foreach (var g in grp)
            {
                tmpList.Add(g as GroupPrincipal);
            }
            // Sortiert die Gruppen
            tmpList.Sort((x, y) => x.Name.CompareTo(y.Name));

            // Setzt SelectedUserGroups auf die Ausgelesene Liste
            SelectedUserGroups = new ObservableCollection <GroupPrincipal>(tmpList);
        }
예제 #8
0
        private void DoSaveChanges()
        {
            if (!NameChecker.CheckName(UserName))
            {
                NameChecker.ShowCharacterError(UserName);
                return;
            }

            if (!NameChecker.CheckName(Password))
            {
                NameChecker.ShowCharacterError(Password);
                return;
            }

            var newUser = SelectedUser.SetNewUserValues(UserName,
                                                        Password,
                                                        AccessablePractices.Where(listItem => listItem.IsSelected)
                                                        .Select(listItem => listItem.Id)
                                                        .ToList(),
                                                        IsHidden);

            dataCenter.UpdateUser(newUser);

            Users.Remove(SelectedUser);
            Users.Add(newUser);

            SelectedUser         = null;
            ShowModificationView = false;
        }
예제 #9
0
    /// <summary>
    /// Gets where condition for the matrix.
    /// </summary>
    /// <returns>String representing where condition for the matrix</returns>
    private string GetWhereCondition()
    {
        string where = "RoleGroupId IS NULL";

        if (chkUserOnly.Checked && (SelectedUserID > 0))
        {
            // Get selected site name
            string siteName = UserInfo.GLOBAL_ROLES_KEY;
            if (siteSelector.SiteID > 0)
            {
                siteName = siteSelector.SiteName.ToLowerCSafe();
            }

            string rolesWhere = SelectedUser.GetRoleIdList((siteSelector.SiteID <= 0), true, siteName);

            // Add roles where condition
            if (!String.IsNullOrEmpty(rolesWhere))
            {
                where = SqlHelper.AddWhereCondition(where, "RoleID IN(" + rolesWhere + ")");
            }
            else
            {
                where = SqlHelper.NO_DATA_WHERE;
                gridMatrix.StopProcessing = true;
            }
        }

        return(where);
    }
 private void BtnEdit_Click(object sender, RoutedEventArgs e)
 {
     if (dgFurniture.Visibility.Equals(Visibility.Visible))
     {
         Furniture       copy            = (Furniture)SelectedFurniture.Clone();
         FurnitureWindow furnitureWindow = new FurnitureWindow(copy, FurnitureWindow.Operation.EDIT);
         furnitureWindow.Show();
     }
     else if (dgFurnitureType.Visibility.Equals(Visibility.Visible))
     {
         FurnitureType       copy            = (FurnitureType)SelectedFurnitureType.Clone();
         FurnitureTypeWindow furnitureWindow = new FurnitureTypeWindow(copy, FurnitureTypeWindow.Operation.EDIT);
         furnitureWindow.Show();
     }
     else if (dgSales.Visibility.Equals(Visibility.Visible))
     {
         Sale       copy       = (Sale)SelectedSale.Clone();
         SaleWindow saleWindow = new SaleWindow(copy, SaleWindow.Operation.EDIT);
         saleWindow.Show();
     }
     else if (dgUsers.Visibility.Equals(Visibility.Visible))
     {
         User       copy       = (User)SelectedUser.Clone();
         UserWindow userWindow = new UserWindow(copy, UserWindow.Operation.EDIT);
         userWindow.Show();
     }
     else if (dgAdditionalService.Visibility.Equals(Visibility.Visible))
     {
         AdditionalService       copy = (AdditionalService)SelectedAdditionalService.Clone();
         AdditionalServiceWindow additionalServiceWindow = new AdditionalServiceWindow(copy, AdditionalServiceWindow.Operation.EDIT);
         additionalServiceWindow.Show();
     }
 }
        private void UpdateData()
        {
            ResetValues();

            DailyRecord   record;
            List <Record> tempList;

            record = SelectedUser.FindRecord(DateTime.Now - TimeSpan.FromDays(_day), true);
            if (record != null)
            {
                tempList = record.Records;

                if (tempList != null && tempList.Count > 0)
                {
                    for (int i = 0; i < 24; i++)
                    {
                        var hrec = record.GetHourlyRecord(i, true);

                        if (hrec != null)
                        {
                            selectedTotalSteps   += hrec.WalkingStepCount + hrec.RunningStepCount;
                            selectedRunningSteps += hrec.RunningStepCount;
                            WalkTime             += hrec.WalkTime;
                            RunTime += hrec.RunTime;
                        }

                        areaChartData[i].value2 = (hrec == null ? 0 : hrec.WalkingStepCount + hrec.RunningStepCount) +
                                                  (i > 0 ? areaChartData[i - 1].value2 : 0);
                    }
                }
            }

            OnPropertyChanged(null);
            ChartData.UpdateCollection();
        }
예제 #12
0
        // Export all data for selected user.
        public void ExportUserData()
        {
            ExportData(DataType.User);

            int      i        = 0;
            Activity activity = SelectedUser.GetActivity(i);

            while (activity != null)
            {
                ImportExport.WriteData(activity);
                i++;
                activity = SelectedUser.GetActivity(i);
            }

            i = 0;
            Instance instance = SelectedUser.GetInstance(i);

            while (instance != null)
            {
                ImportExport.WriteData(instance);
                int     j       = 0;
                Session session = instance.GetSession(j);
                while (session != null)
                {
                    ImportExport.WriteData(session);
                    j++;
                    session = instance.GetSession(j);
                }
                i++;
                instance = SelectedUser.GetInstance(i);
            }
        }
        void Handle_Clicked_2(object sender, System.EventArgs e)
        {
            SelectedUser ob     = new SelectedUser();
            RequestSpecs IdInfo = new RequestSpecs();

            ob.travelerSpecs = RO.travelerSpecs;
            IdInfo           = RO.requestSpecs;

            Navigation.PushModalAsync(new ChatPage(ob, profile.FirstName + " " + profile.LastName, RO.requestSpecs));
        }
예제 #14
0
 private void DeleteUser(User user)
 {
     if (MessageBox.Show(EntryControl.Resources.Message.Question.Delete, SelectedUser.ToString(), MessageBoxButtons.YesNo)
         == DialogResult.Yes)
     {
         user.Delete();
         user.Save(Database);
         bsUserList.Remove(user);
     }
 }
        async void ShowEditMessageBox()
        {
            var           viewModel     = new UserViewModel(SelectedUser);
            MessageResult dialogResults = await DialogService.ShowDialogAsync(MessageButton.OKCancel, "Edit", "UseEditControl", viewModel);

            if (dialogResults == MessageResult.OK)
            {
                SelectedUser.Update((UserViewModel)viewModel);
            }
        }
 private void OnOk()
 {
     if (_getHumans)
     {
         UI.Publish(SelectedUser);
     }
     else
     {
         UI.Publish(SelectedUser.ConvertObject <Room>());
     }
 }
예제 #17
0
        /// <summary>
        /// Make transaction.
        /// </summary>
        public void PayBills()
        {
            using (BillsPaymentSystemContext context = new BillsPaymentSystemContext())
            {
                while (true)
                {
                    try
                    {
                        Console.Clear();
                        outputProvider.DrawFrame(2);
                        outputProvider.PayBills();
                        var data = inputProvider.ReadUserData();
                        if (data[0] < 0 || data[0] > context.Users.Count())
                        {
                            throw new Exception(Strings.InvalidInput((int)data[0]));
                        }

                        var selectedUser = new SelectedUser(data);
                        Console.CursorVisible = false;
                        var currentUser  = selectedUser.UserData(context);
                        var bankAccounts = selectedUser.BankAcountData(context);
                        var creditCards  = selectedUser.CreditCardData(context);

                        if (bankAccounts.Sum(x => x.Balance) + creditCards.Sum(x => x.Limit - x.MoneyOwed)
                            < selectedUser.Amount)
                        {
                            throw new Exception(Strings.InvalidInput());
                        }

                        outputProvider.StartWaiting();
                        Withdraw(context, bankAccounts, creditCards, selectedUser.Amount);
                        outputProvider.Done();

                        break;
                    }
                    catch (Exception e)
                    {
                        outputProvider.ShowException(e.Message);
                        if (inputProvider.Key() == ConsoleKey.Enter)
                        {
                            continue;
                        }
                    }
                }

                if (inputProvider.Key() == ConsoleKey.Enter)
                {
                    var inputComander = new InputComander();
                    inputComander.StartReading();
                }
            }
        }
예제 #18
0
    protected override void OnPreRender(EventArgs e)
    {
        // Load the matrix
        if (Element != null)
        {
            // Disable check box if no user selected
            if (SelectedUserID > 0)
            {
                chkUserOnly.Enabled = true;
            }
            else
            {
                chkUserOnly.Checked = false;
                chkUserOnly.Enabled = false;
            }

            // Set info label
            headTitle.Text = String.Format(GetString("resource.ui.rolesinfo"), HTMLHelper.HTMLEncode(Element.ElementDisplayName));

            // Set matrix parameters
            gridMatrix.QueryParameters      = GetQueryParameters(siteSelector.SiteID, Element.ElementDisplayName);
            gridMatrix.WhereCondition       = GetWhereCondition();
            gridMatrix.ShowContentBeforeRow = (SelectedUser != null);

            // Get content before rows
            GenerateBeforeRowsContent();

            ucDisabledModule.SiteName = siteSelector.SiteName;
            ucDisabledModule.InfoText = GetString("resource.ui.disabled");

            ShowInformation(String.Empty);

            if (!gridMatrix.HasData)
            {
                plcUpdate.Visible = false;
                headTitle.Text    = (chkUserOnly.Checked) ? GetString("general.norolemember") : GetString("uiprofile.norole");
            }
            else
            {
                // Inform user that global admin was selected
                if ((SelectedUserID > 0) && (SelectedUser != null) && (SelectedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin)))
                {
                    ShowInformation(GetString("uiprofile.GlobalAdministrator"));
                }

                plcUpdate.Visible = true;
            }
        }

        base.OnPreRender(e);
    }
예제 #19
0
            void Handle_ItemTapped(object sender, Xamarin.Forms.ItemTappedEventArgs e)
            {

                if (viewModel.ShowClick)
                {
                    SelectedUser ob = new SelectedUser();
                    ob = (SelectedUser)e.Item;

                    Navigation.PushModalAsync(new DetailAcceptedPage(ob, IdInfo));
                }
                else if (viewModel.ShowChat)
                {

                }
            }
예제 #20
0
    protected string gridMatrix_OnGetRowItemCssClass(object sender, DataRow dr)
    {
        string roleName = ValidationHelper.GetString(dr["RoleName"], String.Empty);

        // Check if all necessary data are available
        if (!String.IsNullOrEmpty(roleName) && (SelectedUser != null))
        {
            if (SelectedUser.IsInRole(roleName, siteSelector.SiteName))
            {
                return(HIGHLIGHTED_ROW_CSS);
            }
        }

        return(String.Empty);
    }
예제 #21
0
    //When a module is selected find the ID + lecturer
    protected void DropDownModule_SelectedIndexChanged(object sender, EventArgs e)
    {
        //Module ID from list:
        string modID = DropDownModule.SelectedValue;

        string        connectionString5 = WebConfigurationManager.ConnectionStrings["dbconnect"].ConnectionString;
        SqlConnection myConnection5     = new SqlConnection(connectionString5);

        myConnection5.Open();

        string query5 = "SELECT * FROM SIS_MODULES WHERE moduleID=@selectedMod";

        SqlCommand myCommand5 = new SqlCommand(query5, myConnection5);

        myCommand5.Parameters.AddWithValue("@selectedMod", modID);

        SqlDataReader rdr = myCommand5.ExecuteReader();


        while (rdr.Read())
        {
            string lecturer = rdr["lecturerID"].ToString();


            SelectedLecturer.Text = lecturer;
        }

        rdr.Close();

        SelectedLecturer.DataBind();
        string lecturerID = SelectedLecturer.Text;

        string     query6     = "SELECT * FROM SIS_LECTURER WHERE lecturerID=@lecturer";
        SqlCommand myCommand6 = new SqlCommand(query6, myConnection5);

        myCommand6.Parameters.AddWithValue("@lecturer", lecturerID);
        SqlDataReader rdr2 = myCommand6.ExecuteReader();

        while (rdr2.Read())
        {
            string user = rdr2["userID"].ToString();
            SelectedUser.Text = user;
        }

        rdr2.Close();

        SelectedUser.DataBind();
    }
        private async Task OnUpdateUser()
        {
            if (SelectedUser.ValidateModel())
            {
                try
                {
                    await _adminService.UpdateUserAsync(SelectedUser);

                    IsUserEditorVisible = false;
                }
                catch (TimeoutException timeoutEx)
                {
                    _eventAggregator.GetEvent <TimeoutErrorEvent>().Publish(timeoutEx);
                }
            }
        }
예제 #23
0
 /// <summary>
 /// This handles when the <see cref="IUserRepository.GetAllUsersCompleted"/> is raise.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UserRepositorySaveUserCompleted(object sender, RepositoryTaskFinishedEventArgs e)
 {
     ThreadSafeInvoke(() =>
     {
         _messagingService.CloseProgressMessage();
         if (e.HasError)
         {
             _messagingService.ShowMessage(UIText.ERROR_OCCURED_MSG);
         }
         if (!Users.Contains(SelectedUser))
         {
             Users.Add(SelectedUser);
             OnPropertyChanged(GetPropertyName(() => SelectedUser));
             SelectedUser.Refresh();
         }
     });
 }
예제 #24
0
 /// <summary>
 /// It creates all the necessary object for the model to be loaded
 /// </summary>
 private void PrepareForTheShow()
 {
     SettingsHelper.InitializeSettings();
     TheConfig = new Config(ConfigurationManager.AppSettings["VizIp"],
                            Convert.ToInt32(ConfigurationManager.AppSettings["VizPort"]),
                            "",
                            Convert.ToInt32(ConfigurationManager.AppSettings["FeedbackPort"]));
     VizPgm = new VizEngine(TheConfig.EngineIp, TheConfig.EnginePort);
     User   = new SelectedUser();
     CurrentSession.Config    = TheConfig;
     CurrentSession.VizEngine = VizPgm;
     CurrentSession.User      = User;
     CurrentSession.Player    = new ClipPlayerServiceAgent();
     _feedback    = new FeedbackCoordinator(TheConfig);
     SignInWindow = new SignInWindow();
     //mainWindow = new MainWindow();
 }
예제 #25
0
        /// <summary>
        /// Show user info.
        /// </summary>
        public void ShowUserByID()
        {
            using (BillsPaymentSystemContext context = new BillsPaymentSystemContext())
            {
                Console.Clear();
                outputProvider.DrawFrame(2);
                outputProvider.SelectUser();
                while (true)
                {
                    try
                    {
                        Console.Clear();
                        outputProvider.DrawFrame(2);
                        outputProvider.SelectUser();
                        int ID = inputProvider.ReadNumber();
                        if (ID < 0 || ID > context.Users.Count())
                        {
                            throw new Exception(Strings.InvalidInput(ID));
                        }

                        var selectedUser = new SelectedUser(ID);
                        Console.CursorVisible = false;
                        var currentUser  = selectedUser.UserData(context);
                        var bankAccounts = selectedUser.BankAcountData(context);
                        var creditCards  = selectedUser.CreditCardData(context);
                        outputProvider.PrintUserData(currentUser, bankAccounts, creditCards);
                        break;
                    }
                    catch (Exception e)
                    {
                        outputProvider.ShowException(e.Message);
                        if (inputProvider.Key() == ConsoleKey.Enter)
                        {
                            continue;
                        }
                    }
                }

                if (inputProvider.Key() == ConsoleKey.Enter)
                {
                    var inputComander = new InputComander();
                    inputComander.StartReading();
                }
            }
        }
        private void UpdateData()
        {
            ResetValues();

            DailyRecord   record;
            List <Record> tempList;
            DateTime      date = (DateTime.Now - TimeSpan.FromDays(_day));

            record = SelectedUser.FindRecord(date, true);
            if (record != null)
            {
                tempList = record.Records;

                DateTime startDate = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0);

                if (tempList != null && tempList.Count > 0)
                {
                    for (int i = 0; i < 24; i++)
                    {
                        var hrec    = record.GetHourlyRecord(i, true);
                        int walking = (hrec == null || hrec.ActivityType != 0 ? 0 : _counter.GetWalkingCalorieBurn(hrec));
                        int hourly  = (hrec == null ? ((startDate.Date == DateTime.Now.Date && i > date.Hour) ? 0 : _counter.CalcHourlyBMR(startDate)) : _counter.AdjustedBMR(hrec));

                        areaChartData[i].value2 += hourly + walking;

                        _walkingCalories += walking;
                        _passiveCalories += hourly;

                        startDate += TimeSpan.FromHours(1);
                    }

                    foreach (Record hrec in tempList)
                    {
                        int activity = (hrec == null || hrec.ActivityType == 0 ? 0 : (int)((double)_counter.RawBMR() * 1.157407407407407e-5 * (double)hrec.WalkTime
                                                                                           * hrec.RealActivity.metaEquivalent)); //BMR per second
                        areaChartData[hrec.StartDate.Hour].value2 += activity;
                        _walkingCalories += activity;
                    }
                }
            }

            OnPropertyChanged(null);
            ChartData.UpdateCollection();
        }
예제 #27
0
    protected override void OnPreRender(EventArgs e)
    {
        // Initialize value dependant properties of uni matrix
        gridMatrix.ShowContentBeforeRow = SelectedUserID > 0;
        gridMatrix.QueryName            = GetQueryNameByType();
        gridMatrix.QueryParameters      = GetQueryParameters();
        gridMatrix.WhereCondition       = GetWhereCondition();

        if (FilterChanged || (gridMatrix.Pager.CurrentPage <= 0))
        {
            gridMatrix.Pager.CurrentPage = 1;
        }
        if (gridMatrix.Pager.CurrentPage > gridMatrix.Pager.PageCount)
        {
            gridMatrix.Pager.CurrentPage = gridMatrix.Pager.PageCount;
        }

        int selectedId = ValidationHelper.GetInteger(SelectedID, 0);

        ShowInformation(String.Empty);

        if (!gridMatrix.HasData)
        {
            if (UserRolesOnly && (selectedId > 0))
            {
                lblInfo.Text = GetString("general.norolemember");
            }
        }
        else
        {
            // Inform user that global admin was selected
            if ((SelectedUserID > 0) && SelectedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
            {
                ShowInformation(GetString("Administration-Permissions_Matrix.GlobalAdministrator"));
            }
        }
        lblInfo.Visible = !string.IsNullOrEmpty(lblInfo.Text);

        // Set content before rows and refresh matrix content
        GenerateBeforeRowsContent(SiteID, selectedId, SelectedType);
        pnlUpdMat.Update();

        base.OnPreRender(e);
    }
예제 #28
0
        private void UpdateData()
        {
            listRecords.Clear();
            DateTime    _date = DateTime.Now - TimeSpan.FromDays(_day);
            DailyRecord _rec  = SelectedUser.FindRecord(_date, true);

            if (_rec != null)
            {
                foreach (Record r in _rec.Records)
                {
                    if (r.ActivityType != 0)
                    {
                        listRecords.Add(r);
                    }
                }
            }
            listRecords.UpdateCollection();
            OnPropertyChanged(null);
        }
예제 #29
0
    protected override void OnPreRender(EventArgs e)
    {
        // Load the matrix
        if (Permission != null)
        {
            // Disable check box if no user selected
            if (SelectedUserID > 0)
            {
                chkUserOnly.Enabled = true;
            }
            else
            {
                chkUserOnly.Checked = false;
                chkUserOnly.Enabled = false;
            }

            headTitle.Text = String.Format(GetString("administration-module_edit_permissionnames.rolesinfo"), HTMLHelper.HTMLEncode(Permission.PermissionDisplayName));

            gridMatrix.QueryParameters      = GetQueryParameters(siteSelector.SiteID, Permission.PermissionId, Permission.PermissionDisplayName);
            gridMatrix.WhereCondition       = GetWhereCondition();
            gridMatrix.ShowContentBeforeRow = (SelectedUser != null);

            GenerateBeforeRowsContent();
            ShowInformation(String.Empty);

            if (!gridMatrix.HasData)
            {
                plcUpdate.Visible = false;
                headTitle.Text    = (chkUserOnly.Checked) ? GetString("general.norolemember") : GetString("general.emptymatrix");
            }
            else
            {
                // Inform user that global admin was selected
                if ((SelectedUserID > 0) && (SelectedUser != null) && SelectedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin))
                {
                    ShowInformation(GetString("Administration-Permissions_Matrix.GlobalAdministrator"));
                }

                plcUpdate.Visible = true;
            }
        }
        base.OnPreRender(e);
    }
예제 #30
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     if (SelectedUser != null)
     {
         if (SelectedUser.FollowThisUser)
         {
             SelectedUser.FollowThisUser = false;
         }
         else if (SelectedUser.CanBeFollowed)
         {
             SelectedUser.FollowThisUser = true;
         }
         SelectedUser.UpdateText();
         if (SelectedUser.FollowThisUser)
         {
             Instance_UserInfoUpdate(null, SelectedUser);
         }
     }
 }