internal static string BuildEditNoteQuery(SageNote note) { var query = "UPDATE NOTES SET "; var parameters = new Dictionary <string, string>(); parameters.Add("TYPE", note.TYPE.ToString()); parameters.Add("TRANSNBR", note.TRANSNBR.ToString()); parameters.Add("TRANSNBR2", note.TRANSNBR2.ToString()); parameters.Add("TRANSNBR3", note.TRANSNBR3.ToString()); if (note.DATE != null) { parameters.Add("DATE", ((DateTime)note.DATE).ToString("yyyy-MM-dd")); } parameters.Add("EMPLOYEENBR", note.EMPLOYEENBR.ToString()); if (note.DATEENTER != null) { parameters.Add("DATEENTER", ((DateTime)note.DATEENTER).ToString("yyyy-MM-dd")); } parameters.Add("FORMAT", note.FORMAT.ToString()); parameters.Add("DATABASENBR", note.DATABASENBR.ToString()); parameters.Add("QSYSGEN", note.QSYSGEN); parameters.Add("QCUSTVIEW", note.QCUSTVIEW); parameters.Add("SPARE", note.SPARE); parameters.Add("SUBJECTLINE", note.SUBJECTLINE); parameters.Add("TEXT", note.TEXT); foreach (var parameter in parameters) { if (parameter.Value != string.Empty && parameter.Value != null) { query += string.Format("{0} = '{1}', ", parameter.Key, parameter.Value.Sanitize()); } } query += string.Format("WHERE NOTENBR = '{0}';", note.NOTENBR.ToString()); query = query.Replace(", WHERE", " WHERE"); return(query); }
public SageResponse <SageNote> CreateWorkOrderNote(SageNote note) { try { serviceOdbc.AddNote(note); var result = new SageResponse <SageNote> { IsSucceed = true }; return(result); } catch (ResponseException exception) { var result = new SageResponse <SageNote> { IsSucceed = false, ErrorMassage = exception.Error.Message }; return(result); } }
internal static string BuildAddNoteQuery(SageNote note) { var query = "INSERT INTO NOTES (TYPE, TRANSNBR, TRANSNBR2, TRANSNBR3, " + "DATE, EMPLOYEENBR, DATEENTER, FORMAT, DATABASENBR, NOTENBR, QSYSGEN, QCUSTVIEW, SPARE, SUBJECTLINE, TEXT) " + $"VALUES ('{ note.TYPE}'," + $"'{ note.TRANSNBR }'," + $"'{ note.TRANSNBR2 }'," + $"'{ note.TRANSNBR3 }'," + $"'{ ((DateTime)note.DATE).ToString("yyyy-MM-dd") }'," + $"'{ note.EMPLOYEENBR }'," + $"'{ ((DateTime)note.DATEENTER).ToString("yyyy-MM-dd") }'," + $"'{ note.FORMAT }'," + $"'{ note.DATABASENBR }'," + $"'{ note.NOTENBR }'," + $"'{ note.QSYSGEN }'," + $"'{ note.QCUSTVIEW }'," + $"'{ note.SPARE }'," + $"'{ note.SUBJECTLINE }'," + $"'{ note.TEXT }');"; return(query); }
public SageResponse <SageNote> EditNote(SageNote note) { return(Edit(note, EndPoints.EditNote)); }
public SageResponse <SageNote> AddNote(SageNote note) { return(Add(note, EndPoints.CreateNote)); }
public void EditNote(SageNote note) { var query = Queries.BuildEditNoteQuery(note); ExecuteQuery(timberlineServiceManagementConnectionString, query); }