public IActionResult OnGet(string Parameter_Default) { if (Parameter_Default != null) { if (Parameter_Default != "0") { if (Parameter_Default == "1") { AddFullTerminalSystemDto _defaultHandy = new AddDefaultHandyTerminalSystemDto(); this.fullTerminalSystemPOS = _defaultHandy; } else if (Parameter_Default == "2") { AddFullTerminalSystemDto _defaultResonance = new AddDefaultResonanceTerminalSystemDto(); this.fullTerminalSystemPOS = _defaultResonance; } } } return(Page()); }
public async Task <ServiceResponse <CargaMasivaAux> > InsertTerminalCargaMasivaAux(AddFullTerminalSystemDto fullTerminalSystemDto) { ServiceResponse <CargaMasivaAux> serviceResponse = new ServiceResponse <CargaMasivaAux>(); try { CargaMasivaAux terminales = new CargaMasivaAux(); terminales.Custom1 = fullTerminalSystemDto.HeaderLine1 ?? null; terminales.Custom2 = fullTerminalSystemDto.HeaderLine2 ?? null; terminales.Custom3 = fullTerminalSystemDto.HeaderLine3 ?? null; terminales.Custom4 = fullTerminalSystemDto.Custom4; terminales.Custom5 = fullTerminalSystemDto.Custom5; terminales.Custom6 = fullTerminalSystemDto.Custom6; terminales.Custom7 = fullTerminalSystemDto.Custom7; terminales.Custom8 = fullTerminalSystemDto.Custom8; terminales.Custom9 = fullTerminalSystemDto.Custom9; terminales.Custom10 = fullTerminalSystemDto.Custom10; terminales.Custom11 = fullTerminalSystemDto.Custom11; terminales.Custom12 = fullTerminalSystemDto.Custom12; terminales.Custom13 = fullTerminalSystemDto.Custom13; terminales.Custom14 = fullTerminalSystemDto.Custom14; terminales.Custom15 = fullTerminalSystemDto.Custom15; terminales.Custom16 = fullTerminalSystemDto.Custom16; terminales.Custom19 = fullTerminalSystemDto.Custom19; if (fullTerminalSystemDto.TerminalChecksum) { terminales.TerminalChecksum = 0; } terminales.ConnectGroup = fullTerminalSystemDto.ConnectGroup; if (fullTerminalSystemDto.ParmConnChecksum) { terminales.ParmConnChecksum = 0; } terminales.ControlGroup = fullTerminalSystemDto.ControlGroup; if (fullTerminalSystemDto.ControlCheckSum) { terminales.ControlCheckSum = 0; } terminales.ParameterGroup = fullTerminalSystemDto.ParameterGroup; terminales.ParameterVersion = fullTerminalSystemDto.ParameterVersion; if (fullTerminalSystemDto.ParameterReload) { terminales.ParameterReload = 1; } terminales.ProgramID = fullTerminalSystemDto.ProgramID; terminales.ProgramVersion = fullTerminalSystemDto.ProgramVersion; if (fullTerminalSystemDto.ProgramReload) { terminales.ProgramReload = 1; } terminales.Paquete = fullTerminalSystemDto.Paquete; //prueba cargando todos los parametros terminales.TerminalID = ""; terminales.SerialNumber = ""; terminales.id_jpos = ""; terminales.value = ""; //listaAux.Add(terminales); await _context.CargaMasivaAux.AddAsync(terminales); await _context.SaveChangesAsync(); //await _context.SaveChangesAsync(); serviceResponse.Data = terminales; } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }
public async Task <ServiceResponse <GetTerminalDto> > InsertNewFullTerminalFromCargaMasivaAux(GetCargaMasivaDto terminal_aux) { ServiceResponse <GetTerminalDto> serviceResponse = new ServiceResponse <GetTerminalDto>(); try { AddFullTerminalSystemDto aux = new AddFullTerminalSystemDto(); aux.TerminalID = terminal_aux.TerminalID; aux.SerialNumber = terminal_aux.SerialNumber; aux.HeaderLine1 = terminal_aux.Custom1 ?? null; aux.HeaderLine2 = terminal_aux.Custom2 ?? null; aux.HeaderLine3 = terminal_aux.Custom3 ?? null; aux.Custom4 = terminal_aux.Custom4; aux.Custom5 = terminal_aux.Custom5; aux.Custom6 = terminal_aux.Custom6; aux.Custom7 = terminal_aux.Custom7; aux.Custom8 = terminal_aux.Custom8; aux.Custom9 = terminal_aux.Custom9; aux.Custom10 = terminal_aux.Custom10; aux.Custom11 = terminal_aux.Custom11; aux.Custom12 = terminal_aux.Custom12; aux.Custom13 = terminal_aux.Custom13; aux.Custom14 = terminal_aux.Custom14; aux.Custom15 = terminal_aux.Custom15; aux.Custom16 = terminal_aux.Custom16; aux.Custom19 = terminal_aux.Custom19; if (terminal_aux.TerminalChecksum == 0) { aux.TerminalChecksum = true; } else { aux.TerminalChecksum = false; } //actualizar parametros de conexion if (terminal_aux.ParmConnChecksum == 0) { aux.ParmConnChecksum = true; } else { aux.ParmConnChecksum = false; } //actualizar tipo de comercio - controlchecksum if (terminal_aux.ControlCheckSum == 0) { aux.ControlCheckSum = true; } else { aux.ControlCheckSum = false; } //cargar parametros de conexion if (terminal_aux.ParameterReload == 1) { aux.ParameterReload = true; } else { aux.ParameterReload = false; } //cargar programa - program reload if (terminal_aux.ProgramReload == 1) { aux.ProgramReload = true; } else { aux.ProgramReload = false; } aux.ControlGroup = terminal_aux.ControlGroup; aux.ParameterGroup = terminal_aux.ParameterGroup; aux.ParameterVersion = terminal_aux.ParameterVersion; aux.ProgramID = terminal_aux.ProgramID; aux.ProgramVersion = terminal_aux.ProgramVersion; aux.Paquete = terminal_aux.Paquete; aux.ConnectGroup = terminal_aux.ConnectGroup; serviceResponse = await InsertFullTerminalSystem(aux); } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }
public async Task <ServiceResponse <GetTerminalDto> > InsertFullTerminalSystem(AddFullTerminalSystemDto fullTerminalSystem) { ServiceResponse <GetTerminalDto> serviceResponse = new ServiceResponse <GetTerminalDto>(); try { serviceResponse = await GetTerminalByID(fullTerminalSystem.TerminalID); //AGREGO TERMINAL SI NO EXISTE if (serviceResponse.Data == null) { Terminal terminal = new Terminal(); terminal.TerminalID = fullTerminalSystem.TerminalID; terminal.SerialNumber = fullTerminalSystem.SerialNumber; //rst-69 terminal.ParmConnectTime = GetConnectTime.getConnectTime(_context); terminal.Custom1 = fullTerminalSystem.HeaderLine1; terminal.Custom2 = fullTerminalSystem.HeaderLine2; //RUT terminal.Custom3 = addRUT + fullTerminalSystem.HeaderLine3; terminal.Custom4 = fullTerminalSystem.Custom4; terminal.Custom5 = fullTerminalSystem.Custom5; terminal.Custom6 = fullTerminalSystem.Custom6; terminal.Custom7 = fullTerminalSystem.Custom7; terminal.Custom8 = fullTerminalSystem.Custom8; terminal.Custom9 = fullTerminalSystem.Custom9; terminal.Custom10 = fullTerminalSystem.Custom10; terminal.Custom11 = fullTerminalSystem.Custom11; terminal.Custom12 = fullTerminalSystem.Custom12; terminal.Custom13 = fullTerminalSystem.Custom13; terminal.Custom14 = fullTerminalSystem.Custom14; terminal.Custom15 = fullTerminalSystem.Custom15; terminal.Custom16 = fullTerminalSystem.Custom16; //cabal u$s terminal.Custom19 = fullTerminalSystem.Custom19; await _context.Terminals.AddAsync(terminal); //AGREGO SYSTEM SystemPOS systempos = new SystemPOS(); systempos.TerminalID = fullTerminalSystem.TerminalID; systempos.ControlGroup = fullTerminalSystem.ControlGroup; //bool tiene true (checked) por defecto //RST-20 if (fullTerminalSystem.ControlCheckSum) { systempos.ControlCheckSum = 0; } systempos.ParameterGroup = fullTerminalSystem.ParameterGroup; //bool tiene true por defecto //RST-20 if (fullTerminalSystem.ParameterReload) { systempos.ParameterReload = 1; } systempos.ParameterVersion = fullTerminalSystem.ParameterVersion; systempos.ProgramID = fullTerminalSystem.ProgramID; //bool Cargar Programa (Program Reload) //RST-20 if (fullTerminalSystem.ProgramReload) { systempos.ProgramReload = 1; } systempos.ProgramVersion = fullTerminalSystem.ProgramVersion; systempos.Paquete = fullTerminalSystem.Paquete; systempos.ConnectGroup = fullTerminalSystem.ConnectGroup; //bool tiene true (checked) por defecto //RST-20 if (fullTerminalSystem.ParmConnChecksum) { systempos.ParmConnChecksum = 0; } //bool viene true por defecto //RST-20 if (fullTerminalSystem.TerminalChecksum) { systempos.TerminalChecksum = 0; } await _context.SystemPOSs.AddAsync(systempos); //await _context.SaveChangesAsync(); if (fullTerminalSystem.enabled_JPOS) { //AGREGO TerminalStatus 1 TerminalStatus term = new TerminalStatus(); term.TerminalID = fullTerminalSystem.TerminalID; term.status = 1; await _context.TerminalsStatus.AddAsync(term); jpos jpos_value = new jpos(); char pad = '0'; string[] parameters = new string[] { fullTerminalSystem.ca == "" ? null : fullTerminalSystem.ca, fullTerminalSystem.mcc == "" ? null : fullTerminalSystem.mcc, fullTerminalSystem.pf_id == "" || fullTerminalSystem.pf_id == null ? null : fullTerminalSystem.pf_id.PadLeft(11, pad), fullTerminalSystem.visa_spnsrd_mercht == "" ? null : fullTerminalSystem.visa_spnsrd_mercht, fullTerminalSystem.amex_id_comercio == "" ? null : fullTerminalSystem.amex_id_comercio, }; Sysconfig sys = await _MySqlcontext.sysconfig.FirstOrDefaultAsync(j => j.id.Equals(addca + fullTerminalSystem.TerminalID)); //Existe terminal en jpos con ca. if (sys != null) { if (sys.value != null) { jpos_value.setSysconfigValue_CA(sys.value); } } else { sys = new Sysconfig(); sys.id = addca + fullTerminalSystem.TerminalID; await _MySqlcontext.sysconfig.AddAsync(sys); //AGREGA pft. Sysconfig syspft = new Sysconfig(); syspft.id = addpft + fullTerminalSystem.TerminalID; syspft.value = "handy"; await _MySqlcontext.sysconfig.AddAsync(syspft); } jpos_value.updateSysconfigValue_CA(parameters); sys.value = jpos_value.genSysconfigValue_CA(); } //commit luego de todos los cambios await _context.SaveChangesAsync(); await _MySqlcontext.SaveChangesAsync(); //AGREGO LINEA AL ARCHIVO TERMINALS _csvfile.AppendTerminalsLine(fullTerminalSystem); //AGREGO LINEA AL ARCHIVO SYSTEM _csvfile.AppendSystemLine(fullTerminalSystem); serviceResponse = await GetTerminalByID(fullTerminalSystem.TerminalID); } else { serviceResponse.Success = false; serviceResponse.Message = "Terminal Existente."; } } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }