예제 #1
0
        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);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        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);
        }
예제 #4
0
 public SageResponse <SageNote> EditNote(SageNote note)
 {
     return(Edit(note, EndPoints.EditNote));
 }
예제 #5
0
 public SageResponse <SageNote> AddNote(SageNote note)
 {
     return(Add(note, EndPoints.CreateNote));
 }
예제 #6
0
        public void EditNote(SageNote note)
        {
            var query = Queries.BuildEditNoteQuery(note);

            ExecuteQuery(timberlineServiceManagementConnectionString, query);
        }