public static async Task <dynamic> DiagnosticResult(Aparelho ap, String guid) { //get the result String result = await GalaxyDiagnosticApi.GetDiagnosticResult(guid, ap); if (result == null) { return(null); } //parse the result dynamic content = await GalaxyDiagnosticService.DiagnosticFormatter(result.ToString()); return(content); //var a = await GDApi.GetManufactureInfo(guid); }
public async Task StartDiagnostico() { GDApi = new GalaxyDiagnosticApi(); List <Aparelho> aparelhos = (await SearchAparelhoSerial(false, false)); if (aparelhos == null) { return; } Guid g = Guid.NewGuid(); //var a = await GalaxyDiagnosticApi.CheckDiagnosticModel(aparelho); //var a = await WebApi.GetManufactureInfo("6dba7eea-6ef5-0880-6632-82ca8fbb7f0m"); ProcessHelper.StartProcess("gdlauncher2:OpenForm?GD_REGION_CODE=AM" + "&GD_COMP_CODE=C820" + "&GD_ASC_CODE=6082028015" + "&GD_USER_ID=GRAVATAISHOP18" + "&GD_PROC_TYPE=TA" + "&GD_SESS_ID=" + g.ToString() + "&GD_SERIAL_NO=" + aparelhos[0].RN + "&GD_IMEI=" + aparelhos[0].Imei + "&GD_LATEST_VER=;;" + "&GD_SW_VER=99" + "&GD_SES_FLAG=S" + "&GD_TR_NO=" + "&GD_BASE_URL=http://gspngd6.samsungcsportal.com/" + "&GD_LANG_SAP=P" + "&GD_LANG_WEB=ptl" + "&GD_CUST_SYMP=FAL"); var diags = await GalaxyDiagnosticService.LoadDiagnostics(); diags.Add(new Diagnostico() { guid = g, imei = aparelhos[0].Imei }); GalaxyDiagnosticService.SaveFile(diags); }
public async Task SetRegister() { Console.Clear(); try { diagnosticos = await GalaxyDiagnosticService.LoadDiagnostics(); registros = GSPNDataService.LoadDataRegistros(); pendentes = await GSPNDataService.LoadDataPendentes(); //Diagnostico[] diagnosticos = JsonConvert.DeserializeObject<Diagnostico[]>(FileHelper.OpenFile("diagnosticosPendentes.txt")); WriteConsole.Separator('-'); List <Registro> pendenteForEach = (List <Registro>)pendentes.Select(b => b).ToList(); await pendenteForEach.ForEachAsync(async x => { try { Cliente c = await WebApi.GetClienteByCPF(x.Cliente.Cpf, x.Cliente); if (c == null) { c = await WebApi.RegisterNewCliente(x.Cliente); } if (c == null) { Console.WriteLine("Usuario não encontrado"); return; } x.Aparelho = await WebApi.GetModelData(x.Aparelho); x.Cliente = c; if (x.Cliente == null || x.Aparelho == null) { Console.WriteLine("Erro em construir formulario"); return; } if (x.Reason == null) { x = RegistroData.SD.ContainsKey(x.Type.ToString()) ? GetDiagnosticoByType(x) : GetDiagnosticoByConsole(x); } x.DiagnosticGD = await GetDiagnosticoGD(x.Aparelho); x.Data = DateTime.Now.Date.ToString("MM-dd-yyyy"); Console.Write(x.ToString()); if (registros == null) { registros = new List <Registro>(); } //se o aparelho ja foi registrado no dia ele fica em espera if (registros.Any(y => x.Data == y.Data && x.Aparelho.RN == y.Aparelho.RN)) { Console.WriteLine("/nNOVO REGISTRO PENDENTE"); return; } ; Registro r = await WebApi.NewRegister(x); if (r == null) { return; } registros.Add(r); pendentes.RemoveAll(a => a.Aparelho.Imei == x.Aparelho.Imei); //salva o registro setado em registrados.txt GSPNDataService.SaveData(registros, pendentes); Console.WriteLine("Salvo com Sucesso"); } catch (Exception e) { Console.Write(e.Message); } }); Console.WriteLine("\nFim - Registros setados\n"); } catch (Exception e) { throw e; } }