Advertisement
souldown

Untitled

Jul 17th, 2014
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.21 KB | None | 0 0
  1. public static Result stopMyStopwatch(Clarizen clarizen, User User, Stopwatch stopwatch)
  2.         {
  3.            
  4.             //create project entity
  5.             GenericEntity stopwatchEnt = new GenericEntity();
  6.             stopwatchEnt.Id = new EntityId() { TypeName = "Stopwatch", Value = stopwatch.Id };
  7.  
  8.  
  9.             //get the state field
  10.             FieldValue stateField = new FieldValue();
  11.             stateField.FieldName = "State";
  12.             //add the user as manager
  13.             stateField.Value = "Paused";
  14.  
  15.  
  16.  
  17.             //set the values
  18.             stopwatchEnt.Values = new FieldValue[] { stateField };
  19.  
  20.  
  21.             UpdateMessage updateWatch = new UpdateMessage();
  22.             updateWatch.Entity = stopwatchEnt;
  23.            
  24.            
  25.            
  26.             //get result
  27.             Result result3 = clarizen.Execute(new BaseMessage[] { updateWatch })[0];
  28.  
  29.             if (result3.Success)
  30.             {
  31.                 Console.WriteLine("Stopwatch marked complete!! " + result3.Success.ToString());
  32.             }
  33.             else
  34.             {
  35.                 Console.WriteLine("Stopwatch " + result3.Error.Message.ToString());
  36.             }
  37.                return result3;
  38.  
  39.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement