private Document GetDocument(Category.CategoriesRow row, Token lastToken, NorthwindConfig config) { #region Declarations ProductFamilyDocument doc; string id; #endregion id = row.CategoryID.ToString(); doc = new ProductFamilyDocument(); doc.Id = id; if (lastToken.InitRequest) doc.LogState = LogState.Created; else if (row.IsCreateIDNull() || row.IsModifyIDNull() || row.IsCreateUserNull() || row.IsModifyUserNull()) doc.LogState = LogState.Created; else if ((row.CreateID > lastToken.SequenceNumber) && (row.CreateUser != config.CrmUser)) doc.LogState = LogState.Created; else if ((row.CreateID == lastToken.SequenceNumber) && (row.CreateUser != config.CrmUser) && (id.CompareTo(lastToken.Id.Id) > 0)) doc.LogState = LogState.Created; else if ((row.ModifyID >= lastToken.SequenceNumber) && (row.ModifyUser != config.CrmUser)) doc.LogState = LogState.Updated; doc.active.Value = Constants.DefaultValues.Active; doc.name.Value = row.IsCategoryNameNull() ? null : row.CategoryName; doc.description.Value = row.IsDescriptionNull() ? null : row.Description; return doc; }