private UnitOfMeasureFamilyDocument GetUOMFamilyDocument(Sage.Integration.Northwind.Application.Entities.Product.DataSets.Product.ProductsRow productRow, Token lastToken, NorthwindConfig config) { #region Declarations UnitOfMeasureFamilyDocument uomDoc; string identity; #endregion identity = productRow.ProductID.ToString(); // create Account Doc uomDoc = new UnitOfMeasureFamilyDocument(); uomDoc.Id = identity; if (lastToken.InitRequest) uomDoc.LogState = LogState.Created; else if (productRow.IsCreateIDNull() || productRow.IsModifyIDNull() || productRow.IsCreateUserNull() || productRow.IsModifyUserNull()) uomDoc.LogState = LogState.Created; else if ((productRow.CreateID > lastToken.SequenceNumber) && (productRow.CreateUser != config.CrmUser)) uomDoc.LogState = LogState.Created; else if ((productRow.CreateID == lastToken.SequenceNumber) && (productRow.CreateUser != config.CrmUser) && (identity.CompareTo(lastToken.Id.Id) > 0)) uomDoc.LogState = LogState.Created; else if ((productRow.ModifyID >= lastToken.SequenceNumber) && (productRow.ModifyUser != config.CrmUser)) uomDoc.LogState = LogState.Updated; uomDoc.active.Value = Constants.DefaultValues.Active; uomDoc.defaultvalue.Value = true; uomDoc.name.Value = productRow.IsQuantityPerUnitNull() ? null : productRow.QuantityPerUnit.ToString(); ; uomDoc.description.Value = uomDoc.name.Value; return uomDoc; }
private ProductDocument GetProductDocument(Sage.Integration.Northwind.Application.Entities.Product.DataSets.Product.ProductsRow productRow, Token lastToken, NorthwindConfig config) { ProductDocument productDoc; string identity; bool active; identity = productRow.ProductID.ToString(); // create Product Document productDoc = new ProductDocument(); productDoc.Id = identity; if (lastToken.InitRequest) productDoc.LogState = LogState.Created; else if (productRow.IsCreateIDNull() || productRow.IsModifyIDNull() || productRow.IsCreateUserNull() || productRow.IsModifyUserNull()) productDoc.LogState = LogState.Created; else if ((productRow.CreateID >= lastToken.SequenceNumber) && (productRow.CreateUser != config.CrmUser)) productDoc.LogState = LogState.Created; else if ((productRow.ModifyID >= lastToken.SequenceNumber) && (productRow.ModifyUser != config.CrmUser)) productDoc.LogState = LogState.Updated; active = productRow.IsDiscontinuedNull() ? false : !productRow.Discontinued; productDoc.active.Value = active ? Constants.DefaultValues.Active : Constants.DefaultValues.NotActive; productDoc.code.Value = identity; productDoc.name.Value = productRow.IsProductNameNull() ? null : productRow.ProductName; productDoc.productfamilyid.Value = productRow.IsCategoryIDNull() ? 0 : productRow.CategoryID; productDoc.uomcategory.Value = identity; productDoc.instock.Value = productRow.IsUnitsInStockNull() ? 0 : Convert.ToInt32(productRow.UnitsInStock); return productDoc; }