private string CreaUploadCodeResponsePerErrore(string messaggioErrore) { UploadCodeResponse response = new UploadCodeResponse(); response.Status = Status.ERRORE; response.Error = messaggioErrore; response.IdMeasure = -1; response.Materials = new List <string>(); return(JSonSerializer.Serialize <UploadCodeResponse>(response)); }
public string UploadCode(int IdLine, string Code) { ScriviMessaggioInLog("************* UploadCode Richiamato"); try { CertixBLL bll = new CertixBLL(); List <string> Measures; int IdMeasure = bll.CreateIdMeasureFromCodeAndIdLine(IdLine, Code, Properties.Settings.Default.IsTest, out Measures); UploadCodeResponse response = new UploadCodeResponse(); response.Status = Status.OK; response.Error = string.Empty; response.IdMeasure = IdMeasure; response.Materials = Measures; return(JSonSerializer.Serialize <UploadCodeResponse>(response)); } catch (ArgumentException ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("********** ERRORE IN UPLOADCODE"); ScriviErroreGestitoInLog(ex, sb.ToString()); return(CreaUploadCodeResponsePerErrore(ex.Message)); } catch (Exception ex) { StringBuilder sb = new StringBuilder(); sb.AppendLine("********** ERRORE IN UPLOADCODE"); sb.AppendLine(string.Format(" IdLine: {0} ", IdLine)); sb.AppendLine(string.Format("Code: {0} ", Code)); ScriviEccezioneInLog(ex, sb.ToString()); return(CreaUploadCodeResponsePerErrore("Errore non recuperabile.")); } }