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> /// Handles the Click event of the btnFinish control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param> private void btnFinish_Click(object sender, System.Windows.RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); //MessageBox.Show("New Datasources cannot be added in DEMO mode."); return; } localDto.OrganizationId = OrganizationId; localDto.DatasourceName = tbDSName.Text; localDto.AssociatedUsers = new List <UserDTO>(); List <UserDTO> selectList = selectedList.ToList <UserDTO>(); List <UserDTO> adminList = new ObservableCollection <UserDTO>(OriginalList.Where(t1 => t1.UserRoleInOrganization.ToLower() == "administrator" || t1.UserRoleInOrganization.ToLower() == "superadministrator")).ToList <UserDTO>(); selectList.AddRange(adminList); //localDto.AssociatedUsers.AddRange(selectList); localDto.AssociatedUsers = selectedList.ToList <UserDTO>(); if (radEnable.IsChecked == true) { localDto.IsActive = true; } else { localDto.IsActive = false; } FinishProcessing(); }
private void SaveAs_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } SaveAsCall(); }
/// <summary> /// Handles the Click event of the OKButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs" /> instance containing the event data.</param> private void OKButton_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } applicationViewModel.DeleteCanvas(applicationViewModel.CurrentCanvasId); }
private void Save_Click(object sender, System.Windows.RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } //SaveFile(element); //applicationViewModel.LoadCanvasUserList(user); //UserDTO user = new UserDTO(); //user.UserID = applicationViewModel.LoggedInUser.UserDto.UserID; //User ewavUser = applicationViewModel.LoggedInUser; //ewavUser.UserDto = user; //applicationViewModel.LoggedInUser = ewavUser; // new UserDTO() { UserID = "1" }; //applicationViewModel.DatasourceId = 1; //if (applicationViewModel.UserIdForOpenedCanvas == Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID)) //{ // applicationViewModel.CurrentCanvasId = applicationViewModel.CanvasIdForOpenedCanvas; //} if (applicationViewModel.CurrentCanvasId > 0) { XElement element = applicationViewModel.SerializeCanvas(); CanvasDto dto = new CanvasDto(); //dto.CanvasName = txtSaveTitle.Text; //dto.CanvasDescription = txtSaveDesc.Text; //dto.CreatedDate = DateTime.Now; dto.ModifiedDate = DateTime.Now; dto.CreatedDate = DateTime.Now; //dto.DatasourceID = applicationViewModel.LoggedInUser.UserDto.DatasourceID; dto.XmlData = element; //dto.UserId = Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID); //dto.UserId.UserId1 = "1"; dto.IsNewCanvas = false; dto.CanvasId = applicationViewModel.CurrentCanvasId; applicationViewModel.SaveCanvas(element, dto); savedash = new SaveDash("success"); savedash.Closed += new EventHandler(savedash_Closed); savedash.Show(); } else { SaveAsCall(); } }
/// <summary> /// Handles the Click event of the HyperlinkButton control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param> private void HyperlinkButton_Click(object sender, System.Windows.RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } // TODO: Add event handler implementation here. this.DialogResult = false; ForgotPwd fp = new ForgotPwd(); fp.Show(); }
private void btnSendEmail_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } UserListCollection SharedUserList = (UserListCollection)dgSharedUsers.ItemsSource; var filteredList = from user in SharedUserList where user.IsSelected == true select new { FirstName = user.FirstName, LastName = user.LastName, UserID = user.UserId }; List <int> userIds = new List <int>(); if (filteredList.Count() == 0) { spMsg.Visibility = System.Windows.Visibility.Visible; tbSaveError.Visibility = System.Windows.Visibility.Visible; return; } foreach (var item in filteredList) { userIds.Add(item.UserID); } if (applicationViewModel.CurrentCanvasId > 0) { applicationViewModel.ResendEmail(applicationViewModel.CurrentCanvasId, userIds); } waitCursor.Visibility = System.Windows.Visibility.Visible; spMsg.Visibility = System.Windows.Visibility.Collapsed; btnSendEmail.IsEnabled = false; }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } waitCursor.Visibility = System.Windows.Visibility.Visible; UserListCollection userList = (UserListCollection)dgUsers.ItemsSource; var filteredList = from user in userList where user.IsSelected == true select new { FirstName = user.FirstName, LastName = user.LastName, UserID = user.UserId }; List <int> userIds = new List <int>(); foreach (var item in filteredList) { userIds.Add(item.UserID); } if (applicationViewModel.CurrentCanvasId > 0) { applicationViewModel.ShareCanvas(applicationViewModel.CurrentCanvasId, userIds); string xx = string.Join <int>(",", userIds); } else { MessageBox.Show("Cannot share unsaved canvas."); } //this.DialogResult = true; }
private void Delete_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } if (applicationViewModel.CurrentCanvasId != -1) // if its equal to -1 means it belongs to different user or hasn't been saved. { dd = new DeleteDash(); dd.Closed += new EventHandler(dd_Closed); dd.Show(); } else { WarningWindow error = new WarningWindow("This is a shared dashboard and cannot be deleted, or dashboard does not exist. ", ""); error.Show(); //MessageBox.Show("This canvas is either shared by someone or not saved. Please save the canvas before performing this operation."); } }
private void btnSave_Click(object sender, System.Windows.RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } // TODO: Add event handler implementation here. //spMsg_Success.Visibility = System.Windows.Visibility.Visible; //spSave.Visibility = System.Windows.Visibility.Collapsed; //if (spMsg.Visibility != System.Windows.Visibility.Visible) //{ //} //else //{ // //spMsg.Visibility = System.Windows.Visibility.Collapsed; // //this.DialogResult = true; //} XElement element = applicationViewModel.SerializeCanvas(); CanvasDto dto = new CanvasDto(); dto.CanvasName = txtSaveTitle.Text; dto.CanvasDescription = txtSaveDesc.Text; dto.CreatedDate = DateTime.Now; dto.ModifiedDate = DateTime.Now; // dto.DatasourceID = applicationViewModel.LoggedInUser.UserDto.DatasourceID; dto.DatasourceID = applicationViewModel.EwavSelectedDatasource.DatasourceID; dto.XmlData = element; dto.UserId = Convert.ToInt32(applicationViewModel.LoggedInUser.UserDto.UserID); dto.IsNewCanvas = true; applicationViewModel.SelectedCanvasName = txtSaveTitle.Text; applicationViewModel.SaveCanvas(element, dto); }
/// <summary> /// Handles the Click event of the btnFinish control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param> private void btnFinish_Click(object sender, System.Windows.RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } Storyboard2.Begin(); tbStep1.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)); rectStep1.Fill = new SolidColorBrush(Color.FromArgb(255, 38, 198, 48)); tbStep2.Foreground = new SolidColorBrush(Color.FromArgb(255, 122, 122, 122)); rectStep2.Fill = new SolidColorBrush(Color.FromArgb(255, 122, 122, 122)); //userDto = userDtoCopy; //this.SelectedUserDto = new UserDTO(); if (this.SelectedUserDto == null) { this.SelectedUserDto = new UserDTO(); } this.SelectedUserDto.FirstName = tbFirstName.Text; this.SelectedUserDto.LastName = tbLastName.Text; if (ApplicationViewModel.Instance.AuthenticationMode.ToString().ToLower() == "windows") { this.SelectedUserDto.Email = tbEmailAddress.Text.ToString().ToLower(); this.SelectedUserDto.UserName = tbUserID.Text.ToString().ToLower(); } else { this.SelectedUserDto.Email = autoEmail.Text.ToString().ToLower(); this.SelectedUserDto.UserName = autoEmail.Text.ToLower(); } this.SelectedUserDto.Phone = tbPhone.Text; //this.SelectedUserDto.RoleValue = Convert.ToInt32(Enum.Parse(typeof(RolesEnum), ((ComboBoxItem)cmbRole.SelectedValue).Content.ToString(), false)); this.SelectedUserDto.UserRoleInOrganization = ((ComboBoxItem)cmbRole.SelectedItem).Content.ToString(); // cmbRole.SelectedValue.ToString(); //this.SelectedUserDto.OrganizationID = User.Instance.UserDto.OrganizationID; this.SelectedUserDto.DatasourceList = ReadDatasourceList(this.SelectedUserDto.UserRoleInOrganization); UserOrganizationDto dto = new UserOrganizationDto(); dto.Organization = new OrganizationDto(); dto.Organization.Active = this.SelectedOrg.Active; dto.Organization.AdminCount = this.SelectedOrg.AdminCount; dto.Organization.AnalystCount = this.SelectedOrg.AnalystCount; dto.Organization.DatasourceCount = this.SelectedOrg.DatasourceCount; dto.Organization.DatasourcesCount = this.SelectedOrg.DatasourcesCount; dto.Organization.Description = ""; dto.Organization.Id = this.SelectedOrg.Id; dto.Organization.Name = this.SelectedOrg.Name; dto.Organization.SuperAdminCount = this.SelectedOrg.SuperAdminCount; dto.Organization.TotalUserCount = this.SelectedOrg.TotalUserCount; dto.RoleId = Convert.ToInt32(Enum.Parse(typeof(RolesEnum), ((ComboBoxItem)cmbRole.SelectedValue).Content.ToString(), false)); dto.Active = (cmbActive.SelectionBoxItem.ToString() == "Yes") ? true : false; switch (Mode) { case ModeType.Add: dto.User = this.SelectedUserDto; uvm.AddUser(dto); uvm.UserAdded += new EventHandler(uvm_UserAdded); uvm.UserAddedFailed += new EventHandler(uvm_UserAddedFailed); break; case ModeType.Edit: this.SelectedUserDto.UserID = this.SelectedUserDto.UserID; this.SelectedUserDto.PasswordHash = this.SelectedUserDto.PasswordHash; this.SelectedUserDto.UserEditType = UserEditType.EditingUserInfo; dto.User = this.SelectedUserDto; uvm.UpdateUser(dto); uvm.UserUpdated += new EventHandler(uvm_UserUpdated); break; default: break; } btnFinish.IsEnabled = false; this.DialogResult = true; }
/// <summary> /// Handles the Click event of the btnSaveOrgDetails control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs" /> instance containing the event data.</param> private void btnSaveOrgDetails_Click(object sender, RoutedEventArgs e) { if (ApplicationViewModel.Instance.DemoMode) { DemoMode dm = new DemoMode(); dm.Show(); return; } if (addEditMode == Organizations.AddEditMode.Edit) { if (ValidateForm()) { organizationViewModel = new OrganizationViewModel(); organizationViewModel.DtoUpdated += new EventHandler <NotificationEventArgs <Exception> >(organizationViewModel_DtoUpdated); // OrganizationDto modelODto = organizationViewModel.OrganizationDtoList.Single(x => x.Id == this.selectedOrgID); modelODto = this.DataContext as OrganizationDto; modelODto.Name = tbOrganizationName.Text; modelODto.Active = (((ComboBoxItem)cboActive.SelectedItem).Content.ToString() == "Yes") ? true : false; organizationViewModel.Update(modelODto); //Code to show success message on edit organization //SucessMsg.Text = "Organization " + tbOrganizationName.Text + " has been updated."; //imgSMsg.Visibility = System.Windows.Visibility.Visible; //spMsg.Visibility = System.Windows.Visibility.Visible; } } else { if (ValidateForm()) { //string s = ((ComboBoxItem)cboActive.SelectedItem).Content.ToString(); bool IsActive = false; if (((ComboBoxItem)cboActive.SelectedItem).Content.ToString() == "Yes") { IsActive = true; } userOrgDto = new UserOrganizationDto(); newOrganizationDto = new OrganizationDto() { Active = true, Id = -1, Name = tbOrganizationName.Text, AdminCount = 0, AnalystCount = 0, DatasourceCount = 0, DatasourcesCount = 0, Description = null, SuperAdminCount = 0, TotalUserCount = 0 }; if (userDto != null) { newAdminDto = userDto; } else { newAdminDto = new UserDTO() { FirstName = tbFirstName.Text, LastName = tbLastName.Text, //OrganizationID = -1, Phone = tbPhone.Text, UserID = -1, //UserName = autoEmail.Text, //"default user name", //Email = autoEmail.Text, //RoleValue = 2, IsActive = true, IsExistingUser = false }; } //newOrganizationDto.AdminList = new List<UserDTO>(); //newOrganizationDto.AdminList.Add(newAdminDto); if (ApplicationViewModel.Instance.AuthenticationMode.ToString().ToLower() == "windows") { newAdminDto.Email = tbEmailAddress.Text.ToString().ToLower(); newAdminDto.UserName = tbUserId.Text.ToString().ToLower(); } else { newAdminDto.Email = autoEmail.Text.ToString().ToLower(); newAdminDto.UserName = autoEmail.Text; } userOrgDto.Organization = newOrganizationDto; userOrgDto.User = newAdminDto; userOrgDto.RoleId = 2; userOrgDto.Active = IsActive; organizationViewModel = new OrganizationViewModel(); organizationViewModel.DtoAdded += new EventHandler <NotificationEventArgs <Exception> >(organizationViewModel_DtoAdded); organizationViewModel.Add(userOrgDto); //Code to show success message on add organization //SucessMsg.Text = "Organization " + tbOrganizationName.Text + " has been added."; //imgSMsg.Visibility = System.Windows.Visibility.Visible; //spMsg.Visibility = System.Windows.Visibility.Visible; //spMsg.Background = new SolidColorBrush(Color.FromArgb(255, 241, 202, 194)); //pink BK to use in case of error //errMsg.Foreground = new SolidColorBrush(Color.FromArgb(255, 96, 25, 25)); //dark pink text color to use in case of error. //imgerrMsg.Visibility = System.Windows.Visibility.Collapsed; // error icon } } }