public ActionResult DeleteConfirmed(int id)
        {
            TermLevel termLevel = db.TermLevels.Find(id);

            db.TermLevels.Remove(termLevel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,IsReadOnly,IsBlocked,Name")] TermLevel termLevel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(termLevel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(termLevel));
 }
        public ActionResult Create([Bind(Include = "Id,IsReadOnly,IsBlocked,Name")] TermLevel termLevel)
        {
            if (ModelState.IsValid)
            {
                db.TermLevels.Add(termLevel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(termLevel));
        }
Exemple #4
0
        //Dictionary<int, LevelInfo> allLevelInformation = new Dictionary<int, LevelInfo>();

        public override void Initialize()
        {
            //level 0: cover level
            int  n           = 1;
            bool _maxded     = false;
            bool _percentded = false;

            float[] _minDeds    = new float[n];
            float[] _maxDeds    = new float[n];
            float[] _limits     = new float[n];
            int[]   _partitions = new int[1];

            int[] _factor1 = new int[n];
            int[] _factor2 = new int[n];

            //RainTest
            int[] _atomicRITEIndexes    = new int[0];
            int[] _atomicRITEPartitions = new int[0];

            _partitions[0] = n;
            for (int i = 0; i < n; i++)
            {
                _minDeds[i] = 100 + (float)(0.1 * i);
                _limits[i]  = 100000000000;
            }
            TermLevel L0 = new TermLevel(1, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            //level 1:
            n              = 15535 + 4819;
            _maxded        = false;
            _percentded    = false;
            _minDeds       = new float[n];
            _maxDeds       = new float[n];
            _limits        = new float[n];
            _partitions    = new int[1];
            _partitions[0] = n;

            //RainTest
            _atomicRITEIndexes    = new int[0];
            _atomicRITEPartitions = new int[0];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i] = 100 + (float)(0.1 * i);
                _limits[i]  = 1000000;
            }

            TermLevel L1 = new TermLevel(n, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            allTermLevelInformation.Add(0, L0);
            allTermLevelInformation.Add(1, L1);
        }
        // GET: TermLevels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TermLevel termLevel = db.TermLevels.Find(id);

            if (termLevel == null)
            {
                return(HttpNotFound());
            }
            return(View(termLevel));
        }
Exemple #6
0
        //Dictionary<int, LevelInfo> allLevelInformation = new Dictionary<int, LevelInfo>();

        public override void Initialize()
        {
            int             subPerilIndex = 3; //WI
            ISubPerilConfig subperilInfo  = new RMSSubPerilConfig();
            RAPSettings     setting       = new RAPSettings(new HashSet <string> {
                "WI", "WA"
            });
            IRITEindexMapper mapper = new RITEmapper1(expData, setting, subperilInfo);

            //int m = 45408;
            int m = 22704;
            //hard-coded the NumOfBuildingArrray
            /////////////////////////////////////////////////////level 0: cover level
            int  n           = 1;
            bool _maxded     = false;
            bool _percentded = false;

            float[] _minDeds    = new float[n];
            float[] _maxDeds    = new float[n];
            float[] _limits     = new float[n];
            int[]   _partitions = new int[1];
            _partitions[0] = n;

            int[] _atomicRITEIndexes    = new int[0];
            int[] _atomicRITEPartitions = new int[0];

            int[] _factor1 = new int[n];
            int[] _factor2 = new int[n];


            for (int i = 0; i < n; i++)
            {
                _minDeds[i] = 0;
                _limits[i]  = 1000000000000;
            }
            TermLevel L0 = new TermLevel(n, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);


            ////////////////////////////////////////////////Level 1
            n           = m;
            _maxded     = false;
            _percentded = false;
            _minDeds    = new float[n];
            _maxDeds    = new float[n];
            _limits     = new float[n];
            _partitions = new int[1];

            _partitions[0] = n;

            _atomicRITEIndexes    = new int[0];
            _atomicRITEPartitions = new int[0];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i] = (float)296564.4820;
                _limits[i]  = 10000000000;
            }

            TermLevel L1 = new TermLevel(m, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            ///////////////////////////////////level 2:
            n           = m;
            _maxded     = false;
            _percentded = false;
            _minDeds    = new float[n];
            _maxDeds    = new float[n];
            _limits     = new float[n];
            _partitions = new int[n];

            _atomicRITEIndexes    = new int[n];
            _atomicRITEPartitions = new int[n];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i]              = 0;
                _limits[i]               = (float)444846.7230;
                _partitions[i]           = i + 1;
                _atomicRITEPartitions[i] = i + 1;
            }

            List <int> AtomicRITEIndexesList = new List <int>();

            foreach (RITCharacteristic RITE in expData.Characteristics)
            {
                if (RITE.ExpType == ExposureType.CoverageA)
                {
                    int numBldgd = RITE.ParentRITE.NumOfSampleBldgs;
                    for (int i = 0; i < numBldgd; i++)
                    {
                        int uniqueIndex = mapper.GetMappedIndex(RITE.ID, i, "WI");
                        AtomicRITEIndexesList.Add(uniqueIndex);
                    }
                }
            }

            _atomicRITEIndexes = AtomicRITEIndexesList.ToArray();

            TermLevel L2 = new TermLevel(n, n, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            //////////////////////////////////////////////level 3 (AtomicRiteLevel, lowest level):
            n = m;

            _atomicRITEPartitions = new int[n];

            for (int i = 0; i < n; i++)
            {
                _atomicRITEPartitions[i] = i + 1;
            }

            AtomicRITEIndexesList = new List <int>();

            foreach (RITCharacteristic RITE in expData.Characteristics)
            {
                if (RITE.ExpType == ExposureType.CoverageC)
                {
                    int numBldgd = RITE.ParentRITE.NumOfSampleBldgs;
                    for (int i = 0; i < numBldgd; i++)
                    {
                        int uniqueIndex = mapper.GetMappedIndex(RITE.ID, i, "WI");
                        AtomicRITEIndexesList.Add(uniqueIndex);
                    }
                }
            }

            _atomicRITEIndexes = AtomicRITEIndexesList.ToArray();

            //////////////////////////////////////////Finally Set MatrixGraph properties...
            lowestLevelInfo = new AtomicRITELevel(_atomicRITEPartitions, n, _factor1, _atomicRITEIndexes);
            allTermLevelInformation.Add(0, L0);
            allTermLevelInformation.Add(1, L1);
            allTermLevelInformation.Add(2, L2);

            contractInfo = new ContractInfo(false, false);
        }
Exemple #7
0
        //Dictionary<int, LevelInfo> allLevelInformation = new Dictionary<int, LevelInfo>();

        public override void Initialize()
        {
            int n1 = 15535;
            int n2 = 4819;

            //level 0: cover level
            int  n           = 1;
            bool _maxded     = false;
            bool _percentded = false;

            float[] _minDeds    = new float[n];
            float[] _maxDeds    = new float[n];
            float[] _limits     = new float[n];
            int[]   _partitions = new int[1];
            _partitions[0] = n;
            int[] _factor1 = new int[n];
            int[] _factor2 = new int[n];


            int[] _atomicRITEIndexes    = new int[0];
            int[] _atomicRITEPartitions = new int[0];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i] = 100000 + (float)(0.1 * i);
                _limits[i]  = 100000000000;
            }
            TermLevel L0 = new TermLevel(1, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);


            //Level 1
            n           = n1 + n2;
            _maxded     = false;
            _percentded = false;
            _minDeds    = new float[n];
            _maxDeds    = new float[n];
            _limits     = new float[n];
            _partitions = new int[n];

            _atomicRITEIndexes    = new int[0];
            _atomicRITEPartitions = new int[0];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i]    = 100 + (float)(0.1 * i);
                _limits[i]     = 1000000000;
                _partitions[i] = i + 1;
            }

            TermLevel L1 = new TermLevel(n, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            //level 2:
            n           = n1 + n2;
            _maxded     = false;
            _percentded = false;
            _minDeds    = new float[n];
            _maxDeds    = new float[n];
            _limits     = new float[n];
            _partitions = new int[n];

            _atomicRITEIndexes    = new int[0];
            _atomicRITEPartitions = new int[0];

            for (int i = 0; i < n; i++)
            {
                _minDeds[i]    = 100 + (float)(0.1 * i);
                _limits[i]     = 1000000;
                _partitions[i] = i + 1;
            }

            TermLevel L2 = new TermLevel(n, 0, _maxded, _percentded, _minDeds, _maxDeds, _limits, _partitions, _atomicRITEPartitions, _atomicRITEIndexes, _factor1, _factor2);

            //add all levels to Dictionary
            allTermLevelInformation.Add(0, L0);
            allTermLevelInformation.Add(1, L1);
            allTermLevelInformation.Add(2, L2);
        }