예제 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPCRMUndoRecord"/> class.
 /// </summary>
 /// <param name="recordIdentification">The record identification.</param>
 /// <param name="mode">The mode.</param>
 /// <param name="undoRequest">The undo request.</param>
 public UPCRMUndoRecord(string recordIdentification, string mode, CrmUndoRequest undoRequest)
 {
     this.RecordIdentification = recordIdentification;
     this.UndoRequest          = undoRequest;
     this.Mode            = string.IsNullOrEmpty(mode) ? "Update" : mode;
     this.FieldDictionary = new Dictionary <string, UPCRMUndoField>();
     this.UndoOperation   = string.Empty;
 }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UPCRMUndoRecord"/> class.
 /// </summary>
 /// <param name="record">The record.</param>
 /// <param name="undoRequest">The undo request.</param>
 public UPCRMUndoRecord(UPCRMRecord record, CrmUndoRequest undoRequest)
 {
     this.RecordIdentification = record.RecordIdentification;
     this.UndoRequest          = undoRequest;
     this.Mode            = !string.IsNullOrEmpty(record.Mode) ? record.Mode : record.IsNew ? "New" : "Update";
     this.Record          = record;
     this.UndoOperation   = string.Empty;
     this.FieldDictionary = new Dictionary <string, UPCRMUndoField>();
     this.ApplyChangesFromRecord(this.Record);
 }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UPCRMUndoRecord"/> class.
        /// </summary>
        /// <param name="recordIdentification">The record identification.</param>
        /// <param name="rollbackInfo">The rollback information.</param>
        /// <param name="undoRequest">The undo request.</param>
        public UPCRMUndoRecord(string recordIdentification, Dictionary <string, object> rollbackInfo, CrmUndoRequest undoRequest)
            : this(recordIdentification, rollbackInfo["mode"] as string, undoRequest)
        {
            List <object> fields = rollbackInfo["fields"] as List <object>;

            this.FieldDictionary = new Dictionary <string, UPCRMUndoField>();

            foreach (List <object> fieldInfo in fields)
            {
                UPCRMUndoField undoField = new UPCRMUndoField(fieldInfo);
                this.AddFieldValue(undoField);
            }
        }
예제 #4
0
        /// <summary>
        /// Creates the specified request identifier.
        /// </summary>
        /// <param name="requestId">The request identifier.</param>
        /// <returns></returns>
        public static CrmUndoRequest Create(int requestId)
        {
            var request = new CrmUndoRequest(requestId);

            return(request.Load() == 0 ? request : null);
        }