コード例 #1
0
        private void LoadProducts(OrganizationModel selectedOrganization)
        {
            if (selectedOrganization.ProductsSubscriptionList == null)
            {
                selectedOrganization.ProductsSubscriptionList = new List <OrganizationProductModel>();
            }
            else
            {
                selectedOrganization.ProductsSubscriptionList.Clear();
            }

            ListOfProducts = organization.GetAllProducts().ToList();
            if (SaltShakerSession.selectedRefOrganizationID != null)
            {
                ListOfOrganizationProducts = organization.GetOrganizationProducts(int.Parse(SaltShakerSession.selectedRefOrganizationID.Trim())).ToList();

                foreach (var product in ListOfProducts)
                {
                    if (product.IsProductActive)
                    {
                        OrganizationProductModel prodSub = new OrganizationProductModel();
                        prodSub.RefProductID       = product.RefProductID;
                        prodSub.ProductName        = product.ProductName;
                        prodSub.ProductDescription = product.ProductDescription;
                        prodSub.RefProductTypeID   = product.RefProductTypeID;
                        foreach (var orgProduct in ListOfOrganizationProducts)
                        {
                            if (orgProduct.RefProductID == product.RefProductID)
                            {
                                prodSub.RefOrganizationID = orgProduct.RefOrganizationID;
                                prodSub.IsRefOrganizationProductActive = orgProduct.IsRefOrganizationProductActive;
                                prodSub.CreatedBy    = orgProduct.CreatedBy;
                                prodSub.CreatedDate  = orgProduct.CreatedDate;
                                prodSub.ModifiedBy   = orgProduct.ModifiedBy;
                                prodSub.ModifiedDate = orgProduct.ModifiedDate;
                                break;
                            }
                        }
                        selectedOrganization.ProductsSubscriptionList.Add(prodSub);
                    }
                }
            }

            this.setProductsByTypes(selectedOrganization.ProductsSubscriptionList);
        }