Exemplo n.º 1
0
 private void textBoxPhone_KeyPress_1(object sender, KeyPressEventArgs e)
 {
     FormHandler.allowOnlyNumbers(sender, e);
 }
Exemplo n.º 2
0
 public void validateDecTextBoxOnHandler(TextBox txtb)
 {
     FormHandler.validateDecimalTextBox(txtb, errorProvider, buttonSave);
 }
Exemplo n.º 3
0
 //allows only numbers and . in docnumber field
 private void textBoxDocNumber_KeyPress(object sender, KeyPressEventArgs e)
 {
     FormHandler.allowOnlyCharsAndSpace(sender, e);
 }
Exemplo n.º 4
0
 private void dateTimePickerFechaHasta_ValueChanged(object sender, EventArgs e)
 {
     FormHandler.limpiar(groupBox2);
     dataGridView1.Rows.Clear();
     habitaciones.Clear();
 }
Exemplo n.º 5
0
 private void buttonLimpiar_Click(object sender, EventArgs e)
 {
     FormHandler.limpiar(this);
     FormHandler.limpiar(groupBox2);
     FormHandler.limpiar(groupBox1);
 }
Exemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     FormHandler.limpiar(this.groupBoxInactividad);
 }
Exemplo n.º 7
0
 public abstract string CheckData(FormHandler formHandler);
Exemplo n.º 8
0
        public override string CheckData(FormHandler formHandler)
        {
            //linux服务的名称
            var serviceNameItem = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("serviceName"));

            if (serviceNameItem == null || string.IsNullOrEmpty(serviceNameItem.TextValue))
            {
                return("serviceName required");
            }

            _serviceName = serviceNameItem.TextValue.Trim();


            //要运行的可执行程序的名称
            var serviceExecItem = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("execFilePath"));

            if (serviceExecItem == null || string.IsNullOrEmpty(serviceExecItem.TextValue))
            {
                return("execFilePath required");
            }

            _serviceExecName = serviceExecItem.TextValue.Trim();


            //发布版本
            var dateTimeFolderName = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("deployFolderName"));

            if (dateTimeFolderName != null && !string.IsNullOrEmpty(dateTimeFolderName.TextValue))
            {
                _dateTimeFolderName = dateTimeFolderName.TextValue;
            }

            //是否是增量发布
            var isIncrement = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("isIncrement"));

            if (isIncrement != null && !string.IsNullOrEmpty(isIncrement.TextValue) && isIncrement.TextValue.ToLower().Equals("true"))
            {
                _isIncrement = true;
            }

            //是否不重新启动
            var isNoStopWebSite = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("isNoStopWebSite"));

            if (isNoStopWebSite != null && !string.IsNullOrEmpty(isNoStopWebSite.TextValue) && isNoStopWebSite.TextValue.ToLower().Equals("true"))
            {
                _isNoStopWebSite = true;
            }

            //指定的物理路径
            var physicalPath = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("physicalPath"));

            if (physicalPath != null && !string.IsNullOrEmpty(physicalPath.TextValue))
            {
                _physicalPath = physicalPath.TextValue;
            }

            //linux服务的描述
            var desc = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("desc"));

            if (desc != null && !string.IsNullOrEmpty(desc.TextValue))
            {
                _serviceDescription = desc.TextValue;
            }

            //设置环境变量?
            var startType = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("startType"));

            if (startType != null && !string.IsNullOrEmpty(startType.TextValue))
            {
                _serviceStartType = startType.TextValue;
            }

            var envType = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("env"));

            if (envType != null && !string.IsNullOrEmpty(envType.TextValue))
            {
                _env = envType.TextValue;
            }

            var notify = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("notify"));

            if (notify != null && !string.IsNullOrEmpty(notify.TextValue) && notify.TextValue.ToLower() == "true")
            {
                _notify = true;
            }

            var backUpIgnoreList = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("backUpIgnore"));

            if (backUpIgnoreList != null && !string.IsNullOrEmpty(backUpIgnoreList.TextValue))
            {
                this._backUpIgnoreList = backUpIgnoreList.TextValue.Split(new string[] { "@_@" }, StringSplitOptions.None).ToList();
            }

            return(string.Empty);
        }
Exemplo n.º 9
0
 private void loadComboBoxCountries()
 {
     FormHandler.loadCountriesToCombo(comboBoxCountry);
 }
Exemplo n.º 10
0
 private void comboBox1_Validating(object sender, CancelEventArgs e)
 {
     FormHandler.validateEmptyComboBox(comboBoxMode, errorProvider, buttonCharge);
 }
Exemplo n.º 11
0
 public override string CheckData(FormHandler formHandler)
 {
     return(string.Empty);
 }
Exemplo n.º 12
0
        public object PersistForm(PersistFormRequest request)
        {
            // Variables.
            var result      = default(object);
            var formsRootId = GuidHelper.GetGuid(FormConstants.Id);
            var parentId    = GuidHelper.GetGuid(request.ParentId);


            // Catch all errors.
            try
            {
                // Parse or create the form ID.
                var isNew  = string.IsNullOrWhiteSpace(request.FormId);
                var formId = isNew
                    ? Guid.NewGuid()
                    : GuidHelper.GetGuid(request.FormId);


                // Get the fields.
                var fields = request.Fields.MakeSafe()
                             .Select(x =>
                {
                    var fieldType         = Type.GetType(x.TypeFullName);
                    var fieldTypeInstance = FormFieldTypeCollection
                                            .FirstOrDefault(y => y.GetType() == fieldType);

                    var field = new FormField(fieldTypeInstance)
                    {
                        Id = string.IsNullOrWhiteSpace(x.Id)
                                ? Guid.NewGuid()
                                : GuidHelper.GetGuid(x.Id),
                        Alias       = x.Alias,
                        Name        = x.Name,
                        Label       = x.Label,
                        Category    = x.Category,
                        Validations = x.Validations.MakeSafe()
                                      .Select(y => GuidHelper.GetGuid(y)).ToArray(),
                        FieldConfiguration = JsonHelper.Serialize(x.Configuration)
                    };
                    return(field);
                })
                             .ToArray();


                // Get the handlers.
                var handlers = request.Handlers.MakeSafe().Select(x =>
                {
                    var handlerType         = Type.GetType(x.TypeFullName);
                    var handlerTypeInstance = FormHandlerTypeCollection
                                              .FirstOrDefault(y => y.GetType() == handlerType);

                    var handler = new FormHandler(handlerTypeInstance)
                    {
                        Id = string.IsNullOrWhiteSpace(x.Id)
                            ? Guid.NewGuid()
                            : GuidHelper.GetGuid(x.Id),
                        Alias   = x.Alias,
                        Name    = x.Name,
                        Enabled = x.Enabled,
                        HandlerConfiguration = JsonHelper.Serialize(x.Configuration)
                    };

                    return(handler);
                }).ToArray();


                // Get the ID path.
                var parent = parentId == Guid.Empty ? null : Entities.Retrieve(parentId);
                var path   = parent == null
                    ? new[] { formsRootId, formId }
                    : parent.Path.Concat(new[] { formId }).ToArray();


                // Create the form.
                var form = new Form()
                {
                    Id       = formId,
                    Path     = path,
                    Alias    = request.Alias,
                    Name     = request.Name,
                    Fields   = fields,
                    Handlers = handlers
                };


                // Persist the form.
                Persistence.Persist(form);


                // For new forms, automatically create a layout and a form configuration.
                var layoutNamePrefix  = "Layout for ";
                var layoutNameSuffix  = " (Autogenerated)";
                var layoutAliasPrefix = "layout_";
                var layoutAliasSuffix = "_autogenerated";
                var autoLayoutData    = JsonHelper.Serialize(new
                {
                    rows = new[]
                    {
                        new
                        {
                            cells = new []
                            {
                                new
                                {
                                    columnSpan = 12,
                                    fields     = form.Fields.Select(x => new
                                    {
                                        id = GuidHelper.GetString(x.Id)
                                    })
                                }
                            }
                        }
                    },
                    formId       = GuidHelper.GetString(form.Id),
                    autopopulate = true
                });
                if (isNew)
                {
                    // Create new layout.
                    var layoutId = Guid.NewGuid();
                    var layout   = new Layout()
                    {
                        KindId = GuidHelper.GetGuid(app.Constants.Layouts.LayoutBasic.Id),
                        Id     = layoutId,
                        Path   = new[] { GuidHelper.GetGuid(LayoutConstants.Id), layoutId },
                        Name   = layoutNamePrefix + request.Name + layoutNameSuffix,
                        Alias  = layoutAliasPrefix + request.Alias + layoutAliasSuffix,
                        Data   = autoLayoutData
                    };


                    // Persist layout.
                    LayoutPersistence.Persist(layout);


                    // Create a new form configuration.
                    var plainJsTemplateId = GuidHelper.GetGuid("f3fb1485c1d14806b4190d7abde39530");
                    var template          = Config.Templates.FirstOrDefault(x => x.Id == plainJsTemplateId)
                                            ?? Config.Templates.FirstOrDefault();
                    var configId       = Guid.NewGuid();
                    var configuredForm = new ConfiguredForm()
                    {
                        Id         = configId,
                        Path       = path.Concat(new[] { configId }).ToArray(),
                        Name       = request.Name,
                        TemplateId = template?.Id,
                        LayoutId   = layoutId
                    };


                    // Persist form configuration.
                    ConFormPersistence.Persist(configuredForm);
                }


                // Get existing layouts that should autopopulate.
                var layouts = GetFormLayouts(null)
                              .Select(x => new
                {
                    Layout        = x,
                    Configuration = x.DeserializeConfiguration() as LayoutBasicConfiguration
                })
                              .Where(x => x.Configuration != null)
                              .Where(x => x.Configuration.FormId.HasValue && x.Configuration.FormId.Value == formId)
                              .Where(x => x.Configuration.Autopopulate);


                //: Autopopulate the layouts.
                foreach (var existingLayout in layouts)
                {
                    existingLayout.Layout.Data = autoLayoutData;
                    var layoutName  = existingLayout.Layout.Name ?? string.Empty;
                    var layoutAlias = existingLayout.Layout.Alias ?? string.Empty;
                    if (layoutName.StartsWith(layoutNamePrefix) && layoutName.EndsWith(layoutNameSuffix))
                    {
                        existingLayout.Layout.Name = layoutNamePrefix + form.Name + layoutNameSuffix;
                    }
                    if (layoutAlias.StartsWith(layoutAliasPrefix) && layoutAlias.EndsWith(layoutAliasSuffix))
                    {
                        existingLayout.Layout.Alias = layoutAliasPrefix + form.Name + layoutAliasSuffix;
                    }
                    LayoutPersistence.Persist(existingLayout.Layout);
                }


                // Success.
                result = new
                {
                    Success = true,
                    FormId  = GuidHelper.GetString(formId)
                };
            }
            catch (Exception ex)
            {
                // Error.
                Logger.Error <FormsController>(ex, PersistFormError);
                result = new
                {
                    Success = false,
                    Reason  = UnhandledError
                };
            }


            // Return the result.
            return(result);
        }
Exemplo n.º 13
0
 private void validateEmptyComboBox(ComboBox combo)
 {
     FormHandler.validateEmptyComboBox(combo, errorProvider, buttonAvailability);
 }
Exemplo n.º 14
0
 private void loadComboBoxDocType()
 {
     FormHandler.loadDocTypesToCombo(comboBoxDocType, this.gh);
 }
Exemplo n.º 15
0
 private void Alta_Load(object sender, EventArgs e)
 {
     FormHandler.listarTipoDoc(comboBoxTipoDoc);
     comboBoxTipoDoc.SelectedIndex = -1;
 }
Exemplo n.º 16
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     FormHandler.groupBoxCleaner(groupBox);
 }
Exemplo n.º 17
0
        private void guardarCliente_Click(object sender, EventArgs e)
        {
            hayError = false;
            List <TextBox> textBoxes = new List <TextBox> {
                textBoxApellido, textBoxCalle, textBoxDepto, textBoxLocalidad, textBoxMail,
                textBoxNacionalidad, textBoxNombre, textBoxNroCalle, textBoxNumDoc, textBoxPais, textBoxPiso, textBoxTelefono
            };

            if (textBoxes.Any(tb => string.IsNullOrEmpty(tb.Text) || comboBoxTipoDoc.SelectedIndex == -1))
            {
                MessageBox.Show("Debe llenar todos los campos.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (!String.IsNullOrEmpty(textBoxMail.Text.Trim()))
            {
                if (!FormHandler.verificarMail(textBoxMail))
                {
                    MessageBox.Show("El mail tiene un formato invalido.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    hayError = true;
                }
            }

            if (!string.IsNullOrEmpty(textBoxNumDoc.Text.Trim()))
            {
                try
                {
                    Int32.Parse(textBoxNumDoc.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("El número de documento debe ser un número." + Environment.NewLine + "Ingrese su documento sin guiones.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    hayError = true;
                }
            }
            if (!string.IsNullOrEmpty(textBoxTelefono.Text.Trim()))
            {
                try
                {
                    Int32.Parse(textBoxTelefono.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("El teléfono debe ser un número." + Environment.NewLine + " Ingrese su teléfono sin los guiones ni el más.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    hayError = true;
                }
            }

            if (!string.IsNullOrEmpty(textBoxNroCalle.Text.Trim()))
            {
                try
                {
                    Int32.Parse(textBoxNroCalle.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("El número de calle debe ser un número.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    hayError = true;
                }
            }
            if (!string.IsNullOrEmpty(textBoxPiso.Text.Trim()))
            {
                try
                {
                    Int32.Parse(textBoxPiso.Text);
                }
                catch (Exception)
                {
                    MessageBox.Show("El piso debe ser un número.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    hayError = true;
                }
            }
            if (dateTimePickerFechaNacimiento.Value.CompareTo(ConfigManager.FechaSistema) > 0)
            {
                MessageBox.Show("La fecha de nacimiento no puede ser posterior a la fecha actual.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                hayError = true;
            }
            if (hayError)
            {
                hayError = false;
                return;
            }
            try
            {
                int ret = DBHandler.SPWithValue("MATOTA.altaCliente",
                                                new List <SqlParameter> {
                    new SqlParameter("@nombre", textBoxNombre.Text.Trim()),
                    new SqlParameter("@apellido", textBoxApellido.Text.Trim()),
                    new SqlParameter("@tipoDoc", comboBoxTipoDoc.SelectedValue),
                    new SqlParameter("@numeroDocumento", textBoxNumDoc.Text.Trim()),
                    new SqlParameter("@mail", textBoxMail.Text.Trim()),
                    new SqlParameter("@telefono", textBoxTelefono.Text.Trim()),
                    new SqlParameter("@calle", textBoxCalle.Text.Trim()),
                    new SqlParameter("@nroCalle", textBoxNroCalle.Text.Trim()),
                    new SqlParameter("@piso", textBoxPiso.Text.Trim()),
                    new SqlParameter("@departamento", textBoxDepto.Text.Trim()),
                    new SqlParameter("@localidad", textBoxLocalidad.Text.Trim()),
                    new SqlParameter("@pais", textBoxPais.Text.Trim()),
                    new SqlParameter("@nacionalidad", textBoxNacionalidad.Text.Trim()),
                    new SqlParameter("@fechaNacimiento", dateTimePickerFechaNacimiento.Value),
                }
                                                );

                if (ret == -1)
                {
                    MessageBox.Show("El cliente ingresado ya se encuentra registrado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (ret == 0)
                {
                    MessageBox.Show("El mail ingresado ya se encuentra registrado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    textBoxMail.Text = string.Empty;
                }
                else if (ret >= 1)
                {
                    InsertedClient = new Cliente()
                    {
                        nombre = textBoxNombre.Text.Trim(), apellido = textBoxApellido.Text.Trim(), idCliente = ret.ToString()
                    };
                    if (!(dataGridViewCliente == null))
                    {
                        dataGridViewCliente.Rows.Clear();
                        dataGridViewCliente.Rows.Add(comboBoxTipoDoc.Text, textBoxNumDoc.Text, textBoxNombre.Text);
                    }
                    MessageBox.Show("Cliente ingresado con éxito", "Éxito", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                    this.Close();
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Error al agregar al cliente", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 18
0
 private void textBoxPhone_Validating(object sender, CancelEventArgs e)
 {
     validateEmptyTextBoxOnHandler(textBoxPhone);
     FormHandler.validateDecimalTextBox(textBoxPhone, errorProvider, buttonSave);
 }
Exemplo n.º 19
0
        public override string CheckData(FormHandler formHandler)
        {
            var sdkType = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("sdkType"));

            if (sdkType == null || string.IsNullOrEmpty(sdkType.TextValue))
            {
                return("sdkType required");
            }

            var sdkTypeValue = sdkType.TextValue.ToLower();

            if (!new string[] { "netframework", "netcore" }.Contains(sdkTypeValue))
            {
                return($"sdkType value :{sdkTypeValue} is not suppored");
            }

            _sdkTypeName = sdkTypeValue;


            var serviceNameItem = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("serviceName"));

            if (serviceNameItem == null || string.IsNullOrEmpty(serviceNameItem.TextValue))
            {
                return("serviceName required");
            }

            _serviceName = serviceNameItem.TextValue.Trim();


            var serviceExecItem = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("execFilePath"));

            if (serviceExecItem == null || string.IsNullOrEmpty(serviceExecItem.TextValue))
            {
                return("execFilePath required");
            }

            _serviceExecName = serviceExecItem.TextValue.Trim();



            var isProjectInstallServiceItem = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("isProjectInstallService"));

            if (isProjectInstallServiceItem != null && !string.IsNullOrEmpty(isProjectInstallServiceItem.TextValue))
            {
                _isProjectInstallService = isProjectInstallServiceItem.TextValue.Equals("yes");
            }

            var dateTimeFolderName = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("deployFolderName"));

            if (dateTimeFolderName != null && !string.IsNullOrEmpty(dateTimeFolderName.TextValue))
            {
                _dateTimeFolderName = dateTimeFolderName.TextValue;
            }

            var isIncrement = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("isIncrement"));

            if (isIncrement != null && !string.IsNullOrEmpty(isIncrement.TextValue) && isIncrement.TextValue.ToLower().Equals("true"))
            {
                _isIncrement = true;
            }

            var isNoStopWebSite = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("isNoStopWebSite"));

            if (isNoStopWebSite != null && !string.IsNullOrEmpty(isNoStopWebSite.TextValue) && isNoStopWebSite.TextValue.ToLower().Equals("true"))
            {
                _isNoStopWebSite = true;
            }

            var physicalPath = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("physicalPath"));

            if (physicalPath != null && !string.IsNullOrEmpty(physicalPath.TextValue))
            {
                _physicalPath = physicalPath.TextValue;
            }

            var desc = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("desc"));

            if (desc != null && !string.IsNullOrEmpty(desc.TextValue))
            {
                _serviceDescription = desc.TextValue;
            }

            var startType = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("startType"));

            if (startType != null && !string.IsNullOrEmpty(startType.TextValue))
            {
                _serviceStartType = startType.TextValue;
            }

            var backUpIgnoreList = formHandler.FormItems.FirstOrDefault(r => r.FieldName.Equals("backUpIgnore"));

            if (backUpIgnoreList != null && !string.IsNullOrEmpty(backUpIgnoreList.TextValue))
            {
                this._backUpIgnoreList = backUpIgnoreList.TextValue.Split(new string[] { "@_@" }, StringSplitOptions.None).ToList();
            }
            return(string.Empty);
        }
Exemplo n.º 20
0
 private void textBoxStreetNum_Validating(object sender, CancelEventArgs e)
 {
     validateEmptyTextBoxOnHandler(textBoxStreetNum);
     FormHandler.validateIntTextBox(textBoxStreetNum, errorProvider, buttonSave);
 }
Exemplo n.º 21
0
 private void textBoxCantPersonas_TextChanged(object sender, EventArgs e)
 {
     FormHandler.limpiar(groupBox2);
 }
Exemplo n.º 22
0
 private void buttonClear_Click(object sender, EventArgs e)
 {
     FormHandler.groupBoxCleaner(groupBox);
     FormHandler.clearItemCheckList(checkedListBoxReg);
 }
Exemplo n.º 23
0
 private void comboBoxRegimen_SelectedIndexChanged(object sender, EventArgs e)
 {
     FormHandler.limpiar(groupBox2);
     dataGridView1.Rows.Clear();
 }
Exemplo n.º 24
0
 private void textBoxCity_KeyPress(object sender, KeyPressEventArgs e)
 {
     FormHandler.allowOnlyChars(sender, e);
 }
Exemplo n.º 25
0
 //clears all fields
 private void buttonClear_Click(object sender, EventArgs e)
 {
     FormHandler.groupBoxCleaner(groupBoxGuest);
     FormHandler.clearDatePicker(dtPickerBirhtDate);
 }
Exemplo n.º 26
0
 private void comboBoxCountry_Validating(object sender, CancelEventArgs e)
 {
     FormHandler.validateEmptyComboBox(comboBoxCountry, errorProvider, buttonSave);
 }
Exemplo n.º 27
0
 public void validateEmptyComboBoxOnHandler(ComboBox combo)
 {
     FormHandler.validateEmptyComboBox(combo, errorProvider, buttonSave);
 }
Exemplo n.º 28
0
 public DelegateFormHandler(FormHandler formHandler, string deploymentId)
 {
     this.formHandler  = formHandler;
     this.deploymentId = deploymentId;
 }
Exemplo n.º 29
0
 private void textBoxStreetNum_KeyPress(object sender, KeyPressEventArgs e)
 {
     FormHandler.allowOnlyNumbers(sender, e);
 }
Exemplo n.º 30
0
 public SubmitFormVariablesInvocation(FormHandler formHandler, VariableMap properties, VariableScope variableScope) : base(null, null)
 {
     this.formHandler   = formHandler;
     this.properties    = properties;
     this.variableScope = variableScope;
 }