private void CreateUser() { if (ValidateData()) { string rootDirectoryPath = DirectoriesController.GetUserRootFolder(login); string ezkoAvatarImagePath = DirectoriesController.GetEzkoUserImagePath(login, avatarImagePath); //if creation of new user is succesful, we need co create EZKO directory //structure for newly created user and copy image to that location if (ezkoController.CreateUser(login, email, roleID, password, rootDirectoryPath, ezkoAvatarImagePath) && DirectoriesController.CreateUserFolderStructure(login) && DirectoriesController.CopyFile(avatarImagePath, ezkoAvatarImagePath)) { BasicMessagesHandler.ShowInformationMessage("Požívateľ bol úspešne vytvorený"); } else { BasicMessagesHandler.ShowErrorMessage("Pri vytváraní požívateľa sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { Budget item = senderGrid.Rows[e.RowIndex].Tag as Budget; if (senderGrid.Columns[e.ColumnIndex].Name == "Edit") { EditItem(item); } else if (senderGrid.Columns[e.ColumnIndex].Name == "Remove") { RemoveItem(item); } else if (senderGrid.Columns[e.ColumnIndex].Name == "Pdf") { string path = DirectoriesController.GetPatientDocumentsFolder(item.Patient) + @"\" + item.PdfFile(); BudgetToPDF budgetToPdf = new BudgetToPDF(path, item); if (budgetToPdf.CreatePdf()) { System.Diagnostics.Process.Start(path); } else { BasicMessagesHandler.ShowInformationMessage("Pri vytváraní PDF súboru sa vyskytla chyba"); } } } }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { DataGridView senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { Patient item = senderGrid.Rows[e.RowIndex].Tag as Patient; if (senderGrid.Columns[e.ColumnIndex].Name == "Edit") { EditItem(item); } else if (senderGrid.Columns[e.ColumnIndex].Name == "Remove") { RemoveItem(item); } else if (senderGrid.Columns[e.ColumnIndex].Name == "PdfExport") { string path = DirectoriesController.GetPatientDocumentsFolder(item) + @"\" + item.FullName + "_EZKO.pdf"; EhrToPDF ehrToPdf = new EhrToPDF(path, item, GlobalSettings.User, ezkoController); if (ehrToPdf.CreatePdf()) { System.Diagnostics.Process.Start(path); } else { BasicMessagesHandler.ShowInformationMessage("Pri vytváraní PDF dokumentácie sa vyskytla chyba"); } } } }
private void AdministrationUserControl_Load(object sender, EventArgs e) { controlNameLabel.Text = LanguageController.GetText(StringKeys.Administration); usersMenuItem.MenuItemText = LanguageController.GetText(StringKeys.Users); usersMenuItem.TooltipText = LanguageController.GetText(StringKeys.UsersTooltip); userLoginLabel.Text = GlobalSettings.User?.Login; userPictureBox.Image = DirectoriesController.GetImage(GlobalSettings.User?.AvatarImagePath, Properties.Resources.noUserImage_white); }
private void FillDataGridView() { dataGridView.Rows.Clear(); foreach (var item in ezkoController.GetUsers()) { int rowIndex = dataGridView.Rows.Add(new object[] { item.ID, DirectoriesController.GetImage(item.AvatarImagePath, Properties.Resources.noUserImage), item.Login, GetRoleName(item.RoleID), "", "Upraviť", "Zmazať", " " }); dataGridView.Rows[rowIndex].Tag = item; } }
private void FillDataGridView(IQueryable <Patient> patients) { dataGridView.Rows.Clear(); foreach (var item in patients) { int rowIndex = dataGridView.Rows.Add(new object[] { item.ID, DirectoriesController.GetImage(item.AvatarImagePath, Properties.Resources.noUserImage), item.FullName, item.Contact.Phone, item.Contact.Email, item.Address?.FullAddress ?? "Nezadané", "", "EZKO", "PDF", "Zmazať" }); dataGridView.Rows[rowIndex].Tag = item; } }
private void InitializeForm() { if (user != null) { login = user.Login; email = user.Email; avatarPictureBox.Image = DirectoriesController.GetImage(user.AvatarImagePath, Properties.Resources.noUserImage); userNameTextBox.ReadOnly = true; } userRolesDictionary = new Dictionary <string, int>(); InitializeRoleComboBox(); }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { Address address = ezkoController.CreateAddress(street, streetNumber, city, zip, country); Contact contact = ezkoController.CreateContact(email, phone); if (contact != null) { Patient patient = ezkoController.CreatePatient(name, surname, birthDate, BIFO, legalRepresentative, titleBefore, titleAfter, birthNumber, insuranceCompany, sex, address, contact); if (patient != null) { if (DirectoriesController.CreatePatientFolderStructure(patient)) { string rootFolderPath = DirectoriesController.GetPatientRootFolder(patient); patient.RootDirectoryPath = rootFolderPath; if (!ezkoController.SaveChanges()) { BasicMessagesHandler.ShowErrorMessage("Nepodarilo sa uložiť cestu ku koreňovému adresáru pacienta."); } } else { BasicMessagesHandler.ShowErrorMessage("Nepodarilo vytvoriť adresárovú štruktúru pre nového pacienta."); } } else { BasicMessagesHandler.ShowErrorMessage("Pacienta sa nepodarilo vytvoriť."); } } else { BasicMessagesHandler.ShowErrorMessage("Nepodarilo sa vytvoriť pacienta. Nastala chyba pri vytvorení kontaktu."); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void editLoggedUserButton_Click(object sender, EventArgs e) { if (GlobalSettings.User != null) { EditUserForm form = new EditUserForm(GlobalSettings.User); if (form.ShowDialog() == DialogResult.OK) { if (userControlPanel != null) { userControlPanel.UpdateControl(); } userPictureBox.Image = DirectoriesController.GetImage(GlobalSettings.User?.AvatarImagePath, Properties.Resources.noUserImage_white); } } }
private void EditUser() { if (ValidateData()) { string rootDirectoryPath = user.RootDirectoryPath; string ezkoAvatarImagePath = DirectoriesController.GetEzkoUserImagePath(user.Login, avatarImagePath); //if editing of the user is succesful, we need to copy choosen image into users EZKO root folder if (ezkoController.EditUser(user, email, roleID, password, ezkoAvatarImagePath) && DirectoriesController.CopyFile(avatarImagePath, ezkoAvatarImagePath)) { //BasicMessagesHandler.ShowInformationMessage("Požívateľ bol úspešne upravený"); } else { BasicMessagesHandler.ShowErrorMessage("Pri editovaní požívateľa sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } }
public DirectoriesControllerTest() { _mockClient = new Mock <IClient>(); _controller = new DirectoriesController(_mockClient.Object); }