Exemple #1
0
        public double GetRvalue()
        {
            ConstructionCategory tp = this.Type;

            double rval = this.GetRvalueLayers();

            double ro = 0.0;
            double ri = 0.0;

            if (tp == ConstructionCategory.Facade)
            {
                ro = 0.04; ri = 0.13;
            }
            else if (tp == ConstructionCategory.Roof)
            {
                ro = 0.04; ri = 0.10;
            }
            else if (tp == ConstructionCategory.ExteriorFloor)
            {
                ro = 0.04; ri = 0.17;
            }
            else if (tp == ConstructionCategory.InteriorFloor)
            {
                ro = 0.17; ri = 0.17;
            }
            else
            {
                ro = 0.13; ri = 0.13;
            }

            rval += ro;
            rval += ri;

            return(rval);
        }
Exemple #2
0
        public static CSOpaqueConstruction QuickConstruction(string name, ConstructionCategory type, string[] layers, double[] thickness, string category, string source, ref CSLibrary Library)
        {
            CSOpaqueConstruction oc = new CSOpaqueConstruction();

            for (int i = 0; i < layers.Length; i++)
            {
                try
                {
                    if (thickness.Length != layers.Length)
                    {
                        continue;
                    }
                    if (!(thickness[i] > 0))
                    {
                        continue;
                    }

                    if (Library.OpaqueMaterials.Any(x => x.Name == layers[i]))
                    {
                        var mat = Library.OpaqueMaterials.First(o => o.Name == layers[i]);
                        Layer <CSOpaqueMaterial> layer = new Layer <CSOpaqueMaterial>(thickness[i], mat);
                        oc.Layers.Add(layer);
                    }
                    else
                    {
                        Debug.WriteLine("ERROR: " + "Could not find " + layers[i]);
                        Logger.WriteLine("ERROR: " + "Could not find " + layers[i]);
                        return(null);
                    }
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message);
                }
            }

            oc.Name       = name;
            oc.Type       = type;
            oc.Category   = category;
            oc.DataSource = source;


            Library.Add(oc);
            return(oc);
        }
        public async Task CreateNewWorkAsync(ConstructionWorksInputModel input)
        {
            ConstructionCategory category = this.context.ConstructionCategories.SingleOrDefault(x => x.Name == input.ConstructionCategory);

            MetricsType metric = this.context.MetricsTypes.SingleOrDefault(x => x.Name == input.Metric);

            ConstructionWork work = new ConstructionWork()
            {
                Title  = input.Title,
                Metric = metric,
                Price  = input.Price,
                ConstructionCategory = category,
            };

            await this.context.ConstructionWorks.AddAsync(work);

            await this.context.SaveChangesAsync();
        }