Пример #1
0
        /// <summary>
        /// Method, that filters existing Legal Entities in SubEntrepeneurs from list of indexable Legal Entities
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        private List <IndexedLegalEntity> FilterIndexableLegalEntities(List <LegalEntity> list)
        {
            List <LegalEntity>        tempResult = new List <LegalEntity>();
            List <IndexedLegalEntity> result     = new List <IndexedLegalEntity>();
            LegalEntity tempEntity = new LegalEntity();

            foreach (LegalEntity entity in list)
            {
                if (entity.Region.Id == ComboBoxArea.SelectedIndex)
                {
                    tempResult.Add(entity);
                }
            }
            foreach (LegalEntity entity in tempResult)
            {
                if (entity.Region.Id != ComboBoxArea.SelectedIndex && entity.CountryWide.Equals(true))
                {
                    tempResult.Add(entity);
                }
            }
            int i = 0;

            foreach (LegalEntity temp in tempResult)
            {
                if (!IdExistsInSubEntrepeneurs(Bizz.TempEnterprise.Id, temp.Id))
                {
                    IndexedLegalEntity entity = new IndexedLegalEntity(i, temp);
                    result.Add(entity);
                    i++;
                }
            }
            return(result);
        }
        /// <summary>
        /// Method that creates a list of indexable Legal Entities
        /// </summary>
        private void GetIndexableLegalEntities()
        {
            List <LegalEntity> tempResult = new List <LegalEntity>();
            IndexedLegalEntity temp       = new IndexedLegalEntity(0, Bizz.LegalEntities[0]);

            IndexableLegalEntities.Clear();
            IndexableLegalEntities.Add(temp);
            foreach (Enterprise enterprise in Bizz.EnterpriseList)
            {
                foreach (LegalEntity entity in Bizz.LegalEntities)
                {
                    if (!CheckEntity(entity, tempResult))
                    {
                        tempResult.Add(entity);
                    }
                }
            }
            int i = 1;

            foreach (LegalEntity sub in tempResult)
            {
                temp = new IndexedLegalEntity(i, sub);
                IndexableLegalEntities.Add(temp);
                i++;
            }
        }
Пример #3
0
        /// <summary>
        /// Method that creates a list of indexable Legal Entities
        /// </summary>
        /// <returns>List<IndexableLegalEntity></returns>
        private List <IndexedLegalEntity> GetIndexableLegalEntities()
        {
            List <LegalEntity>        tempResult = new List <LegalEntity>();
            List <IndexedLegalEntity> result     = new List <IndexedLegalEntity>();
            IndexedLegalEntity        temp       = new IndexedLegalEntity(0, Bizz.LegalEntities[0]);

            result.Add(temp);
            int i = 1;

            foreach (LegalEntity entity in Bizz.LegalEntities)
            {
                if (CheckCraftGroups(entity))
                {
                    tempResult.Add(entity);
                    i++;
                }
            }
            result = FilterIndexableLegalEntities(tempResult);
            return(result);
        }
        /// <summary>
        /// Method, that adds data to an ITT-letter receiver
        /// </summary>
        /// <param name="entity">IndexableLegalEntity</param>
        /// <returns>IttLetterReceiver</returns>
        private IttLetterReceiver FillIttLetterReceiver(IndexedLegalEntity entity)
        {
            GetIttLetterShipping();
            IttLetterShipping shipping    = Shipping;
            Project           project     = Shipping.Project;
            string            companyId   = entity.Id;
            string            companyName = entity.Name;
            Contact           contact     = GetContact(entity.Id);
            string            attention   = contact.Name;
            Address           address     = GetAddress(entity.Address.Id);
            string            street      = address.Street;
            string            place       = address.Place;
            ZipTown           zipTown     = address.ZipTown;
            string            zip         = zipTown.ToString();
            string            email       = contact.ContactInfo.Email;

            IttLetterReceiver result = new IttLetterReceiver(shipping, project, companyId, companyName, attention, street, zip, email, place);

            return(result);
        }
        /// <summary>
        /// Method that creates a list of indexable Legal Entities
        /// </summary>
        /// <returns>List<IndexableLegalEntity></returns>
        private void GetIndexableLegalEntities()
        {
            List <LegalEntity> tempResult = new List <LegalEntity>();

            foreach (SubEntrepeneur sub in ProjectSubEntrepeneurs)
            {
                Bizz.RefreshList("IttLetterReceivers");
                foreach (LegalEntity tempEntity in Bizz.LegalEntities)
                {
                    if (tempEntity.Id == sub.Entrepeneur.Id)
                    {
                        bool result = CheckEntityTempResult(tempEntity, tempResult);
                        bool exist  = CheckEntityIttLetterReceivers(tempEntity);
                        if (!result && !exist)
                        {
                            tempResult.Add(tempEntity);
                            break;
                        }
                    }
                }
            }
            int i = 0;

            IndexableLegalEntities.Clear();
            foreach (LegalEntity entity in tempResult)
            {
                bool result = CheckEntityIttLetterReceivers(entity);
                if (!result)
                {
                    IndexedLegalEntity temp = new IndexedLegalEntity(i, entity);
                    IndexableLegalEntities.Add(temp);
                    i++;
                }
            }
            ListBoxLegalEntities.ItemsSource = "";
            ListBoxLegalEntities.ItemsSource = IndexableLegalEntities;
        }