public async Task <ErrorHandling> SetAccount(customer_info account) { Regex regex = new Regex(@"^(?=(.*[a-zA-Z].*){2,})(?=.*\d.*)(?=.*\W.*)[a-zA-Z0-9\S]{8,17}$"); Match match = regex.Match(account.password); if (!match.Success) { return(new ErrorHandling { faul = true, faultstring = "La contraseña debe contener dígitos, al menos una letra miniscula y una mayuscula y un caracter especial" }); } try { var now = DateTime.Now; var YY = now; var MM = now.Month.ToString(); var DD = now.Day.ToString(); if (MM.Length == 1) { MM = "0" + MM; } if (DD.Length == 1) { DD = "0" + DD; } var activationDate = now.Year + "-" + MM + "-" + DD; account.ComisionDelPadre = IMPUESTO; //id de la cuenta account.opening_balance = 0; account.iso_4217 = "USD"; account.i_distributor = await ID_DISTRIBUIDOR(); account.i_customer_type = 1; //Online customers account.batch_name = ID_CUENTA + "-di-pinless"; account.billing_model = 1; account.i_time_zone = 109; account.i_ui_time_zone = 109; account.control_number = 1; account.h323_password = account.password; account.i_product = 22791; account.activation_date = activationDate.Trim(); account.phone1 = account.phone1; account.firstname = account.firstname; account.name = account.fullname; account.lastname = account.lastname; account.email = account.email; account.login = account.phone1; account.password = account.password; account.note = account.note; } catch (Exception ex) { ; } var valid = await account.Validar(); if (!valid.faul) { var result = await account.Crear(); return(result); } else { return(valid); } }
public async Task <ErrorHandling> SetAccount(customer_info account) { try { var now = DateTime.Now; var YY = now; var MM = now.Month.ToString(); var DD = now.Day.ToString(); if (MM.Length == 1) { MM = "0" + MM; } if (DD.Length == 1) { DD = "0" + DD; } var activationDate = now.Year + "-" + MM + "-" + DD; account.ComisionDelPadre = IMPUESTO; //id de la cuenta account.opening_balance = 0; account.iso_4217 = "USD"; account.i_distributor = await ID_DISTRIBUIDOR(); account.i_customer_type = 3; //Online customers account.batch_name = ID_CUENTA + "-di-pinless"; account.billing_model = 1; account.payment_commission_rate = 100; account.sale_commission_rate = 100; account.i_time_zone = 109; account.i_ui_time_zone = 109; account.control_number = 1; account.h323_password = account.password; // account.i_product = 22791; account.activation_date = activationDate.Trim(); account.phone1 = account.phone1; account.firstname = account.firstname; account.name = account.fullname; account.lastname = account.lastname; account.email = account.email; account.login = account.phone1; account.password = account.password; account.note = account.note; } catch (Exception ex) { ; } var valid = await account.Validar(); if (!valid.faul) { var result = await account.Crear(); return(result); } else { return(valid); } }