Exemple #1
0
        decimal getN(RainVariables rainVariables)  //getting n method
        {
            decimal _getN = 0;

            using (projectappdbContext db = new projectappdbContext()){
                string ChoosenRegion = Region.SelectionBoxItem as string;

                if (rainVariables.P >= 1)
                {
                    var n = db.Pril2NPlessPaboveMrGamma.Where(el => el.Region == ChoosenRegion && rainVariables.P >= 1)
                            .Select(el => el.NPless1)
                            .FirstOrDefault();
                    _getN = n;
                }
                else
                {
                    var n = db.Pril2NPlessPaboveMrGamma.Where(el => el.Region == ChoosenRegion && rainVariables.P < 1)
                            .Select(el => el.NPabove1)
                            .FirstOrDefault();
                    _getN = n;
                }
            }

            return(_getN);
        } //end of getting n method
Exemple #2
0
        static internal List <string> getRegionList()
        {
            List <string> RegionList;

            using (projectappdbContext db = new projectappdbContext())
            {
                var Regions = db.Pril2NPlessPaboveMrGamma.Select(p => p.Region).ToList();
                RegionList = Regions;
            }
            return(RegionList);
        }
Exemple #3
0
        static internal List <string> getPlaceList()
        {
            List <string> PlaceList;

            using (projectappdbContext db = new projectappdbContext())
            {
                var Places = db.Pril11RegionIdHcpCvCs.Select(r => r.RegionName).ToList();

                PlaceList = Places;
            }
            return(PlaceList);
        }
Exemple #4
0
        } //end of getting gamma method

        decimal getHc(RainVariables rainVariables)  //getting gamma method
        {
            decimal _Hc = 0;

            using (projectappdbContext db = new projectappdbContext()){
                int ClimateIdFromCombobox = 1;

                var Hc = db.Table12SloyTalikhVod.Where(el => el.ClimateId == ClimateIdFromCombobox).Select(el => el.P015).FirstOrDefault();
                _Hc = Hc;
            }
            return(_Hc);
        } //end of getting gamma method
Exemple #5
0
        }//end of getting mr method

        decimal getGamma(RainVariables rainVariables)  //getting gamma method
        {
            decimal _getGamma = 0;

            using (projectappdbContext db = new projectappdbContext()){
                string ChoosenRegion = Region.SelectionBoxItem as string;

                var mr = db.Pril2NPlessPaboveMrGamma.Where(el => el.Region == ChoosenRegion).Select(el => el.Gamma).FirstOrDefault();
                _getGamma = mr;
            }

            return(_getGamma);
        } //end of getting gamma method
Exemple #6
0
        //getting z_road and z_roof values

        decimal get_Z_roadAndRoof(RainVariables rainVariables)
        {
            bool getN = n_LESS065(rainVariables.n);

            int A_prev = (int)Math.Floor(rainVariables.A / 100) * 100;
            int A_next = (int)Math.Ceiling(rainVariables.A / 100) * 100;

            decimal z_A_prev = 0;            //get this! by Linq.
            decimal z_A_next = 0;            //get this! by Linq.


            //getting z_road and z_roof values from db for further interpolation
            using (projectappdbContext db = new projectappdbContext()){
                if (getN == true)
                {
                    var _z_A_prev = db.Table11ZiVodonepronitsaemie.Where(el => el.A == A_prev).Select(el => el.NAbove065).FirstOrDefault(); //last of default doesnt work, FIX == (step 100 and 200)
                    var _z_A_next = db.Table11ZiVodonepronitsaemie.Where(el => el.A >= A_next).Select(el => el.NAbove065).FirstOrDefault();
                    z_A_prev = _z_A_prev;
                    z_A_next = _z_A_next;
                }
                else
                {
                    var _z_A_prev = db.Table11ZiVodonepronitsaemie.Where(el => el.A == A_prev).Select(el => el.NLess065).FirstOrDefault(); //last of default doesnt work, FIX == (step 100 and 200)
                    var _z_A_next = db.Table11ZiVodonepronitsaemie.Where(el => el.A >= A_next).Select(el => el.NLess065).FirstOrDefault();
                    z_A_prev = _z_A_prev;
                    z_A_next = _z_A_next;
                }
            } //end of getting z_road and z_roof values.

            decimal deltaMain = (z_A_next - z_A_prev) / (A_next - A_prev);  //interpolation part
            decimal diff      = rainVariables.A - A_prev;

            decimal InterpolationResult = z_A_prev + deltaMain * diff;

            return(InterpolationResult); //end of interpolation part. end of getting z_road and z_roof values
        }