Exemplo n.º 1
0
        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridView senderGrid = (DataGridView)sender;

            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn && e.RowIndex >= 0)
            {
                DatabaseCommunicator.Model.Form item = senderGrid.Rows[e.RowIndex].Tag as DatabaseCommunicator.Model.Form;
                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 == "Fill")
                {
                    FillItem(item);
                }
                else if (senderGrid.Columns[e.ColumnIndex].Name == "Pdf")
                {
                    string    path        = DirectoriesController.GetFormsFolder() + @"\" + item.PdfFile();
                    FormToPDF budgetToPdf = new FormToPDF(path, item);
                    if (budgetToPdf.CreatePdf())
                    {
                        System.Diagnostics.Process.Start(path);
                    }
                    else
                    {
                        BasicMessagesHandler.ShowInformationMessage("Pri vytváraní PDF súboru sa vyskytla chyba");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void FillItem(DatabaseCommunicator.Model.Form item)
        {
            FillQuestionnaireForm form = new FillQuestionnaireForm(item);

            if (form.ShowDialog() == DialogResult.OK)
            {
            }
        }
Exemplo n.º 3
0
        private void EditItem(DatabaseCommunicator.Model.Form item)
        {
            EditFormularForm form = new EditFormularForm(item);

            if (form.ShowDialog() == DialogResult.OK)
            {
                FillDataGridView();
            }
        }
Exemplo n.º 4
0
        private void dataGridView_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            DataGridView senderGrid = (DataGridView)sender;

            if (e.RowIndex >= 0)
            {
                DatabaseCommunicator.Model.Form item = senderGrid.Rows[e.RowIndex].Tag as DatabaseCommunicator.Model.Form;
                EditItem(item);
            }
        }
Exemplo n.º 5
0
        public FillQuestionnaireForm(DatabaseCommunicator.Model.Form form)
        {
            InitializeComponent();

            this.form                  = form;
            ezkoController             = GlobalSettings.EzkoController;
            autoCompleteTextBox.Values = ezkoController.GetPatients().ToArray();

            formTitleLabel.Text = form.Name;

            FormGenerator.GenerateForm(flowLayoutPanel, form);
        }
Exemplo n.º 6
0
 private void RemoveItem(DatabaseCommunicator.Model.Form item)
 {
     if (MessageBox.Show("Naozaj si želáte odstrániť formulár " + item.Name, "?",
                         MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         if (!ezkoController.RemoveFormular(item))
         {
             BasicMessagesHandler.ShowErrorMessage("Formulár sa nepodarilo odstrániť");
         }
         else
         {
             FillDataGridView();
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Loads EZKO formular into mainPanel of the FormEditorControl
        /// </summary>
        /// <param name="formular">Formular which has to be loaded</param>
        public void LoadFormular(DatabaseCommunicator.Model.Form formular)
        {
            if (formular == null)
            {
                return;
            }

            if (Commands == null)
            {
                Commands = new List <CardCommand>();
            }

            mainPanel.Controls.Clear();

            formNameLabel.Text = formular.Name;

            FormFieldCard lastAddedCard = null;

            foreach (var item in formular.FieldForms.Where(x => !x.Field.IsDeleted).OrderBy(x => x.Question.Index))
            {
                FormFieldCard card = new FormFieldCard()
                {
                    //Question = item.Question.Value,
                    Question        = item.Field.Question,
                    CardWidth       = mainPanel.Width - diffX,
                    EditorMainPanel = mainPanel,
                    MainControl     = this,
                };
                card.CardMouseMove     += card_MouseMove;
                card.CardMouseUp       += card_MouseUp;
                card.RemoveButtonClick += card_RemoveButtonClick;
                card.SetField(item.Field);

                if (lastAddedCard != null)
                {
                    lastAddedCard.BelowCard = card;
                }

                lastAddedCard = card;
                mainPanel.Controls.Add(card);

                AddCommand(new CardCommand(card, Enums.CardCommandEnum.Add));
            }

            RedrawFormular();
        }
Exemplo n.º 8
0
        public EditFormularForm(DatabaseCommunicator.Model.Form formular)
        {
            InitializeComponent();

            try
            {
                workingType     = WorkingTypeEnum.Editing;
                ezkoController  = GlobalSettings.EzkoController;
                this.formular   = formular;
                addButton.Text  = "Upraviť formulár";
                fieldsLabelText = "Všetky sekcie";

                InitializeSectionsTextBox();
                InitializeFormular();
                InitializeDataGridViews();
            }
            catch (Exception ex)
            {
                BasicMessagesHandler.ShowErrorMessage("Počas inicializácie okna pre editáciu formulárov sa vyskytla chyba", ex);
            }
        }
Exemplo n.º 9
0
        public static void GenerateForm(FlowLayoutPanel flowPanel, DatabaseCommunicator.Model.Form form)
        {
            //AddSectionLabel(flowPanel, form.Name);

            foreach (var item in form.FieldForms.Where(x => !x.Field.IsDeleted).OrderBy(x => x.Question.Index))
            {
                AddSplitter(flowPanel);
                AddFieldLabel(flowPanel, item.Question.Value);
                AddSplitter(flowPanel);

                switch (item.Field.TypeID)
                {
                case (int)FieldTypeEnum.Text:
                    AddTextBox(flowPanel, item.Field, null);
                    break;

                case (int)FieldTypeEnum.LongText:
                    AddLongTextBox(flowPanel, item.Field, null);
                    break;

                case (int)FieldTypeEnum.RadioBox:
                    AddRadioButtons(flowPanel, item.Field.FieldValues, null);
                    break;

                case (int)FieldTypeEnum.CheckBox:
                    AddCheckBoxes(flowPanel, item.Field.FieldValues, null);
                    break;

                case (int)FieldTypeEnum.SelectBox:
                    AddComboBox(flowPanel, item.Field.FieldValues, null);
                    break;

                default:
                    break;
                }
            }
        }