private void btnCopyDash_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } AdminDatasourceViewModel AdminDSVM = new AdminDatasourceViewModel(); string OldCanvasName = cmbSavedDash.SelectedValue.ToString(); //int CanvasId = ((CanvasDto)cmbSavedDash.SelectedValue).DatasourceID; string OldDatasourceName = ((DashboardInfo)cmbSavedDash.SelectedItem).DataSource.ToString(); //int OldDatasourceId = applicationViewModel.EwavDatasources.First(ds => ds.DatasourceName == currentDsName).DatasourceID; string NewCanvasName = txtCanvasName.Text; //int UserId = applicationViewModel.LoggedInUser.UserDto.UserID; //int NewDatasourceId = ((Ewav.BAL.EwavDatasourceDto)(cmbDataSource.SelectedValue)).DatasourceID; string NewDatasourceName = ((Ewav.BAL.EwavDatasourceDto)(cmbDataSource.SelectedValue)).DatasourceName; AdminDSVM.CopyDashboard(OldCanvasName, NewCanvasName, OldDatasourceName, NewDatasourceName); AdminDSVM.CopyDashboardCompletedEvent -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_CopyDashboardCompletedEvent); AdminDSVM.CopyDashboardCompletedEvent += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_CopyDashboardCompletedEvent); AdminDSVM.ErrorNotice -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_ErrorNotice); AdminDSVM.ErrorNotice += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(AdminDSVM_ErrorNotice); }
/// <summary> /// Uvm_s the read all orgs for user complete. /// </summary> /// <param name="userOrganizationDtoList">The user organization dto list.</param> /// <param name="ex">The ex.</param> void uvm_ReadAllOrgsForUserComplete(System.Collections.Generic.List <OrganizationDto> userOrganizationDtoList, Exception ex) { cmbOrgName.ItemsSource = userOrganizationDtoList; cmbOrgName.DisplayMemberPath = "Name"; cmbOrgName.SelectedValuePath = "Id"; cmbOrgName.SelectedIndex = 0; // After we get all orgs for the user get all datasources for this org adminDSVM = new AdminDatasourceViewModel(); int orgId = ((OrganizationDto)cmbOrgName.SelectedItem).Id; adminDSVM.Read(orgId); adminDSVM.ReadCompletedEvent += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(adminVM_ReadCompletedEvent); // set the dropdown to the right org foreach (object item in cmbOrgName.Items) { ComboBoxItem ciForType = item as ComboBoxItem; OrganizationDto oDto = item as OrganizationDto; if (oDto.Id == orgId) { cmbOrgName.SelectedItem = item; } } }
/// <summary> /// Initializes a new instance of the <see cref="AddEditUser" /> class. /// </summary> public AddEditUser() { InitializeComponent(); uvm = new UserViewModel(); advm = new AdminDatasourceViewModel(); //dvm.ReadAllDatasourcesInMyOrg(User.Instance.UserDto.OrganizationID); //dvm.MyDatasourcesReadLoaded += new EventHandler(dvm_MyDatasourcesReadLoaded); selectedList = new ObservableCollection <DTO.DatasourceDto>(); availableList = new ObservableCollection <DTO.DatasourceDto>(); //lbxAvailable.SelectionChanged += new SelectionChangedEventHandler(lbxAvailable_SelectionChanged); autoEmail.ItemsSource = null; autoEmail.ItemsSource = ApplicationViewModel.Instance.UserNames; this.Loaded += new RoutedEventHandler(AddEditUser2_Loaded); }
private void UpdateUserList() { List <CanvasShareStatusDto> cssDto = applicationViewModel.CurrentCanvasShareStatusDto; // List<DatasourceUserDto> dsuDto; AdminDatasourceViewModel adminDatasourceViewModel = new AdminDatasourceViewModel(); EventHandler GetAllDatasourceUserComplete = (s, e) => { var dsuDto = (IEnumerable <DatasourceUserDto>)s; userList = new List <UserListInfo>(); foreach (CanvasShareStatusDto cssd in cssDto) { var cssd1 = cssd; var approved = dsuDto.Select(d => d.UserId == cssd1.UserID && d.DatasourceId == applicationViewModel.EwavSelectedDatasource.DatasourceID); var approved2 = from d in dsuDto where d.UserId == cssd1.UserID && d.DatasourceId == applicationViewModel.EwavSelectedDatasource.DatasourceID select d.UserId; //d.UserId == cssd1.UserID && //d.DatasourceId == applicationViewModel.EwavSelectedDatasource.DatasourceID); if (approved2.Count() == 1) { userList.Add(new UserListInfo(cssd.Shared, cssd.FirstName, cssd.LastName, cssd.UserID)); } } dgUsers.ItemsSource = null; dgUsers.ItemsSource = new UserListCollection(userList); }; adminDatasourceViewModel.GetAllDatasourceUserCompletedEvent += GetAllDatasourceUserComplete; adminDatasourceViewModel.GetAllDatasourceUser(); }
/// <summary> /// Handles the Loaded event of the AddEditDataSources control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> void AddEditDataSources_Loaded(object sender, RoutedEventArgs e) { DataBaseTypeEnum dbenum = DataBaseTypeEnum.MySQL; cmbDBType.ItemsSource = System.Enum.GetValues(dbenum.GetType()); if (SelectedDatasourceDto != null) { adminVM = new AdminDatasourceViewModel(); adminVM.ReadAssociatedUsers(this.SelectedDatasourceDto.DatasourceId, this.SelectedDatasourceDto.OrganizationId); adminVM.ReadAssociatedUsersCompletedEvent -= new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(adminVM_ReadAssociatedUsersCompletedEvent); adminVM.ReadAssociatedUsersCompletedEvent += new EventHandler <SimpleMvvmToolkit.NotificationEventArgs <Exception> >(adminVM_ReadAssociatedUsersCompletedEvent); PopulatePage(); } else { //SelectedDatasourceDto = new DatasourceDto(); adminVM = new AdminDatasourceViewModel(); ReadAllUsers(); } }