Exemple #1
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     UserNameTextBlock.Text = UserData.CurrentUser.Name + " " + UserData.CurrentUser.Family;
     PostTextBlock.Text     = UserData.CurrentPoistion.PositionTitle + "\n" + UserData.OrganizationalPosition.Title;
     if (UserData.CurrentUser.LastLogin != null)
     {
         LastEnteranceTextBlock.Text = "زمان آخرین ورود به سیستم" + DateConverter.ConvertDate((DateTime)UserData.CurrentUser.LastLogin);
     }
     if (UserData.CurrentUser.Picture != null)
     {
         image.Source = OpenFileHandler.RetrieveUserImage(UserData.CurrentUser);
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.Tendering))
     {
         TenderingBtn.Visibility = Visibility.Collapsed;
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.Contract))
     {
         ContractBtn.Visibility = Visibility.Collapsed;
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.Log))
     {
         LogBtn.Visibility = Visibility.Collapsed;
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.Regulation))
     {
         RegulationBtn.Visibility = Visibility.Collapsed;
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.TenderingArchive))
     {
         TendArchBtn.Visibility = Visibility.Collapsed;
     }
     if (!NavigationHandler.HasAccessToDestinationPage(SubSystem.UserManagement))
     {
         UserMngBtn.Visibility = Visibility.Collapsed;
     }
     if (UserData.CurrentAccessRight.SysAdmin != true)
     {
         BaseDataBtn.Visibility = Visibility.Collapsed;
     }
 }
 private void AddUserData()
 {
     FNameTxt.Text  = PageUser.Name;
     LNameTxt.Text  = PageUser.Family;
     SocialTxt.Text = PageUser.SocialNumber;
     TelTxt.Text    = PageUser.PhoneNumber;
     foreach (var item in OrgTxt.Items)
     {
         var x = item as ComboBoxItem;
         if ((int)x.Tag == PageUser.OrganizationPosition)
         {
             OrgTxt.SelectedIndex = OrgTxt.Items.IndexOf(x);
             break;
         }
     }
     foreach (var item in PositionTxt.Items)
     {
         var x = item as ComboBoxItem;
         if ((int)x.Tag == PageUser.PositionId)
         {
             PositionTxt.SelectedIndex = PositionTxt.Items.IndexOf(x);
             break;
         }
     }
     UserNameTxt.IsEnabled                = false;
     UserNameTxt.Text                     = PageUser.Username;
     StatusTxt.Text                       = PageUser.Status;
     Read1Tick.IsChecked                  = UserAccessRight.TenderingRead;
     Read2Tick.IsChecked                  = UserAccessRight.TenderingArchiveRead;
     Read3Tick.IsChecked                  = UserAccessRight.ContractRead;
     Read4Tick.IsChecked                  = UserAccessRight.RegulationRead;
     Write1Tick.IsChecked                 = UserAccessRight.TenderingWrite;
     Write2Tick.IsChecked                 = UserAccessRight.TenderingArchiveWrite;
     Write3Tick.IsChecked                 = UserAccessRight.ContractWrite;
     Write4Tick.IsChecked                 = UserAccessRight.RegulationWrite;
     Delete1Tick.IsChecked                = UserAccessRight.TenderingDelete;
     Delete2Tick.IsChecked                = UserAccessRight.TenderingArchiveDelete;
     Delete3Tick.IsChecked                = true;
     Delete4Tick.IsChecked                = UserAccessRight.RegulationDelete;
     Permanent1Tick.IsChecked             = UserAccessRight.TenderingPermanentWrite;
     Permanent2Tick.IsChecked             = UserAccessRight.TenderingArchivePermanentWrite;
     Permanent3Tick.IsChecked             = true;
     Permanent4Tick.IsChecked             = UserAccessRight.RegulationPermanentWrite;
     Log1Tick.IsChecked                   = UserAccessRight.TenderingLog;
     Log2Tick.IsChecked                   = UserAccessRight.TenderingArchiveLog;
     Log3Tick.IsChecked                   = UserAccessRight.ContractLog;
     Log4Tick.IsChecked                   = UserAccessRight.RegulationLog;
     TenderingComite.IsChecked            = PageUser.TenderingCommittee;
     PaymentManageCheck.IsChecked         = PageUser.PaymentDraftCommittee;
     ContractManage.IsChecked             = PageUser.ManagingPaymentDraft;
     UserManageRightTick.IsChecked        = UserAccessRight.CreatingUser;
     passwordBox1.Password                = passwordBox2.Password = PageUser.Password;
     consultCommittee.IsChecked           = PageUser.ConsultantCommittee;
     techCommittee.IsChecked              = PageUser.TechnicalCommittee;
     ManagingContractAccessTick.IsChecked = PageUser.ManagingContractAccess;
     if (PageUser.Picture != null)
     {
         image.Source = OpenFileHandler.RetrieveUserImage(PageUser);
     }
     UserImage = PageUser.Picture;
 }