Exemplo n.º 1
0
        public void PasteNode()
        {
            _Modified = true;
            Helpler.ChangeTitle(false, this);

            if (_CurrentNode == Nodes.Project && (_ClipboardTable != null)) //table 直接加入,因为带有下面的列数据
            {
                operation = ChangeTypes.None;
                Table table = _ClipboardTable;
                table.Name = table.Name;
                TreeNode tviTable = new TreeNode();
                _CurrentTreeViewItem.Nodes.Add(tviTable);
                tviTable.Tag  = table;
                tviTable.Text = table.Title + "[" + table.Name + "]";

                foreach (Col col in table.Cols)
                {
                    TreeNode tviCol = new TreeNode();
                    tviTable.Nodes.Add(tviCol);
                    tviTable.Expand();
                    tviCol.Tag  = col;
                    tviCol.Text = col.Title + "[" + col.Name + "]";
                }

                _Project.Tables.Add(table);
            }
            else if (_CurrentNode == Nodes.Table && (_ClipboardCol != null))  //列加入的时候,确认一下
            {
                operation = ChangeTypes.AddCol;
                Col col = _ClipboardCol;
                col.Name       = col.Name;
                _uiCol.Project = _Project;
                _uiCol.Col     = col;
            }
        }
        private void DrawChange(DrawingContext drawingContext, ChangeTypes type, NormalizedSnapshotSpanCollection[] allChanges)
        {
            NormalizedSnapshotSpanCollection changes = allChanges[(int)type];

            if (changes.Count > 0)
            {
                double yTop    = Math.Floor(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].Start)) - ChangePadding;
                double yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[0].End)) + ChangePadding;

                for (int i = 1; (i < changes.Count); ++i)
                {
                    double y = _scrollBar.GetYCoordinateOfBufferPosition(changes[i].Start) - ChangePadding;
                    if (yBottom < y)
                    {
                        drawingContext.DrawRectangle(_brushes[(int)type], null,
                                                     new Rect(ChangeOffset * 0.5, yTop, this.Width - ChangeOffset, yBottom - yTop));

                        yTop = y;
                    }

                    yBottom = Math.Ceiling(_scrollBar.GetYCoordinateOfBufferPosition(changes[i].End)) + ChangePadding;
                }

                drawingContext.DrawRectangle(_brushes[(int)type], null,
                                             new Rect(ChangeOffset * 0.5, yTop, this.Width - ChangeOffset, yBottom - yTop));
            }
        }
Exemplo n.º 3
0
        public void DeleteNode()
        {
            if (CMessageBox.Show(_Owner, "是否删除当前节点", "请确认", MessageBoxButtons.OKCancel,
                                 MessageBoxIcon.Question) == DialogResult.Cancel)
            {
                return;
            }
            _Modified = true;
            Helpler.ChangeTitle(false, this);
            if (_CurrentNode == Nodes.Table)
            {
                Table table = _CurrentTreeViewItem.Tag as Table;

                operation = ChangeTypes.DropTable;
                WriteSqlLog(null, null); //没有col,但有当前 table,通过 ChangeTypes.DropTable 删除表

                TreeNode parentTV = _CurrentTreeViewItem.Parent as TreeNode;
                parentTV.Nodes.Remove(_CurrentTreeViewItem);
                _Project.Tables.Remove(table);
                CMessageBox.Show(_Owner, "删除成功!", "提示");
            }
            else if (_CurrentNode == Nodes.Col)
            {
                Col col = _CurrentTreeViewItem.Tag as Col;

                operation = ChangeTypes.DropCol;
                WriteSqlLog(col, null);  //删除列

                TreeNode parentTV = _CurrentTreeViewItem.Parent as TreeNode;
                parentTV.Nodes.Remove(_CurrentTreeViewItem);
                Table table = parentTV.Tag as Table;
                table.Cols.Remove(col);
                CMessageBox.Show(_Owner, "删除成功!", "提示");
            }
        }
Exemplo n.º 4
0
        private void NewNode()
        {
            operation = ChangeTypes.None;
            switch (_CurrentNode)
            {
            case Nodes.None:
                operation = ChangeTypes.CreateProject;
                CreateProject();
                break;

            case Nodes.Project:
                operation = ChangeTypes.AddTable;
                CreateTable();
                break;

            case Nodes.Table:
                operation = ChangeTypes.AddCol;
                CreateCol();
                break;

            case Nodes.Col:
                MessageBox.Show("下面不能继续创建了。");
                break;
            }
        }
Exemplo n.º 5
0
        private void treeProject_MouseUp(object sender, MouseButtonEventArgs e)
        {
            TreeView myTV = (TreeView)sender;

            if (myTV.SelectedItem == null)
            {
                return;
            }
            _CurrentTreeViewItem = myTV.SelectedItem as TreeViewItem;


            if (_CurrentTreeViewItem.Tag is ZippyCoder.Entity.Project)
            {
                operation          = ChangeTypes.AlterProject;
                _CurrentNode       = Nodes.Project;
                _uiProject.Project = _Project;
                Navigate(_uiProject);
            }
            else if (_CurrentTreeViewItem.Tag is ZippyCoder.Entity.Table)
            {
                operation      = ChangeTypes.AlterTable;
                _CurrentNode   = Nodes.Table;
                _uiTable.Table = (ZippyCoder.Entity.Table)_CurrentTreeViewItem.Tag;
                Navigate(_uiTable);
            }
            else if (_CurrentTreeViewItem.Tag is ZippyCoder.Entity.Col)
            {
                operation = ChangeTypes.AlterCol;

                _CurrentNode   = Nodes.Col;
                _uiCol.Project = _Project;
                _uiCol.Col     = (ZippyCoder.Entity.Col)_CurrentTreeViewItem.Tag;
                Navigate(_uiCol);
            }
        }
Exemplo n.º 6
0
        public ChangeTypePreview(string changedText, RenderingSetModel rsm, ChangeTypesVisible ctsbt, 
            string foregroundProp, string backgroundProp, string formatProp, string surroundProp, ChangeNumberingProvider cnp, int baseChangeNum, ChangeTypes changeType)
        {

            //ChangeNumberingVisibility = cnbt;
            _changeText = changedText;
            _changeTypesShown = ctsbt;
            _cnp = cnp;
            _baseChangeNum = baseChangeNum;
            _changeType = changeType;

            cnp.RegisterChangeNumber(baseChangeNum, changeType);

            Foreground = new ColorPreviewBindingTarget(rsm, foregroundProp);
            if (!string.IsNullOrEmpty(backgroundProp))
                Background = new ColorPreviewBindingTarget(rsm, backgroundProp);
            if (!string.IsNullOrEmpty(formatProp))
                Formatting = new FormatPreviewBindingTarget(rsm, formatProp);
            if (!string.IsNullOrEmpty(surroundProp))
                SurroundChars = new SurroundTextBindingTarget(rsm, surroundProp);
            ChangeNumberFormatting = new FormatPreviewBindingTarget(rsm, "ChangeNumberTextFormat");
            ChangeNumberForeground = new ColorPreviewBindingTarget(rsm, "ChangeNumberTextColour");

            _changeTypesShown.ChangeTypeVisibilityChanged += new EventHandler(_changeTypesShown_ChangeTypeVisibilityChanged);
            cnp.ChangeNumberingChanged += new EventHandler(cnp_ChangeNumberingChanged);

            SetupProperties();
        }
Exemplo n.º 7
0
 public virtual void UpdateView(ChangeTypes ut)
 {
     if (ViewUpdated != null)
     {
         ViewUpdated(this, EventArgs.Empty);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Creates the trigger on the target table that will send changes made to the table as message to the change feed queue
        /// </summary>
        /// <param name="changeFeedTableName">The table to install the change feed</param>
        /// <param name="changeFeedTriggerName">The name of the change feed trigger to create</param>
        /// <param name="triggerRaiseByTypes">The criteria that will raise the trigger</param>
        /// <param name="conversationServiceName">The SQL Service Broker SERVICE that will be part of the COVERSATION</param>
        /// <param name="schemaName">The schema</param>
        public CreateChangeFeedTrigger(string changeFeedTableName,
                                       string changeFeedTriggerName,
                                       ChangeTypes triggerRaiseByTypes,
                                       string conversationServiceName,
                                       string schemaName)
        {
            if (string.IsNullOrWhiteSpace(changeFeedTableName))
            {
                throw new ArgumentException($"'{nameof(changeFeedTableName)}' cannot be null or whitespace", nameof(changeFeedTableName));
            }

            if (string.IsNullOrWhiteSpace(changeFeedTriggerName))
            {
                throw new ArgumentException($"'{nameof(changeFeedTriggerName)}' cannot be null or whitespace", nameof(changeFeedTriggerName));
            }

            if (string.IsNullOrWhiteSpace(conversationServiceName))
            {
                throw new ArgumentException($"'{nameof(conversationServiceName)}' cannot be null or whitespace", nameof(conversationServiceName));
            }

            if (string.IsNullOrWhiteSpace(schemaName))
            {
                throw new ArgumentException($"'{nameof(schemaName)}' cannot be null or whitespace", nameof(schemaName));
            }

            _changeFeedTableName     = changeFeedTableName;
            _changeFeedTriggerName   = changeFeedTriggerName;
            _conversationServiceName = conversationServiceName;
            _schemaName           = schemaName;
            _changeFeedChangeType = GetTriggerAfterStatementCriteria(triggerRaiseByTypes);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="Notification"/> class.
 /// </summary>
 /// <param name="workItemId">
 /// WorkItemId of the work item to load and apply the policy on.
 /// </param>
 /// <param name="teamProjectCollectionUrl">
 /// Url of Team Project Collection that holds this work item.
 /// </param>
 /// <param name="projectName">
 /// The name of the project that holds this work item.
 /// </param>
 public Notification(int workItemId, ChangeTypes changeType, string teamProjectCollectionUrl, string projectName)
 {
     this.WorkItemId = workItemId;
     this.ChangeType = changeType;
     //HACK
     this.ProjectUri = teamProjectCollectionUrl + "/" + projectName;
 }
Exemplo n.º 10
0
 internal void AddChangeType(ChangeTypes changeType)
 {
     this.LastChangeType = changeType;
     if (!_changeTypes.Contains(changeType))
     {
         _changeTypes.Add(changeType);
     }
 }
Exemplo n.º 11
0
        internal void RegisterChangeNumber(int baseChangeNum, ChangeTypes changeType)
        {
            while (baseChangeNum > _changeTypes.Count)
            {
                _changeTypes.Add(null);
            }

            _changeTypes[baseChangeNum - 1] = changeType;
        }
Exemplo n.º 12
0
        public override void UpdateView(ChangeTypes ut)
        {
            if ((ut & (ChangeTypes.Layout | ChangeTypes.Visual)) != ChangeTypes.None)
            {
                InvalidateChart();
            }

            base.UpdateView(ut);
        }
Exemplo n.º 13
0
 public void EndUpdateView(ChangeTypes ut)
 {
     UpdateTypes |= ut;
     UpdateCount  = Math.Max(0, UpdateCount - 1);
     if (UpdateCount == 0)
     {
         UpdateView(UpdateTypes);
     }
 }
 public ObjectChangeDescription(PropertyInfo changedProperty, ChangeTypes changeType, object newValue, object oldValue, DataAccess.Domain.VisualModel.UXComponent movedComponent = null, string newComponentOrder = "")
 {
     ChangedProperty   = changedProperty;
     ChangeType        = changeType;
     NewValue          = newValue;
     OldValue          = oldValue;
     MovedComponent    = movedComponent;
     NewComponentOrder = newComponentOrder;
 }
Exemplo n.º 15
0
        internal void RegisterLayoutChange(ChangeTypes type)
        {
            if ((_layoutChanges & type) == 0)
            {
                _layoutChangeCount++;
                _layoutChanges |= type;
            }

            _log.InvalidateSavePoint();
        }
Exemplo n.º 16
0
        public DeletedTextPreview(string changedText, RenderingSetModel rsm, ChangeTypesVisible ctsbt, 
            string foregroundProp, string backgroundProp, string formatProp, string surroundProp, ChangeNumberingProvider cnp, int baseChangeNum, ChangeTypes changeType) :
            base (changedText, rsm, ctsbt, foregroundProp, backgroundProp, formatProp, surroundProp, cnp, baseChangeNum, changeType)
        {
            _singleCharProp = rsm.FindOption("DeletedTextReplaceWithSingleChar") as BoolOption;
            _charProp = rsm.FindOption("DeletedTextReplaceChar") as CharacterOption;

            _charProp.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(opt_PropertyChanged);
            _singleCharProp.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(opt_PropertyChanged);
            SetupChangeText();
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var result = IncludeSubDirectories.GetHashCode();
         result = (result * 397) ^ Path.GetHashCode();
         result = (result * 397) ^ Filter.GetHashCode();
         result = (result * 397) ^ ChangeTypes.GetHashCode();
         return(result);
     }
 }
Exemplo n.º 18
0
 public void ApplyOldValue(ChangeTypes changeType, AuditDetail change)
 {
     if (changeType == ChangeTypes.Delete)
     {
         FieldValue = change.NewValue;
     }
     else
     {
         FieldValue = change.OldValue;
     }
     IsChanged = true;
 }
Exemplo n.º 19
0
        public StatusChangeInfo(ChangeTypes changeType, string workspacePath, string relativePath, string oldPath,
			double similarityPerUnit, string mergeInfo)
        {
            Contract.Requires(!String.IsNullOrEmpty(workspacePath));
            Contract.Requires(!String.IsNullOrEmpty(relativePath));
            ChangeType = changeType;
            WorkspacePath = workspacePath;
            RelativePath = relativePath;
            OldPath = oldPath;
            SimilarityPerUnit = similarityPerUnit;
            MergeInfo = mergeInfo;
        }
Exemplo n.º 20
0
 public static ChangeLocation Create(Uri loc, DateTime lastmod, ChangeTypes change, ChangeFrequencies?changeFrequency = null, IDictionary <string, string> properties = null)
 {
     return(new ChangeLocation
     {
         Url = loc,
         LastModified = lastmod,
         Metadata = new ResourceSyncMetadata {
             Change = change.ToString(), Properties = properties?.ToDictionary(kvp => kvp.Key, kvp => kvp.Value)
         },
         ChangeFrequency = changeFrequency,
         Priority = 1
     });
 }
Exemplo n.º 21
0
 public void TryUpdate(ChangeTypes ut)
 {
     UpdateTypes |= ut;
     UpdateCount  = Math.Max(0, UpdateCount - 1);
     if (UpdateCount == 0)
     {
         UpdateView(ut);
     }
     else
     {
         UpdateCount = Math.Max(UpdateCount, 0) + 1;
     }
 }
        public ChartObjectPropertyChangedCommand(Chart chart,
                                                 object chartObject, string propertyName,
                                                 object oldValue, object newValue,
                                                 ChangeTypes changes)
        {
            Chart        = chart;
            ChartObject  = chartObject;
            PropertyName = propertyName;
            OldValue     = oldValue;
            NewValue     = newValue;
            Changes      = changes;

            HasRollback = false;
        }
Exemplo n.º 23
0
 public ChangeLogItemInfo(string clientPath, string branch, long changeset, string owner, long revision, long parentRevision, long sourceParentItemId, long destinationParentItemId, string sourcePath, string destinationPath, DateTime date, ChangeTypes changeType)
 {
     ClientPath = clientPath;
     Branch = branch;
     Changeset = changeset;
     Owner = owner;
     Revision = revision;
     ParentRevision = parentRevision;
     SourceParentItemId = sourceParentItemId;
     DestinationParentItemId = destinationParentItemId;
     SourcePath = sourcePath;
     DestinationPath = destinationPath;
     Date = date;
     ChangeType = changeType;
 }
Exemplo n.º 24
0
 /// <summary>
 /// remove <param name="name">the file/folder</param> from changes for <param name="change"/>
 /// </summary>
 public void RemoveChange(string name, ChangeTypes change)
 {
     lock (changeLock)
     {
         ChangeTypes type;
         if (changes.TryGetValue(name, out type))
         {
             if (type == change)
             {
                 changes.Remove(name);
                 changeList.Remove(name);
             }
         }
     }
 }
Exemplo n.º 25
0
 private void ChangeHandle(string name, ChangeTypes type, List <ChangeTypes> checks)
 {
     lock (changeLock)
     {
         Debug.Assert(name.StartsWith(Path));
         ChangeTypes oldType;
         if (changes.TryGetValue(name, out oldType))
         {
             Debug.Assert(checks.Contains(oldType));
             changeList.Remove(name);
         }
         changeList.Add(name);
         changes[name] = type;
     }
 }
        private Expression <Func <ChangeRequestDocument, bool> > AddChangeRequestTypeIdFilter(
            Expression <Func <ChangeRequestDocument, bool> > filterEx)
        {
            if (ChangeTypes == null || !ChangeTypes.Any())
            {
                return(filterEx);
            }
            Expression <Func <ChangeRequestDocument, bool> > changeRequestTypeFilterEx = null;

            foreach (var changeType in ChangeTypes)
            {
                changeRequestTypeFilterEx = changeRequestTypeFilterEx.OrElse(x => x.ChangeType == changeType);
            }
            return(filterEx.AndAlso(changeRequestTypeFilterEx));
        }
Exemplo n.º 27
0
        private void treeProject_MouseUp(object sender, MouseEventArgs e)
        {
            //System.Windows.Controls.TreeView myTV = (System.Windows.Controls.TreeView)sender;

            if (treeProject.SelectedNode == null)
            {
                return;
            }
            _CurrentTreeViewItem = treeProject.SelectedNode as TreeNode;

            if (_CurrentTreeViewItem.Tag is Project)
            {
                operation    = ChangeTypes.AlterProject;
                _CurrentNode = Nodes.Project;
                if (_NewPro != null)
                {
                    _NewPro.Project = _Project;
                }
                //Navigate(_uiProject);
            }
            else if (_CurrentTreeViewItem.Tag is Table)
            {
                operation    = ChangeTypes.AlterTable;
                _CurrentNode = Nodes.Table;
                if (tableFrm != null)
                {
                    tableFrm.Table = (Table)_CurrentTreeViewItem.Tag;
                }
                //Navigate(_uiTable);
            }
            else if (_CurrentTreeViewItem.Tag is Col)
            {
                operation = ChangeTypes.AlterCol;

                _CurrentNode = Nodes.Col;
                if (_uiCol != null)
                {
                    _uiCol.Project = _Project;
                    _uiCol.Col     = (Col)_CurrentTreeViewItem.Tag;
                    //Navigate(_uiCol);
                }
            }
            if (e.Button == MouseButtons.Right)
            {
                //if (e.Location.Equals(treeProject.Nodes))
                menu.Show(treeProject, e.Location);
            }
        }
Exemplo n.º 28
0
        public static JsonObject Changes(this SalesforceClient self, string type, ChangeTypes kind)
        {
            var request = new ChangesRequest {
                Resource = new SObject {
                    Id = kind.ToString().ToLowerInvariant(), ResourceName = type
                }
            };

            var result = self.ChangesAsync(request);

            if (!result.Wait(TimeSpan.FromSeconds(SalesforceClient.DefaultNetworkTimeout)))
            {
                return(null); // TODO : Error handling/reporting
            }
            return(result.Result);
        }
Exemplo n.º 29
0
        public override void UpdateView(ChangeTypes ut)
        {
            CancelEdit();

            if ((ut & ChangeTypes.Layout) == ChangeTypes.Layout)
            {
                LayoutView();
            }

            if (SelectedTopic != null)
            {
                EnsureVisible(SelectedTopic);
            }

            base.UpdateView(ut);
        }
Exemplo n.º 30
0
        public static string PrettyPrintChangeType(ChangeTypes type)
        {
            switch (type)
            {
            case ChangeTypes.JobTitleChange:
                return("Job Title Change");

            case ChangeTypes.ManagerChange:
                return("Manager Change");

            case ChangeTypes.PermissionsLevelChange:
                return("Permissions Level Change");
            }

            return("");
        }
Exemplo n.º 31
0
        /// <summary>
        /// insert <param name="name">the file/folder</param> for <param name="change"/> in changes
        /// It should do nothing if <param name="name">the file/folder</param> exists in changes
        /// </summary>
        public void InsertChange(string name, ChangeTypes change)
        {
            if (ChangeTypes.None == change)
            {
                return;
            }

            lock (changeLock)
            {
                if (!changes.ContainsKey(name))
                {
                    changeList.Add(name);
                    changes[name] = change;
                }
            }
        }
Exemplo n.º 32
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Notification"/> class.
        /// </summary>
        /// <param name="workItemId">
        /// WorkItemId of the work item to load and apply the policy on.
        /// </param>
        /// <param name="teamProjectCollectionUrl">
        /// Url of Team Project Collection that holds this work item.
        /// </param>
        /// <param name="projectName">
        /// The name of the project that holds this work item.
        /// </param>
        public Notification(int workItemId, ChangeTypes changeType, string teamProjectCollectionUrl, string projectName)
        {
            this.WorkItemId = workItemId;
            this.ChangeType = changeType;
            var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new System.Uri(teamProjectCollectionUrl));
            var css = tpc.GetService <ICommonStructureService>();
            var pi  = css.ListProjects().FirstOrDefault(p => p.Name == projectName);

            if (pi == null)
            {
                throw new System.ApplicationException($"Project '{projectName}' not found");
            }
            else
            {
                this.ProjectUri = pi.Uri;
            }
        }
Exemplo n.º 33
0
        public static T Map <T>(this ChangeTypes changeType, Func <T> onCreated, Func <T> onUpdated, Func <T> onDeleted)
        {
            switch (changeType)
            {
            case ChangeTypes.created:
                return(onCreated());

            case ChangeTypes.deleted:
                return(onDeleted());

            case ChangeTypes.updated:
                return(onUpdated());

            default:
                throw new InvalidOperationException("Can't map unknown change type: " + changeType);
            }
        }
Exemplo n.º 34
0
 public FileInfo(string clientPath, string relativePath, string serverPath, long size, byte[] hash, string owner, long changeset, ChangeTypes status, ItemType itemType, string changelist, XLinkInfo underXLinkInfo, XLinkInfo xlinkInfo, long headChangeset, LockedByInfo lockedByInfo)
 {
     ClientPath = clientPath;
     RelativePath = relativePath;
     ServerPath = serverPath;
     Hash = hash;
     Owner = owner;
     Changeset = changeset;
     Status = status;
     ItemType = itemType;
     Changelist = changelist;
     XlinkInfo = xlinkInfo;
     HeadChangeset = headChangeset;
     LockedByInfo = lockedByInfo;
     UnderXLinkInfo = underXLinkInfo;
     Size = size;
 }
Exemplo n.º 35
0
 public ListInfo(string fullname, string workspacePath, long size, string type, long changeset, string repository, string owner, ChangeTypes changeType, long revisionId, long parentRevisionId, long branchId, byte[] hash, string branch, Guid itemGuid, DateTime date)
 {
     Fullname = fullname;
     WorkspacePath = workspacePath;
     Size = size;
     Type = type;
     Changeset = changeset;
     Repository = repository;
     Owner = owner;
     ChangeType = changeType;
     RevisionId = revisionId;
     ParentRevisionId = parentRevisionId;
     BranchId = branchId;
     Hash = hash;
     Branch = branch;
     ItemGuid = itemGuid;
     Date = date;
 }
Exemplo n.º 36
0
 internal SqlChangeFeedOptions(string connectionString,
                               string databaseName,
                               string tableName,
                               string schemaName          = "dbo",
                               ChangeTypes changesToWatch =
                               ChangeTypes.Insert | ChangeTypes.Update | ChangeTypes.Delete,
                               bool processChangeFeedCommandViaChatter = true,
                               string changeFeedQueueName           = null,
                               string changeFeedDeadLetterQueueName = null)
 {
     ConnectionString                   = connectionString;
     DatabaseName                       = databaseName;
     TableName                          = tableName;
     SchemaName                         = schemaName;
     ChangeFeedTriggerTypes             = changesToWatch;
     ProcessChangeFeedCommandViaChatter = processChangeFeedCommandViaChatter;
     ChangeFeedQueueName                = changeFeedQueueName;
     ChangeFeedDeadLetterServiceName    = changeFeedDeadLetterQueueName;
 }
Exemplo n.º 37
0
        public static void Map(this ChangeTypes changeType, Action onCreated, Action onUpdated, Action onDeleted)
        {
            switch (changeType)
            {
            case ChangeTypes.created:
                onCreated();
                return;

            case ChangeTypes.deleted:
                onDeleted();
                return;

            case ChangeTypes.updated:
                onUpdated();
                return;

            default:
                throw new InvalidOperationException("Can't map unknown change type: " + changeType);
            }
        }
Exemplo n.º 38
0
 public bool ShouldShowChange(ChangeTypes changeType)
 {
     switch (changeType)
     {
         case ChangeTypes.Insertion:
         case ChangeTypes.Deletion:
             return true;
         case ChangeTypes.MoveSource:
         case ChangeTypes.MoveDest:
             return _showMoves.Value;
         case ChangeTypes.FontChange:
             return _showFontChanges.Value;
         case ChangeTypes.ParaStyleChange:
             return _showParaStyleChanges.Value;
         case ChangeTypes.CharStyleChange:
             return _showParaStyleChanges.Value && _showCharStyleChanges.Value;
         default:
             break;
     }
     return false;
 }
        public static async Task<JsonObject> ChangesAsync (this SalesforceClient self, string type, ChangeTypes kind)
        {
            var request = new ChangesRequest {
                Resource = new SObject { Id = kind.ToString().ToLowerInvariant(), ResourceName = type},
            };

            return await self.ChangesAsync (request);
        }
Exemplo n.º 40
0
        private void TrackChanges(List<ChangedProperty> changeList, object target, object id, ChangeTypes changeType)
        {
            ITrackable trackableObject = target as ITrackable;

            if (trackableObject == null || trackableObject.isTracked() == false)
                return;

            if (HttpContext.Current == null)
                return;

            ChangeTracking trackChange = new ChangeTracking();

            if ( trackableObject.arePropertiesTracked() )
                trackChange.AppendProperties(changeList, trackChange);

            trackChange.ChangeType = new NHibernateDaoFactory().GetChangeTypeDao().GetById((int)changeType, false);

            trackChange.UserName = HttpContext.Current.User.Identity.Name;
            trackChange.ObjectChanged = target.GetType().Name;
            trackChange.ObjectChangedID = id == null ? null : id.ToString();

            //Now we have a tracking object with the changed properties added to its change list
            //Make sure it is valid
            if (ValidateBO<ChangeTracking>.isValid(trackChange))
            {
                //Don't put this in a transaction becuase we are already in a transaction from the save/update/delete
                new NHibernateDaoFactory().GetChangeTrackingDao().SaveOrUpdate(trackChange);
            }

            //System.IO.StreamWriter writer = new System.IO.StreamWriter(HttpContext.Current.Server.MapPath("RecruitmentTracking.txt"),true);

            //writer.WriteLine("ChangeID {0} => Object type {1} with ID {2} was modified as follows", Guid.NewGuid(), target.GetType().Name, id.ToString());

            //foreach (ChangedProperty change in changeList)
            //{
            //    //trackChange.PropertyChanged = change.type.Name;
            //    //trackChange.PropertyChangedValue = change.NewValue;

            //    writer.WriteLine("--- Property {0} was changed to {1}", change.PropertyChanged, change.PropertyChangedValue);
            //}

            //writer.Close();
        }
        public static JsonObject Changes (this SalesforceClient self, string type, ChangeTypes kind)
        {
            var request = new ChangesRequest {
                Resource = new SObject { Id = kind.ToString().ToLowerInvariant(), ResourceName = type}
            };

            var result = self.ChangesAsync (request);
            if (!result.Wait (TimeSpan.FromSeconds (SalesforceClient.DefaultNetworkTimeout)))
                return null; // TODO : Error handling/reporting
            return result.Result;
        }
Exemplo n.º 42
0
 private void ChangeHandle(string name, ChangeTypes type, List<ChangeTypes> checks)
 {
     lock (changeLock)
     {
         Debug.Assert(name.StartsWith(Path));
         ChangeTypes oldType;
         if (changes.TryGetValue(name, out oldType))
         {
             Debug.Assert(checks.Contains(oldType));
             changeList.Remove(name);
         }
         changeList.Add(name);
         changes[name] = type;
     }
 }
Exemplo n.º 43
0
        /// <summary>
        /// insert <param name="name">the file/folder</param> for <param name="change"/> in changes
        /// It should do nothing if <param name="name">the file/folder</param> exists in changes
        /// </summary>
        public void InsertChange(string name, ChangeTypes change)
        {
            if (ChangeTypes.None == change)
            {
                return;
            }

            lock (changeLock)
            {
                if (!changes.ContainsKey(name))
                {
                    changeList.Add(name);
                    changes[name] = change;
                }
            }
        }
Exemplo n.º 44
0
 /// <summary>
 /// remove <param name="name">the file/folder</param> from changes for <param name="change"/>
 /// </summary>
 public void RemoveChange(string name, ChangeTypes change)
 {
     lock (changeLock)
     {
         ChangeTypes type;
         if (changes.TryGetValue(name, out type))
         {
             if (type == change)
             {
                 changes.Remove(name);
                 changeList.Remove(name);
             }
         }
     }
 }
Exemplo n.º 45
0
 private void SetWorkItemHelper()
 {
     _wiChangeDic = ConvertList2Dic();
     _changeType = _wice.ChangeType;
     _wiNumber = Convert.ToInt32(_wiChangeDic["ID"][WIFieldChangeType.NewValue]);
 }