Пример #1
0
        public JSONResponseMapper<object, BlenderInput> getProducts(JSONRequestMapper<object, BlenderInput> Request)
        {
            JSONResponseMapper<object, BlenderInput> jsonResp = new JSONResponseMapper<object, BlenderInput>();

            BlenderInput obj = new BlenderInput();
            List<BlenderInputProduct> lstBInputProduct = new List<BlenderInputProduct>();
            foreach (BlenderInputProduct item in Request.data.Products)
            {
                BlenderInputProduct product = new BlenderInputProduct();
                product.Id = item.Id;
                product.MaxDemand = item.MaxDemand;
                product.Price = item.Price;
                List<BlenderInputProperty> lstBInputProperty = new List<BlenderInputProperty>();
                foreach (BlenderInputProperty p1 in item.Properties)
                {
                    BlenderInputProperty objProp = new BlenderInputProperty();
                    objProp.MinSpec = p1.MinSpec;
                    objProp.MaxSpec = p1.MaxSpec;

                    lstBInputProperty.Add(p1);
                }
                product.Properties = lstBInputProperty;
                lstBInputProduct.Add(product);
            }

            obj.Products = lstBInputProduct;

            List<BlenderInputComponent> lstBInputComponent = new List<BlenderInputComponent>();

            foreach (BlenderInputComponent item in Request.data.Components)
            {
                BlenderInputComponent component = new BlenderInputComponent();
                component.Name = item.Name;
                component.MaxAvail = item.MaxAvail;
                component.Cost = item.Cost;
                Dictionary<string, double> lstD = new Dictionary<string, double>();
                lstD = (Dictionary<string, double>)item.BlendValues;
                component.BlendValues = lstD;
                lstBInputComponent.Add(component);
            }
            obj.Components = lstBInputComponent;

            jsonResp.header = Request.header;
            jsonResp.data = Request.data;
            return jsonResp;
        }
Пример #2
0
 public BlenderIOProperty()
 {
     InputProperty = new BlenderInputProperty();
       OutputProperty = new BlenderOutputProperty();
 }