Example #1
0
 public TResult <bool> AddImageToComosObject(byte[] imagestream, string user, string projectname, int workinglayer, string coSystemFullName, string docname)
 {
     try
     {
         m_ComosSession.SetCurrentUser(user);
         m_ComosSession.SetCurrentProjectAndWorkingOverlay(projectname, workinglayer);
         var    memstream = new System.IO.MemoryStream(imagestream);
         var    img       = System.Drawing.Bitmap.FromStream(memstream);
         string error     = m_ComosSession.AddImageToComosObject(coSystemFullName, docname, img);
         return(new TResult <bool>()
         {
             data = error == null,
             Message = error,
             Status = error == null
         });
     }
     catch (Exception ex)
     {
         Log.WriteLog(ex.Message + ":AddImageToComosObject", System.Diagnostics.EventLogEntryType.Warning);
         System.Diagnostics.Debug.Assert(false);
         return(new TResult <bool>()
         {
             data = true,
             Message = ex.Message + ":AddImageToComosObject",
             Status = true
         });
     }
 }