Example #1
0
 public TResult <CWriteValueResult[]> WriteComosValues(CWriteValueCollection values, string user, string projectname, string workinglayer, string language)
 {
     try
     {
         Log.WriteLog("WriteComosValues: Set Current User = {0}", user);
         if (!m_ComosSession.SetCurrentUser(user))
         {
             Log.WriteLog("WriteComosValues: Can not set user.", System.Diagnostics.EventLogEntryType.Warning);
             return(new TResult <CWriteValueResult[]>()
             {
                 Status = false,
                 data = null,
                 Message = "Failed settings current user",
             });
         }
         Log.WriteLog("WriteComosValues: SetCurrentProjectAndWorkingOverlay = {0} - {1} - {2}", projectname, workinglayer, language);
         if (!m_ComosSession.SetCurrentProjectAndWorkingOverlay(projectname, workinglayer, language))
         {
             Log.WriteLog("WriteComosValues: Can not set project and working layer.", System.Diagnostics.EventLogEntryType.Warning);
             return(new TResult <CWriteValueResult[]>()
             {
                 Status = false,
                 data = null,
                 Message = "Failed settings working layer",
             });
         }
         Log.WriteLog("WriteComosValues: WriteComosValues");
         Log.WriteLog(string.Format("\tUser = {0}, projectname = {1}, workinglayer={2}, language={3}", user, projectname, workinglayer, language), System.Diagnostics.EventLogEntryType.Information);
         foreach (var att in values.Values)
         {
             Log.WriteLog(string.Format("\t\tSystemUID = {0}, NestedName = {1}, New={2}, Old={3}",
                                        att.WebSystemUID, att.NestedName, att.NewValue, att.OldValue), System.Diagnostics.EventLogEntryType.Information);
         }
         var result = m_ComosSession.WriteComosValues(values);
         return(new TResult <CWriteValueResult[]>()
         {
             Status = true,
             data = result.ToArray(),
         });
     }
     catch (Exception ex)
     {
         Log.WriteLog("WriteComosValues: Exception = {0}, Stack = {1}", ex.Message, ex.StackTrace);
         return(new TResult <CWriteValueResult[]>()
         {
             Status = false,
             data = null,
             Message = ex.Message,
         });
     }
 }