public BusinessActivityService(string terminalId, ref ResponseDTO res) { var host = eCatConfig.Host(); var registered = eCatConfig.GetValue("Registered"); if (registered == null || registered == "0") { Registrar(terminalId); } else { Console.WriteLine("Cajero registrado"); } var user = eCatConfig.GetValue("ATMUser"); var pass = eCatConfig.GetValue("ATMPass"); _service = new BankService(host, user, pass, true, ref res); }
public void Registrar(string terminalId) { Console.WriteLine("Registrando ATM " + terminalId); var res = new ResponseDTO(); var host = eCatConfig.Host(); var user = eCatConfig.GetValue("AdminUser"); var pass = eCatConfig.GetValue("AdminPass"); _service = new BankService(host, user, pass, false, ref res); if (res.status) { Random rnd = new Random(); string newPass = ""; string newUser = "******" + terminalId; for (int i = 0; i < 3; i++) { newPass += (char)rnd.Next('a', 'z'); newPass += (char)rnd.Next('0', '9'); newPass += (char)rnd.Next('A', 'Z'); } Hashtable parametros = new Hashtable(); parametros.Add("activated", true); parametros.Add("login", newUser); parametros.Add("password", newPass); parametros.Add("cuitDelComercio", eCatConfig.GetValue("CuitComercio")); Hashtable data = _service.Post("api/users/registerATM", parametros); res = Mapper.MapResponse(res, data); if (res.status) { eCatConfig.AddValue("ATMUser", newUser); eCatConfig.AddValue("ATMPass", newPass); eCatConfig.AddValue("Registered", "1"); //eCatConfig.ProtectConfiguration(); } else { System.Console.WriteLine(res.message); } } }