private void CreateData() { try { Cursor = Cursors.WaitCursor; List <FieldForm> formFields = formEditor.FormFields; if (ValidateData(formFields)) { if (ezkoController.CreateFormular(name, formFields)) { BasicMessagesHandler.ShowInformationMessage("Anamnestický formulár bol úspešne vytvorený"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania anamnestického formulára sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
public void EditField(Field item) { try { EditFieldForm form = new EditFieldForm(item); if (form.ShowDialog() == DialogResult.OK) { //if (formular != null) //{ // //FieldForm fieldForm = formular.FieldForms.FirstOrDefault(x => x.Field.ID == item.ID); // //if (fieldForm != null) // // formEditor.UpdateFieldForm(fieldForm); // //else // // formEditor.RemoveField(item.ID); //} //else formEditor.AddOrUpdateField(item, true, false); FillFieldDataGridView(item.Section.Fields); } SelectRow(item); fieldsLabelText = item.Section.Name; section = item.Section; } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Počas editovania poľa EZKO sa vyskytla chyba", ex); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (ezkoController.CreateInsuranceCompany(insuranceCompanyName, insuranceCompanyCode)) { BasicMessagesHandler.ShowInformationMessage("Poisťovňa bola úspešne vytvorená"); } else { BasicMessagesHandler.ShowErrorMessage("Pri vytváraní poisťovňe sa vyskytla chyba!"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void LoginUser() { try { var login = userNameTextBox.Text.Trim(); var password = passwordTextBox.Text.Trim(); switch (ezkoController.ValidateLogin(login, password)) { case DatabaseCommunicator.Enums.LoginResultEnum.SuccesfullyLoggedIn: GlobalSettings.User = ezkoController.GetUserByLogin(login); DialogResult = DialogResult.OK; break; case DatabaseCommunicator.Enums.LoginResultEnum.BadLoginData: BasicMessagesHandler.ShowErrorMessage(LanguageController.GetText(StringKeys.BadLoginData)); DialogResult = DialogResult.None; break; case DatabaseCommunicator.Enums.LoginResultEnum.InactiveUser: BasicMessagesHandler.ShowErrorMessage(LanguageController.GetText(StringKeys.InactiveUser)); DialogResult = DialogResult.None; break; default: break; } } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage(LanguageController.GetText(StringKeys.LoginError), e); } }
private void UpdateData() { try { Cursor = Cursors.WaitCursor; List <FieldForm> formFields = formEditor.FormFields; if (ValidateData(formFields)) { if (ezkoController.EditFormular(formular, name, formFields)) { BasicMessagesHandler.ShowInformationMessage("Formulár bol úspešne upravený"); DialogResult = DialogResult.None; } else { BasicMessagesHandler.ShowErrorMessage("Počas úpravy formulára sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void LoadAction() { if (action == null) { return; } try { actionName = action.Name; shortName = action.ShortName; longName = action.LongName; material = action.Material; recommendedLength = action.RecommendedLength; costs = action.Costs; margin = action.Margin; if (action.Field != null) { field = action.Field; } insuranceCompany = action.InsuranceCompany; insuranceCompanyMargin = action.InsuranceCompanyMargin; hasSpecification = action.HasSpecification; } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Pri načítavaní výkonu sa vyskytla chyba", e); } }
private void ShowItems() { try { if (calendar != null && calendar.Items != null && calendar.Items.Count > 0) { calendar.Items.Clear(); } if (calendarItems == null) { return; } foreach (CalendarItem item in calendarItems) { if (calendar.ViewIntersects(item)) { if (!item.IsDeleted) { calendar.Items.Add(item); } } } } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Vyskytla sa chyba pri zobrazovaní udalostí", e); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { List <EventBillItem> billItems = GetBillItems(); if (billItems == null) { DialogResult = DialogResult.None; } else { if (!ezkoController.CreateEventBill(calendarEvent, billItems)) { DialogResult = DialogResult.None; BasicMessagesHandler.ShowErrorMessage("Účet sa nepodarilo vytvoriť"); } } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private List <EventBillItem> GetBillItems() { List <EventBillItem> result = new List <EventBillItem>(); try { for (int row = 0; row < billingItemsGridView.RowCount - 1; row++) { DataGridViewRow gridRow = billingItemsGridView.Rows[row]; EventBillItem billItem = new EventBillItem() { Name = gridRow.Cells["Name"].Value.ToString().Trim(), Count = int.Parse(gridRow.Cells["Count"].Value.ToString().Split(new[] { ' ' })[0]), UnitPrice = decimal.Parse(gridRow.Cells["Price"].Value.ToString().Split(new[] { ' ' })[0]), Discount = decimal.Parse(gridRow.Cells["Discount"].Value.ToString().Split(new[] { ' ' })[0]) }; result.Add(billItem); } } catch (Exception ex) { result = null; BasicMessagesHandler.ShowErrorMessage("Počas vytvárania položiek účtu sa vyskytla chyba!", ex); } return(result); }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (ezkoController.CreateInfrastructure(name, description, costs.Value, margin.Value)) { BasicMessagesHandler.ShowInformationMessage("Infraštruktúra bola úspešne vytvorená"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania infraštruktúry sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void addFiledButton_Click(object sender, EventArgs e) { try { EditFieldForm form = new EditFieldForm(); if (form.ShowDialog() == DialogResult.OK) { section = null; fieldsLabelText = "Všetky sekcie"; FillFieldDataGridView(ezkoController.GetFields()); //if new field was added into edited formular if (formular != null) { foreach (var item in formular.FieldForms.Where(x => !x.Field.IsDeleted)) { if (formular.FieldForms.Any(x => x.Field.ID == item.Field.ID)) { formEditor.UpdateFieldForm(item); } } } } } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Pri vytváraní poľa EZKO sa vyskytla chyba", ex); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (ezkoController.CreateSection(name)) { BasicMessagesHandler.ShowInformationMessage("Sekcia EZKO bola úspešne vytvorená"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania sekcie EZKO sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void UpdateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (!ezkoController.EditAction(action, actionName, shortName, longName, material, recommendedLength, costs, margin, insuranceCompanyMargin, insuranceCompany, field, hasSpecification)) { BasicMessagesHandler.ShowErrorMessage("Počas úpravy výkonu sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
public void LoadEvents(CalendarEventFilter filter) { try { loadDurations = true; monthView.EventsDurationByDate = new Dictionary <DateTime, int>(); eventsFlowLayoutPanel.Controls.Clear(); foreach (var item in ezkoController.GetEvents(filter)) { CalendarEventCard card = new CalendarEventCard(item, visitUserControl, item.StateID == (int)DatabaseCommunicator.Enums.EventStateEnum.Payed); card.Width = eventsFlowLayoutPanel.Width - 25; //for AutoSize only in vertical direction card.MaximumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0); card.MinimumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0); eventsFlowLayoutPanel.Controls.Add(card); UpdateDurations(item.StartDate, item.EndDate, false); } monthView.Invalidate(); } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Udalosti sa nepodarilo načítať", e); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (ezkoController.CreateField(name, standardNumber, otherName, fieldType, section, description, fieldValues, question)) { BasicMessagesHandler.ShowInformationMessage("Pole EZKO bolo úspešne vytvorené"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania poľa EZKO sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
/// <summary> /// Marks database events which belong to deleted google calendar events as deleted /// </summary> private void MarkAsDeleted(DateTime startDate, DateTime endDate, List <CalendarItem> dbItems, List <CalendarItem> updateItems) { try { // Define parameters of request. EventsResource.ListRequest request = service.Events.List(calendarID); request.TimeMin = startDate; request.TimeMax = endDate; request.ShowDeleted = false; request.SingleEvents = false; //request.MaxResults = 10; request.OrderBy = EventsResource.ListRequest.OrderByEnum.Updated; // List events Events events = request.Execute(); foreach (var item in dbItems) { if (events.Items.FirstOrDefault(x => x.Id == item.GoogleEventID) == null) { item.IsDeleted = true; if (!updateItems.Contains(item)) { updateItems.Add(item); } } } } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Vyskytla sa chyba pri synchronizácií Google kalendára.", e); } }
private void LoadEvents(DateTime selectionStart, DateTime selectionEnd) { try { if (loadDurations) { LoadDurations(DateTime.Now.AddMonths(-6), DateTime.Now.AddYears(1)); } eventsFlowLayoutPanel.Controls.Clear(); foreach (var item in ezkoController.GetEvents(selectionStart, selectionEnd)) { CalendarEventCard card = new CalendarEventCard(item, visitUserControl, item.StateID == (int)DatabaseCommunicator.Enums.EventStateEnum.Payed); card.Width = eventsFlowLayoutPanel.Width - 25; //for AutoSize only in vertical direction card.MaximumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0); card.MinimumSize = new Size(eventsFlowLayoutPanel.Width - 25, 0); eventsFlowLayoutPanel.Controls.Add(card); } monthView.Invalidate(); } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Udalosti sa nepodarilo načítať", e); } }
private List <BudgetItem> GetBudgetItems() { List <BudgetItem> result = new List <BudgetItem>(); try { for (int i = 0; i < dataGridView.Rows.Count - 1; i++) { DataGridViewRow gridRow = dataGridView.Rows[i]; BudgetItem budgetItem = new BudgetItem() { Name = gridRow.Cells["Name"].Value.ToString(), Count = int.Parse(gridRow.Cells["Count"].Value.ToString().Split(new[] { ' ' })[0]), UnitPrice = decimal.Parse(gridRow.Cells["Price"].Value.ToString().Split(new[] { ' ' })[0]), }; result.Add(budgetItem); } } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Po4as vytvárania rozpočtu sa vyskytla chyba", ex); result = null; } return(result); }
private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) { try { DataGridView senderGrid = (DataGridView)sender; if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0) { if (senderGrid.Columns[e.ColumnIndex].Name == "Remove") { DataGridViewRow clickedRow = senderGrid.Rows[e.RowIndex]; int countToRemove = int.Parse(clickedRow.Cells["Count"].Value.ToString().Split(new[] { ' ' })[0]); decimal priceToRemove = decimal.Parse(clickedRow.Cells["Price"].Value.ToString().Split(new[] { ' ' })[0]); countSum -= countToRemove; priceSum -= (countToRemove * priceToRemove); senderGrid.Rows.RemoveAt(e.RowIndex); UpdateSumRow(); } } } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Pri pokuse o odstránenie položky sa vyskytla chyba", ex); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { List <BudgetItem> budgetItems = GetBudgetItems(); if (budgetItems != null && ezkoController.CreateBudget(name, patient, budgetItems)) { BasicMessagesHandler.ShowInformationMessage("Rozpočet bol úspešne vytvorený"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania rozpočtu sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void UpdateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { List <BudgetItem> budgetItems = GetBudgetItems(); if (budgetItems == null || !ezkoController.EditBudget(budget, name, budgetItems)) { BasicMessagesHandler.ShowErrorMessage("Počas úpravy rozpočtu sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
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 LoadCard() { try { eventStatus = calendarEvent.EventState.ToString(); if (!calendarEvent.IsTemporaryGoogleEvent) { patientLabel.Visible = true; patientName = calendarEvent.Patient.FullName; } else { patientLabel.Visible = false; patientName = calendarEvent.Summary; } noteTextLabel.Text = calendarEvent.Description; noteTextLabel.Location = new Point(noteLabel.Location.X + noteLabel.Width, noteTextLabel.Location.Y); startTextLabel.Text = calendarEvent.StartDate.ToString("dd-MM-yyyy, HH:mm"); endTextLabel.Text = calendarEvent.EndDate.ToString("dd-MM-yyyy, HH:mm"); doctorTextLabel.Text = GetUsersLabel(calendarEvent.Users.Where(x => x.RoleID == (int)UserRoleEnum.Doctor)); nurseTextLabel.Text = GetUsersLabel(calendarEvent.Users.Where(x => x.RoleID == (int)UserRoleEnum.Nurse)); SetPlannedActions(calendarEvent.Actions); SetInfrastructure(calendarEvent.Infrastructures); SetPatientImage(calendarEvent.Patient?.AvatarImagePath); SetBorderColor(); } catch (Exception e) { BasicMessagesHandler.ShowErrorMessage("Návštevu sa nepodarilo načítať", e); } }
private void editSectionButton_Click(object sender, EventArgs e) { string newSectionName = sectionsTextBox.Text.Trim(); Section item = ezkoController.GetSectionByName(newSectionName); //Section item = section; if (item == null && lastPickedSection != null) { if (MessageBox.Show("Naozaj si želáte premenovať existujúcu sekciu " + lastPickedSection.Name + " na " + newSectionName + "?", "Upozornenie", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (ezkoController.EditSection(lastPickedSection, newSectionName)) { InitializeSectionsTextBox(); sectionsTextBox.Text = newSectionName; fieldsLabelText = newSectionName; FillFieldDataGridView(lastPickedSection.Fields); FillSectionsDataGridView(ezkoController.GetSections()); } else { BasicMessagesHandler.ShowErrorMessage("Pri editácií sekcie sa vyskytla chyba"); } } } }
public EventOverviewForm(CalendarEvent calendarEvent) { InitializeComponent(); try { ezkoController = GlobalSettings.EzkoController; this.calendarEvent = calendarEvent; patientName = calendarEvent.Patient.FullName; eventDate = calendarEvent.StartDate.ToString("dd.MM.yyyy HH:mm"); state = calendarEvent.EventState.ToString().ToLower(); if (calendarEvent.PaymentDate.HasValue) { paymentDateLabel.Font = new Font(paymentDateLabel.Font, FontStyle.Regular); paymentDate = calendarEvent.PaymentDate.Value.ToString("dd.MM.yyyy HH:mm"); payEventButton.Visible = false; } else if (calendarEvent.StateID != (int)EventStateEnum.Done) { payEventButton.Visible = false; } doneText = calendarEvent.ExecutedActionText; InitializeDoneActionsGrid(); InitializeBillingGrid(); } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Pri načítaní podrobností o návšteve sa vyskytla chyba", ex); } }
private void CreateData() { try { Cursor = Cursors.WaitCursor; if (ValidateData()) { if (ezkoController.CreateAction(actionName, shortName, longName, material, recommendedLength, costs, margin, insuranceCompanyMargin, insuranceCompany, field, hasSpecification)) { BasicMessagesHandler.ShowInformationMessage("Výkon bol úspešne vytvorený"); } else { BasicMessagesHandler.ShowErrorMessage("Počas vytvárania výkonu sa vyskytla chyba"); } } else { DialogResult = DialogResult.None; } } catch (Exception e) { BasicMessagesHandler.LogException(e); } Cursor = Cursors.Default; }
private void InitializeControl() { try { calendarSynchronizer = new GoogleCalendarSynchronizer.GoogleCalendarSynchronizer(calendar, GlobalSettings.GoogleCalendarUserName); LoadEvents(DateTime.Now.AddMonths(-6), DateTime.Now.AddYears(1)); } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Vyskytla sa chyba pri načítaní udalostí", ex); } }
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 AddToFormular(Field item) { try { if (formEditor.AddOrUpdateField(item, false, true)) { BasicMessagesHandler.ShowInformationMessage("Toto pole sa už vo formulári nachádza"); } } catch (Exception ex) { BasicMessagesHandler.ShowErrorMessage("Počas pridávania poľa EZKO do formulára vyskytla chyba", ex); } }
private void RemoveItem(Field item) { if (MessageBox.Show("Naozaj si želáte odstrániť pole " + item.Name, "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (!ezkoController.RemoveField(item)) { BasicMessagesHandler.ShowErrorMessage("Pole EZKO sa nepodarilo odstrániť"); } else { FillDataGridView(); } } }