Exemple #1
0
        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);
            }
        }
Exemple #2
0
        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);
            }
        }