コード例 #1
0
        public virtual ActionResult Create(PropertyGroupModel model)
        {
            _PropertyGroupService.AddPropertyGroup(model);
            var sd = _uow.SaveChanges();

            return(null);
        }
コード例 #2
0
        public virtual ActionResult Delete(PropertyGroupModel model)
        {
            _PropertyGroupService.DeletePropertyGroup(model.ID);
            var sd = _uow.SaveChanges();

            return(null);
        }
コード例 #3
0
        public void AddPropertyGroup(PropertyGroupModel PropertyGroupModel)
        {
            Mapper.Initialize(cfg =>
                              cfg.CreateMap <PropertyGroupModel, PropertyGroup>());
            var PropertyGroupItem = Mapper.Map <PropertyGroup>(PropertyGroupModel);

            PropertyGroupItem.Properties = new List <Property>();
            _PropertyGroup.Add(PropertyGroupItem);
        }
コード例 #4
0
        public IList <PropertyGroupModel> GetFullPropertyGroups(int groupId = 0)
        {
            IList <PropertyGroupModel> groupList = new List <PropertyGroupModel>();
            IList <Tree>       groups            = DataSet.Where(m => m.taxonomy_id == 2 && m.BT_ID == null).ToList();
            PropertyGroupModel tc         = new PropertyGroupModel();
            IList <Tree>       properties = new List <Tree>();

            if (groupId == 0)
            {
                foreach (var item in groups)
                {
                    tc = new PropertyGroupModel {
                        PropertyGroupModelId = item.PN_ID, Properties = new List <PropertyModel>(), PropertyGroupModelName = item.Name
                    };
                    properties = DataSet.Where(n => n.BT_ID == item.PN_ID).ToList();
                    foreach (var itemP in properties)
                    {
                        tc.Properties.Add(new PropertyModel {
                            PropertyModelId = itemP.PN_ID, PropertyModelName = itemP.Name
                        });
                    }
                    groupList.Add(tc);
                }
            }
            else
            {
                switch (groupId)
                {
                case 710:
                    foreach (var item in groups.Where(t => t.metals == true))
                    {
                        tc = new PropertyGroupModel {
                            PropertyGroupModelId = item.PN_ID, Properties = new List <PropertyModel>(), PropertyGroupModelName = item.Name
                        };
                        properties = DataSet.Where(n => n.BT_ID == item.PN_ID).ToList();
                        foreach (var itemP in properties.Where(p => p.metals == true))
                        {
                            tc.Properties.Add(new PropertyModel {
                                PropertyModelId = itemP.PN_ID, PropertyModelName = itemP.Name
                            });
                        }
                        groupList.Add(tc);
                    }
                    break;

                case 711:
                    foreach (var item in groups.Where(t => t.plastics == true))
                    {
                        tc = new PropertyGroupModel {
                            PropertyGroupModelId = item.PN_ID, Properties = new List <PropertyModel>(), PropertyGroupModelName = item.Name
                        };
                        properties = DataSet.Where(n => n.BT_ID == item.PN_ID).ToList();
                        foreach (var itemP in properties.Where(p => p.plastics == true))
                        {
                            tc.Properties.Add(new PropertyModel {
                                PropertyModelId = itemP.PN_ID, PropertyModelName = itemP.Name
                            });
                        }
                        groupList.Add(tc);
                    }
                    break;

                case 1:
                    foreach (var item in groups.Where(t => t.chemicals == true))
                    {
                        tc = new PropertyGroupModel {
                            PropertyGroupModelId = item.PN_ID, Properties = new List <PropertyModel>(), PropertyGroupModelName = item.Name
                        };
                        properties = DataSet.Where(n => n.BT_ID == item.PN_ID).ToList();
                        foreach (var itemP in properties.Where(p => p.chemicals == true))
                        {
                            tc.Properties.Add(new PropertyModel {
                                PropertyModelId = itemP.PN_ID, PropertyModelName = itemP.Name
                            });
                        }
                        groupList.Add(tc);
                    }
                    break;

                default:
                    break;
                }
            }

            return(groupList);
        }