public static void CopyAddress(IAddress dest, IAddress source)
        {
            AddressAttribute.Copy(dest, source);

            //Copy fields that are missing in the previous method
            dest.IsValidated = source.IsValidated;
        }
        public void Can_save_and_load_addressAttribute_with_values()
        {
            var ca = new AddressAttribute
            {
                Name                 = "Name 1",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Datepicker,
                DisplayOrder         = 2
            };

            ca.AddressAttributeValues.Add
            (
                new AddressAttributeValue
            {
                Name          = "Name 2",
                IsPreSelected = true,
                DisplayOrder  = 1,
            }
            );
            var fromDb = SaveAndLoadEntity(ca);

            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("Name 1");

            fromDb.AddressAttributeValues.ShouldNotBeNull();
            (fromDb.AddressAttributeValues.Count == 1).ShouldBeTrue();
            fromDb.AddressAttributeValues.First().Name.ShouldEqual("Name 2");
        }
        /// <summary>
        /// Prepare address attribute model
        /// </summary>
        /// <param name="model">Address attribute model</param>
        /// <param name="addressAttribute">Address attribute</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>Address attribute model</returns>
        public virtual AddressAttributeModel PrepareAddressAttributeModel(AddressAttributeModel model,
            AddressAttribute addressAttribute, bool excludeProperties = false)
        {
            Action<AddressAttributeLocalizedModel, int> localizedModelConfiguration = null;

            if (addressAttribute != null)
            {
                //fill in model values from the entity
                model = model ?? addressAttribute.ToModel<AddressAttributeModel>();

                //prepare nested search model
                PrepareAddressAttributeValueSearchModel(model.AddressAttributeValueSearchModel, addressAttribute);

                //define localized model configuration action
                localizedModelConfiguration = (locale, languageId) =>
                {
                    locale.Name = _localizationService.GetLocalized(addressAttribute, entity => entity.Name, languageId, false, false);
                };
            }

            //prepare localized models
            if (!excludeProperties)
                model.Locales = _localizedModelFactory.PrepareLocalizedModels(localizedModelConfiguration);

            return model;
        }
        /// <summary>
        /// Prepare address attribute value model
        /// </summary>
        /// <param name="model">Address attribute value model</param>
        /// <param name="addressAttribute">Address attribute</param>
        /// <param name="addressAttributeValue">Address attribute value</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>Address attribute value model</returns>
        public virtual AddressAttributeValueModel PrepareAddressAttributeValueModel(AddressAttributeValueModel model,
            AddressAttribute addressAttribute, AddressAttributeValue addressAttributeValue, bool excludeProperties = false)
        {
            if (addressAttribute == null)
                throw new ArgumentNullException(nameof(addressAttribute));

            Action<AddressAttributeValueLocalizedModel, int> localizedModelConfiguration = null;

            if (addressAttributeValue != null)
            {
                //fill in model values from the entity
                model = model ?? addressAttributeValue.ToModel<AddressAttributeValueModel>();

                //define localized model configuration action
                localizedModelConfiguration = (locale, languageId) =>
                {
                    locale.Name = _localizationService.GetLocalized(addressAttributeValue, entity => entity.Name, languageId, false, false);
                };
            }

            model.AddressAttributeId = addressAttribute.Id;

            //prepare localized models
            if (!excludeProperties)
                model.Locales = _localizedModelFactory.PrepareLocalizedModels(localizedModelConfiguration);

            return model;
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds an attribute
        /// </summary>
        /// <param name="attributesXml">Attributes in XML format</param>
        /// <param name="attribute">Address attribute</param>
        /// <param name="value">Value</param>
        /// <returns>Attributes</returns>
        public virtual string AddAddressAttribute(string attributesXml, AddressAttribute attribute, string value)
        {
            var result = string.Empty;

            try
            {
                var xmlDoc = new XmlDocument();
                if (string.IsNullOrEmpty(attributesXml))
                {
                    var element1 = xmlDoc.CreateElement("Attributes");
                    xmlDoc.AppendChild(element1);
                }
                else
                {
                    xmlDoc.LoadXml(attributesXml);
                }
                var rootElement = (XmlElement)xmlDoc.SelectSingleNode(@"//Attributes");

                XmlElement attributeElement = null;
                //find existing
                var nodeList1 = xmlDoc.SelectNodes(@"//Attributes/AddressAttribute");
                foreach (XmlNode node1 in nodeList1)
                {
                    if (node1.Attributes != null && node1.Attributes["ID"] != null)
                    {
                        var str1 = node1.Attributes["ID"].InnerText.Trim();
                        if (int.TryParse(str1, out int id))
                        {
                            if (id == attribute.Id)
                            {
                                attributeElement = (XmlElement)node1;
                                break;
                            }
                        }
                    }
                }

                //create new one if not found
                if (attributeElement == null)
                {
                    attributeElement = xmlDoc.CreateElement("AddressAttribute");
                    attributeElement.SetAttribute("ID", attribute.Id.ToString());
                    rootElement.AppendChild(attributeElement);
                }

                var attributeValueElement = xmlDoc.CreateElement("AddressAttributeValue");
                attributeElement.AppendChild(attributeValueElement);

                var attributeValueValueElement = xmlDoc.CreateElement("Value");
                attributeValueValueElement.InnerText = value;
                attributeValueElement.AppendChild(attributeValueValueElement);

                result = xmlDoc.OuterXml;
            }
            catch (Exception exc)
            {
                Debug.Write(exc.ToString());
            }
            return(result);
        }
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            _addressAttributeRepository.Delete(addressAttribute);
        }
 /// <returns>A task that represents the asynchronous operation</returns>
 protected virtual async Task UpdateAttributeLocalesAsync(AddressAttribute addressAttribute, AddressAttributeModel model)
 {
     foreach (var localized in model.Locales)
     {
         await _localizedEntityService.SaveLocalizedValueAsync(addressAttribute,
                                                               x => x.Name,
                                                               localized.Name,
                                                               localized.LanguageId);
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// A value indicating whether this address attribute should have values
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        /// <returns>Result</returns>
        public static bool ShouldHaveValues(this AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                return(false);
            }

            //other attribute control types support values
            return(true);
        }
 protected virtual void UpdateAttributeLocales(AddressAttribute addressAttribute, AddressAttributeModel model)
 {
     foreach (var localized in model.Locales)
     {
         _localizedEntityService.SaveLocalizedValue(addressAttribute,
                                                    x => x.Name,
                                                    localized.Name,
                                                    localized.LanguageId);
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException("addressAttribute");
            }

            _addressAttributeRepository.Delete(addressAttribute);
            //_unitOfWork.Commit();
        }
        public void AddAddressAttribute_ReturnExpectedValues()
        {
            var atr = new AddressAttribute()
            {
                Id = "added"
            };
            var result = _parser.AddAddressAttribute(customAtr, atr, "new-added-value");

            Assert.IsTrue(result.Count == 5);
            Assert.IsTrue(result.Any(c => c.Key.Equals("added")));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Inserts an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void InsertAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            _addressAttributeRepository.Insert(addressAttribute);

            //event notification
            _eventPublisher.EntityInserted(addressAttribute);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException("addressAttribute");
            }

            _addressAttributeRepository.Delete(addressAttribute);

            _cacheManager.RemoveByPattern(ADDRESSATTRIBUTES_PATTERN_KEY);
            _cacheManager.RemoveByPattern(ADDRESSATTRIBUTEVALUES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityDeleted(addressAttribute);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException("addressAttribute");
            }

            _addressAttributeRepository.Delete(addressAttribute);

            _cacheManager.GetCache(CACHE_NAME_ADDRESSATTRIBUTES).Clear();
            _cacheManager.GetCache(CACHE_NAME_ADDRESSATTRIBUTEVALUES).Clear();

            //event notification
            //_eventPublisher.EntityDeleted(addressAttribute);
        }
        /// <summary>
        /// Updates the address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual async Task UpdateAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException("addressAttribute");
            }

            await _addressAttributeRepository.UpdateAsync(addressAttribute);

            _cacheManager.RemoveByPattern(ADDRESSATTRIBUTES_PATTERN_KEY);
            _cacheManager.RemoveByPattern(ADDRESSATTRIBUTEVALUES_PATTERN_KEY);

            //event notification
            await _eventPublisher.EntityUpdated(addressAttribute);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Inserts an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void InsertAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            _addressAttributeRepository.Insert(addressAttribute);

            _cacheManager.RemoveByPrefix(NopCommonDefaults.AddressAttributesPrefixCacheKey);
            _cacheManager.RemoveByPrefix(NopCommonDefaults.AddressAttributeValuesPrefixCacheKey);

            //event notification
            _eventPublisher.EntityInserted(addressAttribute);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual void DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            _addressAttributeRepository.Delete(addressAttribute);

            _cacheManager.RemoveByPattern(NopCommonDefaults.AddressAttributesPatternCacheKey);
            _cacheManager.RemoveByPattern(NopCommonDefaults.AddressAttributeValuesPatternCacheKey);

            //event notification
            _eventPublisher.EntityDeleted(addressAttribute);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Deletes an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual async Task DeleteAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException("addressAttribute");
            }

            await _addressAttributeRepository.DeleteAsync(addressAttribute);

            await _cacheManager.RemoveByPrefix(ADDRESSATTRIBUTES_PATTERN_KEY);

            await _cacheManager.RemoveByPrefix(ADDRESSATTRIBUTEVALUES_PATTERN_KEY);

            //event notification
            await _mediator.EntityDeleted(addressAttribute);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Inserts an address attribute
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        public virtual async Task InsertAddressAttribute(AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            await _addressAttributeRepository.InsertAsync(addressAttribute);

            await _cacheBase.RemoveByPrefix(CacheKey.ADDRESSATTRIBUTES_PATTERN_KEY);

            await _cacheBase.RemoveByPrefix(CacheKey.ADDRESSATTRIBUTEVALUES_PATTERN_KEY);

            //event notification
            await _mediator.EntityInserted(addressAttribute);
        }
Exemplo n.º 20
0
        /// <summary>
        /// A value indicating whether this address attribute should have values
        /// </summary>
        /// <param name="addressAttribute">Address attribute</param>
        /// <returns>Result</returns>
        public static bool ShouldHaveValues(this AddressAttribute addressAttribute)
        {
            if (addressAttribute == null)
            {
                return(false);
            }

            if (addressAttribute.AttributeControlType == AttributeControlType.TextBox ||
                addressAttribute.AttributeControlType == AttributeControlType.MultilineTextbox ||
                addressAttribute.AttributeControlType == AttributeControlType.Datepicker ||
                addressAttribute.AttributeControlType == AttributeControlType.FileUpload)
            {
                return(false);
            }

            //other attribute controle types support values
            return(true);
        }
        public void Can_save_and_load_addressAttribute()
        {
            var ca = new AddressAttribute
            {
                Name                 = "Name 1",
                IsRequired           = true,
                AttributeControlType = AttributeControlType.Datepicker,
                DisplayOrder         = 2
            };

            var fromDb = SaveAndLoadEntity(ca);

            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("Name 1");
            fromDb.IsRequired.ShouldEqual(true);
            fromDb.AttributeControlType.ShouldEqual(AttributeControlType.Datepicker);
            fromDb.DisplayOrder.ShouldEqual(2);
        }
        /// <summary>
        /// Prepare paged address attribute value list model
        /// </summary>
        /// <param name="searchModel">Address attribute value search model</param>
        /// <param name="addressAttribute">Address attribute</param>
        /// <returns>Address attribute value list model</returns>
        public virtual AddressAttributeValueListModel PrepareAddressAttributeValueListModel(AddressAttributeValueSearchModel searchModel,
            AddressAttribute addressAttribute)
        {
            if (searchModel == null)
                throw new ArgumentNullException(nameof(searchModel));

            if (addressAttribute == null)
                throw new ArgumentNullException(nameof(addressAttribute));

            //get address attribute values
            var addressAttributeValues = _addressAttributeService.GetAddressAttributeValues(addressAttribute.Id);

            //prepare grid model
            var model = new AddressAttributeValueListModel
            {
                //fill in model values from the entity
                Data = addressAttributeValues.PaginationByRequestModel(searchModel).Select(value => value.ToModel<AddressAttributeValueModel>()),
                Total = addressAttributeValues.Count
            };

            return model;
        }
        /// <summary>
        /// Prepare address attribute value model
        /// </summary>
        /// <param name="model">Address attribute value model</param>
        /// <param name="addressAttribute">Address attribute</param>
        /// <param name="addressAttributeValue">Address attribute value</param>
        /// <param name="excludeProperties">Whether to exclude populating of some properties of model</param>
        /// <returns>Address attribute value model</returns>
        public virtual AddressAttributeValueModel PrepareAddressAttributeValueModel(AddressAttributeValueModel model,
                                                                                    AddressAttribute addressAttribute, AddressAttributeValue addressAttributeValue, bool excludeProperties = false)
        {
            if (addressAttribute == null)
            {
                throw new ArgumentNullException(nameof(addressAttribute));
            }

            Action <AddressAttributeValueLocalizedModel, int> localizedModelConfiguration = null;

            if (addressAttributeValue != null)
            {
                //fill in model values from the entity
                model = model ?? new AddressAttributeValueModel
                {
                    Name          = addressAttributeValue.Name,
                    IsPreSelected = addressAttributeValue.IsPreSelected,
                    DisplayOrder  = addressAttributeValue.DisplayOrder
                };

                //define localized model configuration action
                localizedModelConfiguration = (locale, languageId) =>
                {
                    locale.Name = addressAttributeValue.GetLocalized(entity => entity.Name, languageId, false, false);
                };
            }

            model.AddressAttributeId = addressAttribute.Id;

            //prepare localized models
            if (!excludeProperties)
            {
                model.Locales = _localizedModelFactory.PrepareLocalizedModels(localizedModelConfiguration);
            }

            return(model);
        }
Exemplo n.º 24
0
        public async Task AddAttributes(int id, IEnumerable <AddressAttributeModel> attributes)
        {
            var address = _louisvilleDemographicsContext.Addresses.SingleOrDefault(a => a.Id == id);

            if (address == null)
            {
                throw new AddressDoesNotExistException(id);
            }

            foreach (var attribute in attributes)
            {
                var addressAttribute = new AddressAttribute
                {
                    Source           = attribute.Source,
                    AttributeName    = attribute.Name,
                    AttributeValue   = attribute.Value,
                    VerificationTime = _timeService.Now
                };

                address.Attributes.Add(addressAttribute);
            }

            await _louisvilleDemographicsContext.SaveChangesAsync();
        }
        public void ShouldHaveValues__ReturnTrue()
        {
            AddressAttribute addressAttribute = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.DropdownList
            };
            AddressAttribute addressAttribute2 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.ImageSquares
            };
            AddressAttribute addressAttribute3 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.RadioList
            };
            AddressAttribute addressAttribute4 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.ReadonlyCheckboxes
            };

            Assert.IsTrue(addressAttribute.ShouldHaveValues());
            Assert.IsTrue(addressAttribute2.ShouldHaveValues());
            Assert.IsTrue(addressAttribute3.ShouldHaveValues());
            Assert.IsTrue(addressAttribute4.ShouldHaveValues());
        }
        public void ShouldHaveValues__ReturnFalse()
        {
            AddressAttribute addressAttribute = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.TextBox
            };
            AddressAttribute addressAttribute2 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.MultilineTextbox
            };
            AddressAttribute addressAttribute3 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.Datepicker
            };
            AddressAttribute addressAttribute4 = new AddressAttribute()
            {
                AttributeControlType = AttributeControlType.FileUpload
            };

            Assert.IsFalse(addressAttribute.ShouldHaveValues());
            Assert.IsFalse(addressAttribute2.ShouldHaveValues());
            Assert.IsFalse(addressAttribute3.ShouldHaveValues());
            Assert.IsFalse(addressAttribute4.ShouldHaveValues());
        }
Exemplo n.º 27
0
        private static void GenerateRequisition(RQRequestSelection filter, List <RQRequestLineOwned> lines)
        {
            RQRequisitionEntry graph = PXGraph.CreateInstance <RQRequisitionEntry>();

            RQRequisition requisition = (RQRequisition)graph.Document.Cache.CreateInstance();

            graph.Document.Insert(requisition);
            requisition.ShipDestType = null;

            bool isCustomerSet = true;
            bool isVendorSet   = true;
            bool isShipToSet   = true;
            int? shipContactID = null;
            int? shipAddressID = null;
            var  vendors       = new HashSet <VendorRef>();

            foreach (RQRequestLine line in lines)
            {
                PXResult <RQRequest, RQRequestClass> e =
                    (PXResult <RQRequest, RQRequestClass>)
                    PXSelectJoin <RQRequest,
                                  InnerJoin <RQRequestClass,
                                             On <RQRequestClass.reqClassID, Equal <RQRequest.reqClassID> > >,
                                  Where <RQRequest.orderNbr, Equal <Required <RQRequest.orderNbr> > > >
                    .Select(graph, line.OrderNbr);

                RQRequest      req      = e;
                RQRequestClass reqclass = e;

                requisition = PXCache <RQRequisition> .CreateCopy(graph.Document.Current);

                if (reqclass.CustomerRequest == true && isCustomerSet)
                {
                    if (requisition.CustomerID == null)
                    {
                        requisition.CustomerID         = req.EmployeeID;
                        requisition.CustomerLocationID = req.LocationID;
                    }
                    else if (requisition.CustomerID != req.EmployeeID || requisition.CustomerLocationID != req.LocationID)
                    {
                        isCustomerSet = false;
                    }
                }
                else
                {
                    isCustomerSet = false;
                }

                if (isShipToSet)
                {
                    if (shipContactID == null && shipAddressID == null)
                    {
                        requisition.ShipDestType     = req.ShipDestType;
                        requisition.ShipToBAccountID = req.ShipToBAccountID;
                        requisition.ShipToLocationID = req.ShipToLocationID;
                        shipContactID = req.ShipContactID;
                        shipAddressID = req.ShipAddressID;
                    }
                    else if (requisition.ShipDestType != req.ShipDestType ||
                             requisition.ShipToBAccountID != req.ShipToBAccountID ||
                             requisition.ShipToLocationID != req.ShipToLocationID)
                    {
                        isShipToSet = false;
                    }
                }

                if (line.VendorID != null && line.VendorLocationID != null)
                {
                    VendorRef vendor = new VendorRef()
                    {
                        VendorID   = line.VendorID.Value,
                        LocationID = line.VendorLocationID.Value
                    };

                    vendors.Add(vendor);

                    if (isVendorSet)
                    {
                        if (requisition.VendorID == null)
                        {
                            requisition.VendorID         = line.VendorID;
                            requisition.VendorLocationID = line.VendorLocationID;
                        }
                        else if (requisition.VendorID != line.VendorID ||
                                 requisition.VendorLocationID != line.VendorLocationID)
                        {
                            isVendorSet = false;
                        }
                    }
                }
                else
                {
                    isVendorSet = false;
                }

                if (!isCustomerSet)
                {
                    requisition.CustomerID         = null;
                    requisition.CustomerLocationID = null;
                }

                if (!isVendorSet)
                {
                    requisition.VendorID         = null;
                    requisition.VendorLocationID = null;
                    requisition.RemitAddressID   = null;
                    requisition.RemitContactID   = null;
                }
                else if (requisition.VendorID == req.VendorID && requisition.VendorLocationID == req.VendorLocationID)
                {
                    requisition.RemitAddressID = req.RemitAddressID;
                    requisition.RemitContactID = req.RemitContactID;
                }

                if (!isShipToSet)
                {
                    requisition.ShipDestType = PX.Objects.PO.POShippingDestination.CompanyLocation;
                    graph.Document.Cache.SetDefaultExt <RQRequisition.shipToBAccountID>(requisition);
                }

                graph.Document.Update(requisition);

                if (line.OpenQty > 0)
                {
                    if (!graph.Lines.Cache.IsDirty && req.CuryID != requisition.CuryID)
                    {
                        requisition = PXCache <RQRequisition> .CreateCopy(graph.Document.Current);

                        requisition.CuryID = req.CuryID;
                        graph.Document.Update(requisition);
                    }

                    graph.InsertRequestLine(line, line.OpenQty.GetValueOrDefault(), filter.AddExists == true);
                }
            }

            if (isShipToSet)
            {
                foreach (PXResult <POAddress, POContact> res in
                         PXSelectJoin <POAddress,
                                       CrossJoin <POContact>,
                                       Where <POAddress.addressID, Equal <Required <RQRequisition.shipAddressID> >,
                                              And <POContact.contactID, Equal <Required <RQRequisition.shipContactID> > > > >
                         .Select(graph, shipAddressID, shipContactID))
                {
                    AddressAttribute.CopyRecord <RQRequisition.shipAddressID>(graph.Document.Cache, graph.Document.Current, (POAddress)res, true);
                    AddressAttribute.CopyRecord <RQRequisition.shipContactID>(graph.Document.Cache, graph.Document.Current, (POContact)res, true);
                }
            }

            if (requisition.VendorID == null && vendors.Count > 0)
            {
                foreach (var vendor in vendors)
                {
                    RQBiddingVendor bid = PXCache <RQBiddingVendor> .CreateCopy(graph.Vendors.Insert());

                    bid.VendorID         = vendor.VendorID;
                    bid.VendorLocationID = vendor.LocationID;
                    graph.Vendors.Update(bid);
                }
            }

            if (graph.Lines.Cache.IsDirty)
            {
                graph.Save.Press();
                throw new PXRedirectRequiredException(graph, string.Format(Messages.RequisitionCreated, graph.Document.Current.ReqNbr));
            }

            for (int i = 0; i < lines.Count; i++)
            {
                PXProcessing <RQRequestLine> .SetInfo(i, PXMessages.LocalizeFormatNoPrefixNLA(Messages.RequisitionCreated, graph.Document.Current.ReqNbr));
            }
        }
Exemplo n.º 28
0
 public static AddressAttribute ToEntity(this AddressAttributeModel model, AddressAttribute destination)
 {
     return(model.MapTo(destination));
 }
Exemplo n.º 29
0
 //attributes
 public static AddressAttributeModel ToModel(this AddressAttribute entity)
 {
     return(entity.MapTo <AddressAttribute, AddressAttributeModel>());
 }
        public void ShouldHaveValues_NullAddressAtribute_ReturnFalse()
        {
            AddressAttribute addressAttribute = null;

            Assert.IsFalse(addressAttribute.ShouldHaveValues());
        }