public async Task <IActionResult> OnPostDeleteAsync(GetFullTerminalSystemDto fullTerminalSystem) { var response = await _fullterminalsystem.DeleteFullTerminalSystem(fullTerminalSystem.TerminalID); if (response.Data != null) { await _fullterminalsystem.DeleteFullTerminalSystem(response.Data.TerminalID); } return(RedirectToPage()); }
/* * //DropDownList Cascada AJAX * public JsonResult OnGetProgramVersions() * { * //Console.WriteLine(pid); * return new JsonResult(_csvfile.getProgramVersionsByID(Convert.ToString(fullTerminalSystem.ProgramID))); * } * * public JsonResult OnGetParameterVersions() * { * //Console.WriteLine(pver); * return new JsonResult(_csvfile.getParameterVersionsByID(Convert.ToString(fullTerminalSystem.ParameterGroup))); * } */ public async Task <IActionResult> OnGetAsync(string terminalID) { var _terminal = await _fullterminalsystemservice.GetFullTerminalSystemByID(terminalID); fullTerminalSystem = _terminal.Data; if (_terminal.Data == null) { return(RedirectToPage("./Index")); } return(Page()); }
public async Task <IActionResult> OnGetAsync(string Terminalid) { if (Terminalid == null) { return(NotFound()); } var sys = await _fullterminalsystemservice.GetFullTerminalSystemByID(Terminalid); Terminals = sys.Data; if (Terminals == null) { return(NotFound()); } return(Page()); }
public async Task <IActionResult> OnPostSaveAsync(int id) { var term = await _fullTerminalSystem.GetFullTerminalSystemByID(fullTerminalSystemAUX.TerminalID); GetFullTerminalSystemDto TerminalAux = term.Data; if (TerminalAux == null) { var response = await _fullTerminalSystem.GetTerminalAuxByID(id); response.Data.SerialNumber = fullTerminalSystemAUX.SerialNumber; response.Data.TerminalID = fullTerminalSystemAUX.TerminalID; await _fullTerminalSystem.InsertNewFullTerminalFromCargaMasivaAux(response.Data); await _fullTerminalSystem.DeleteTerminalCargaMasivaAux(id); } return(RedirectToPage()); }
public async Task <ServiceResponse <GetFullTerminalSystemDto> > UpdateFulTerminalSystem(GetFullTerminalSystemDto updateFullTerminalSystem) { ServiceResponse <GetFullTerminalSystemDto> serviceResponse = new ServiceResponse <GetFullTerminalSystemDto>(); try { bool rstTerminalChecksum = false; bool rstTranConnChecksum = false; bool rstControlChecksum = false; bool newPackage = false; Terminal terminal = await _context.Terminals.FirstOrDefaultAsync(ct => ct.TerminalID.Equals(updateFullTerminalSystem.TerminalID)); SystemPOS systempos = await _context.SystemPOSs.FirstOrDefaultAsync(ct => ct.TerminalID.Equals(updateFullTerminalSystem.TerminalID)); if (terminal.TerminalID != updateFullTerminalSystem.TerminalID || terminal.SerialNumber != updateFullTerminalSystem.SerialNumber || //rst-69 terminal.ParmConnectTime != updateFullTerminalSystem.ParmConnectTime || terminal.Custom1 != updateFullTerminalSystem.HeaderLine1 || terminal.Custom2 != updateFullTerminalSystem.HeaderLine2 || //addRUT terminal.Custom3 != addRUT + updateFullTerminalSystem.HeaderLine3 || terminal.Custom4 != updateFullTerminalSystem.Custom4 || terminal.Custom5 != updateFullTerminalSystem.Custom5 || terminal.Custom6 != updateFullTerminalSystem.Custom6 || terminal.Custom7 != updateFullTerminalSystem.Custom7 || terminal.Custom8 != updateFullTerminalSystem.Custom8 || terminal.Custom9 != updateFullTerminalSystem.Custom9 || terminal.Custom10 != updateFullTerminalSystem.Custom10 || terminal.Custom11 != updateFullTerminalSystem.Custom11 || terminal.Custom12 != updateFullTerminalSystem.Custom12 || terminal.Custom13 != updateFullTerminalSystem.Custom13 || terminal.Custom14 != updateFullTerminalSystem.Custom14 || terminal.Custom15 != updateFullTerminalSystem.Custom15 || terminal.Custom16 != updateFullTerminalSystem.Custom16 || terminal.Custom19 != updateFullTerminalSystem.Custom19 || updateFullTerminalSystem.TerminalChecksum) { systempos.TerminalChecksum = 0; rstTerminalChecksum = true; } terminal.TerminalID = updateFullTerminalSystem.TerminalID; terminal.SerialNumber = updateFullTerminalSystem.SerialNumber; //rst-69 terminal.ParmConnectTime = updateFullTerminalSystem.ParmConnectTime; terminal.Custom1 = updateFullTerminalSystem.HeaderLine1; terminal.Custom2 = updateFullTerminalSystem.HeaderLine2; //addRUT terminal.Custom3 = addRUT + updateFullTerminalSystem.HeaderLine3; terminal.Custom4 = updateFullTerminalSystem.Custom4; terminal.Custom5 = updateFullTerminalSystem.Custom5; terminal.Custom6 = updateFullTerminalSystem.Custom6; terminal.Custom7 = updateFullTerminalSystem.Custom7; terminal.Custom8 = updateFullTerminalSystem.Custom8; terminal.Custom9 = updateFullTerminalSystem.Custom9; terminal.Custom10 = updateFullTerminalSystem.Custom10; terminal.Custom11 = updateFullTerminalSystem.Custom11; terminal.Custom12 = updateFullTerminalSystem.Custom12; terminal.Custom13 = updateFullTerminalSystem.Custom13; terminal.Custom14 = updateFullTerminalSystem.Custom14; terminal.Custom15 = updateFullTerminalSystem.Custom15; terminal.Custom16 = updateFullTerminalSystem.Custom16; terminal.Custom19 = updateFullTerminalSystem.Custom19; if (systempos.ControlGroup != updateFullTerminalSystem.merchanType || updateFullTerminalSystem.ControlCheckSum) { systempos.ControlGroup = updateFullTerminalSystem.merchanType; systempos.ControlCheckSum = 0; rstControlChecksum = true; } if (systempos.ConnectGroup != updateFullTerminalSystem.ConnectGroup || updateFullTerminalSystem.ParmConnChecksum) { systempos.ConnectGroup = updateFullTerminalSystem.ConnectGroup; systempos.ParmConnChecksum = 0; systempos.TranConnChecksum1 = 0; systempos.TranConnChecksum2 = 0; rstTranConnChecksum = true; } //rst-70 if (updateFullTerminalSystem.ParameterReload) { systempos.ParameterReload = 1; } //rst70 inicio else { systempos.ParameterReload = 0; } //rst70 fin if (updateFullTerminalSystem.ProgramReload) { systempos.ProgramReload = 1; } //rst70 inicio else { systempos.ProgramReload = 0; } //rst70 fin if (systempos.Paquete != updateFullTerminalSystem.Paquete) { newPackage = true; } systempos.ParameterGroup = updateFullTerminalSystem.ParameterGroup; systempos.ParameterVersion = updateFullTerminalSystem.ParameterVersion; systempos.ProgramID = updateFullTerminalSystem.ProgramID; systempos.ProgramVersion = updateFullTerminalSystem.ProgramVersion; systempos.Paquete = updateFullTerminalSystem.Paquete; TerminalStatus term = await _context.TerminalsStatus.FirstOrDefaultAsync(te => te.TerminalID.Equals(updateFullTerminalSystem.TerminalID)); if (term == null) { term = new TerminalStatus(); term.TerminalID = updateFullTerminalSystem.TerminalID; term.status = updateFullTerminalSystem.enabled_JPOS ? 1 : 0; await _context.TerminalsStatus.AddAsync(term); } else { term.status = updateFullTerminalSystem.enabled_JPOS ? 1 : 0; } jpos jpos_value = new jpos(); char pad = '0'; string[] parameters = new string[] { updateFullTerminalSystem.ca == "" ? null : updateFullTerminalSystem.ca, updateFullTerminalSystem.mcc == "" ? null : updateFullTerminalSystem.mcc, updateFullTerminalSystem.pf_id == "" || updateFullTerminalSystem.pf_id == null ? null : updateFullTerminalSystem.pf_id.PadLeft(11, pad), updateFullTerminalSystem.visa_spnsrd_mercht == "" ? null : updateFullTerminalSystem.visa_spnsrd_mercht, updateFullTerminalSystem.amex_id_comercio == "" ? null : updateFullTerminalSystem.amex_id_comercio, }; Sysconfig sys = await _MySqlcontext.sysconfig.FirstOrDefaultAsync(j => j.id.Equals(addca + updateFullTerminalSystem.TerminalID)); if (sys == null) { sys = new Sysconfig(); sys.id = addca + updateFullTerminalSystem.TerminalID; await _MySqlcontext.sysconfig.AddAsync(sys); } jpos_value.updateSysconfigValue_CA(parameters); sys.value = jpos_value.genSysconfigValue_CA(); await _context.SaveChangesAsync(); await _MySqlcontext.SaveChangesAsync(); //ACTUALIZA LINEA AL ARCHIVO TERMINALS _csvfile.UpdateTerminalsLine(updateFullTerminalSystem.TerminalID, updateFullTerminalSystem); //ACTUALIZA LINEA AL ARCHIVO SYSTEM _csvfile.UpdateSystemLine(updateFullTerminalSystem.TerminalID, updateFullTerminalSystem, rstTerminalChecksum, rstTranConnChecksum, rstControlChecksum, newPackage); serviceResponse = await GetFullTerminalSystemByID(updateFullTerminalSystem.TerminalID); } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }
public async Task <ServiceResponse <GetFullTerminalSystemDto> > GetFullTerminalSystemByID(string terminal_id) { ServiceResponse <GetFullTerminalSystemDto> serviceResponse = new ServiceResponse <GetFullTerminalSystemDto>(); try { var terminal = await _context.Terminals.FirstOrDefaultAsync(t => t.TerminalID.Equals(terminal_id)); var system = await _context.SystemPOSs.FirstOrDefaultAsync(t => t.TerminalID.Equals(terminal_id)); GetFullTerminalSystemDto fullTerminalSystem = new GetFullTerminalSystemDto(); fullTerminalSystem.TerminalID = terminal.TerminalID; fullTerminalSystem.SerialNumber = terminal.SerialNumber; //rst-69 fullTerminalSystem.ParmConnectTime = terminal.ParmConnectTime; fullTerminalSystem.HeaderLine1 = terminal.Custom1; fullTerminalSystem.HeaderLine2 = terminal.Custom2; //remove RUT: fullTerminalSystem.HeaderLine3 = terminal.Custom3.Remove(0, 4); fullTerminalSystem.Custom4 = terminal.Custom4; fullTerminalSystem.Custom5 = terminal.Custom5; fullTerminalSystem.Custom6 = terminal.Custom6; fullTerminalSystem.Custom7 = terminal.Custom7; fullTerminalSystem.Custom8 = terminal.Custom8; fullTerminalSystem.Custom9 = terminal.Custom9; fullTerminalSystem.Custom10 = terminal.Custom10; fullTerminalSystem.Custom11 = terminal.Custom11; fullTerminalSystem.Custom12 = terminal.Custom12; fullTerminalSystem.Custom13 = terminal.Custom13; fullTerminalSystem.Custom14 = terminal.Custom14; fullTerminalSystem.Custom15 = terminal.Custom15; fullTerminalSystem.Custom16 = terminal.Custom16; fullTerminalSystem.Custom19 = terminal.Custom19; fullTerminalSystem.merchanType = system.ControlGroup; //actualizar datos terminal if (system.TerminalChecksum == 0) { fullTerminalSystem.TerminalChecksum = true; } else { fullTerminalSystem.TerminalChecksum = false; } //actualizar parametros de conexion if (system.ParmConnChecksum == 0) { fullTerminalSystem.ParmConnChecksum = true; } else { fullTerminalSystem.ParmConnChecksum = false; } //actualizar tipo de comercio - controlchecksum if (system.ControlCheckSum == 0) { fullTerminalSystem.ControlCheckSum = true; } else { fullTerminalSystem.ControlCheckSum = false; } //cargar parametros de conexion if (system.ParameterReload == 1) { fullTerminalSystem.ParameterReload = true; } else { fullTerminalSystem.ParameterReload = false; } //cargar programa - program reload if (system.ProgramReload == 1) { fullTerminalSystem.ProgramReload = true; } else { fullTerminalSystem.ProgramReload = false; } fullTerminalSystem.ParameterGroup = system.ParameterGroup; fullTerminalSystem.ParameterVersion = system.ParameterVersion; fullTerminalSystem.ProgramID = system.ProgramID; fullTerminalSystem.ProgramVersion = system.ProgramVersion; fullTerminalSystem.Paquete = system.Paquete; fullTerminalSystem.ConnectGroup = system.ConnectGroup; //parametros de JPOS falta definir cuales son var jpos = await _MySqlcontext.sysconfig.FirstOrDefaultAsync(j => j.id.Equals(addca + fullTerminalSystem.TerminalID)); if (jpos != null) { if (jpos.value != null) { jpos jp = new jpos(); jp.setSysconfigValue_CA(jpos.value); string ca = jp.getCA(); string mcc = jp.getMcc(); string pf_id = jp.getPf_id(); string visa_spnsrd_mercht = jp.getVisa_spnsrd_mercht(); string amex_id_comercio = jp.getAmex_id_comercio(); fullTerminalSystem.ca = ca.Length == 0 ? null : ca; fullTerminalSystem.mcc = mcc.Length == 0 ? null : mcc; fullTerminalSystem.pf_id = pf_id.Length == 0 ? null : pf_id; fullTerminalSystem.visa_spnsrd_mercht = visa_spnsrd_mercht.Length == 0 ? null : visa_spnsrd_mercht; fullTerminalSystem.amex_id_comercio = amex_id_comercio.Length == 0 ? null : amex_id_comercio; } var status = await _context.TerminalsStatus.FirstOrDefaultAsync(s => s.TerminalID.Equals(terminal_id)); if (status != null) { if (status.status == 1) { fullTerminalSystem.enabled_JPOS = true; } else { fullTerminalSystem.enabled_JPOS = false; } } else { fullTerminalSystem.enabled_JPOS = false; } } serviceResponse.Data = fullTerminalSystem; } catch (Exception ex) { serviceResponse.Success = false; serviceResponse.Message = ex.Message; } return(serviceResponse); }