public IActionResult Edit(int id, EditConcentrationViewModel vm)
        {
            //Make sure the model state is valid
            if (!ModelState.IsValid)
            {
                return(View("Edit", vm));
            }

            Concentration concentration;

            // If we are adding a concentration
            if (id == -1)
            {
                concentration = new Concentration
                {
                    Name = vm.Title
                };

                _context.UpdateConcentration(-1, concentration);
            }
            else //Editing a concentration
            {
                concentration = _context.ReadConcentration(id);

                concentration.Name = vm.Title;

                _context.UpdateConcentration(id, concentration);
            }

            return(RedirectToAction("Index"));
        }
        private static Structure CreateSiO2TestStructure()
        {
            var topMetal = new Metal(Length.FromNanometers(4));

            topMetal.SetWorkFunction(Energy.FromElectronVolts(4.45));

            var oxide = new Dielectric(Length.FromNanometers(2));

            oxide.DielectricConstant = 3.9;
            oxide.BandGap            = Energy.FromElectronVolts(8.9);
            oxide.ElectronAffinity   = Energy.FromElectronVolts(0.95);

            var semiconductor = new Semiconductor();

            semiconductor.BandGap                       = Energy.FromElectronVolts(1.1252);
            semiconductor.ElectronAffinity              = Energy.FromElectronVolts(4.05);
            semiconductor.DielectricConstant            = 11.7;
            semiconductor.IntrinsicCarrierConcentration = Concentration.FromPerCubicCentimeter(1.41E10);
            semiconductor.DopingType                    = DopingType.N;
            semiconductor.DopantConcentration           = Concentration.FromPerCubicCentimeter(1E18);

            var structure = new Structure();

            structure.Temperature = new Temperature(300);
            structure.AddLayer(semiconductor);
            structure.AddLayer(oxide);
            structure.AddLayer(topMetal);

            return(structure);
        }
 private void StartNewGame()
 {
     emojiChoices = Clone(emojiSets[random.Next(emojiSets.Count)]);
     game         = new Concentration((cardButtons.Count + 1) / 2);
     UpdateViewFromModel();
     gameOverLabel.TextColor = UIColor.Black;
 }
예제 #4
0
        public ActionResult DeleteConfirmed(int id)
        {
            Concentration concentration = db.Concentrations.Find(id);

            db.Concentrations.Remove(concentration);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #5
0
 public bool Equals(DataPoint dp)
 {
     if (dp == null)
     {
         return(false);
     }
     return(Concentration.Equals(dp.Concentration) && Value.Equals(dp.Value));
 }
예제 #6
0
 public ActionResult Edit([Bind(Include = "ID,Name,HoursRequired")] Concentration concentration)
 {
     if (ModelState.IsValid)
     {
         db.Entry(concentration).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(concentration));
 }
예제 #7
0
        public ActionResult Create([Bind(Include = "ID,Name,HoursRequired")] Concentration concentration)
        {
            if (ModelState.IsValid)
            {
                db.Concentrations.Add(concentration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(concentration));
        }
예제 #8
0
        public List <Concentration> GetConcentrationsByDegreeId(int degreeId)
        {
            string command;

            if (degreeId > 0)
            {
                command = $@"
                    SELECT	con.con_id,
		                    con.con_title,
		                    con.deg_id
                    FROM dbo.tblConcentration con
                    WHERE con.deg_id = '{degreeId}'
                    ";
            }
            else
            {
                command = $@"
                    SELECT	con.con_id,
		                    con.con_title,
		                    con.deg_id
                    FROM dbo.tblConcentration con
                    ";
            }

            DatabaseService service = new DatabaseService();
            SqlDataReader   reader  = service.Read(command);

            List <Concentration> concentrations = new List <Concentration>();

            if (reader != null && reader.HasRows)
            {
                while (reader.Read())
                {
                    Concentration concentration = new Concentration();
                    concentration.Id = (int)reader["con_id"];

                    if (reader["con_title"] != DBNull.Value)
                    {
                        concentration.Title = (string)reader["con_title"];
                    }
                    if (reader["deg_id"] != DBNull.Value)
                    {
                        concentration.DegreeId = (int)reader["deg_id"];
                    }

                    concentrations.Add(concentration);
                }
            }

            service.Close();

            return(concentrations);
        }
예제 #9
0
        public ActionResult RecommendCourses(int?id)
        {
            Student       student = db.Students.Find(id);
            Concentration conc    = student.Concentration;
            List <Course> possibleRecommendations = new List <Course>();

            foreach (BaseCourse b in conc.RequiredCourses)
            {
                Course c = new Course();
                c.BaseCourse = b;
                possibleRecommendations.Add(c);
            }

            ICollection <Course> recCollection = possibleRecommendations.Where(p => !student.CoursesTaken.Any(p2 => p2.BaseCourse.Name == p.BaseCourse.Name)).ToList();
            List <Course>        toRemove      = new List <Course>();

            foreach (Course c in recCollection)
            {
                bool hasIt = false;
                foreach (Course c2 in student.CoursesTaken)
                {
                    String pName = c2.BaseCourse.Department + c2.BaseCourse.CourseNumber;
                    foreach (Prerequisite p in c.BaseCourse.Prerequisites)
                    {
                        if (p.PrereqName == pName)
                        {
                            hasIt = true;
                        }
                    }
                }
                if (c.BaseCourse.Prerequisites.Count() == 0)
                {
                    hasIt = true;
                }

                if (!hasIt)
                {
                    toRemove.Add(c);
                }
            }

            foreach (Course c in toRemove)
            {
                recCollection.Remove(c);
            }

            student.CoursesRecommended = recCollection;

            db.Entry(student).State = EntityState.Modified;
            db.SaveChanges();

            return(View("RecommendCourses", student));
        }
        private static Semiconductor CreateTestSemiconductor()
        {
            var semiconductor = new Semiconductor();

            semiconductor.BandGap                       = Energy.FromElectronVolts(1.1252);
            semiconductor.ElectronAffinity              = Energy.FromElectronVolts(4.05);
            semiconductor.DielectricConstant            = 11.7;
            semiconductor.IntrinsicCarrierConcentration = Concentration.FromPerCubicCentimeter(1.41E10);
            semiconductor.DopingType                    = DopingType.N;
            semiconductor.DopantConcentration           = Concentration.FromPerCubicCentimeter(1E18);

            return(semiconductor);
        }
예제 #11
0
        public ActionResult AddCourseVM(int?id)
        {
            Student            student          = db.Students.Find(id);
            List <Course>      alreadyTaken     = student.CoursesTaken.ToList();
            Concentration      conc             = db.Concentrations.Find(student.Concentration.ID);
            List <BaseCourse>  potentialCourses = conc.RequiredCourses.ToList();
            AddCourseViewModel vModel           = new AddCourseViewModel(student, potentialCourses);

            List <Course> listCourses = new List <Course>();

            foreach (BaseCourse baseC in potentialCourses)
            {
                Course c = new Course();
                c.BaseCourse = baseC;
                listCourses.Add(c);
            }

            foreach (Course c in alreadyTaken)
            {
                listCourses.RemoveAll(s => s.BaseCourse.ID == c.BaseCourseID);
            }

            vModel.PossibleCourses = listCourses;

            for (int i = 0; i < listCourses.Count; i++)
            {
                var selectList = new SelectList(db.Semesters, "Sname", "Sname", "1");
                this.ViewData[string.Format("PossibleCourses[{0}].Semester", i)] = selectList;

                List <SelectListItem> items = new List <SelectListItem>();
                items.Add(new SelectListItem {
                    Text = "A", Value = "4"
                });
                items.Add(new SelectListItem {
                    Text = "B", Value = "3"
                });
                items.Add(new SelectListItem {
                    Text = "C", Value = "2"
                });
                items.Add(new SelectListItem {
                    Text = "D", Value = "1"
                });
                items.Add(new SelectListItem {
                    Text = "F", Value = "0"
                });
                this.ViewData[string.Format("PossibleCourses[{0}].Grade", i)] = items;
                this.ViewData[string.Format("selected[{0}]", i)] = 1;
            }

            return(View("AddCourseVM", vModel));
        }
예제 #12
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Concentration concentration = db.Concentrations.Find(id);

            if (concentration == null)
            {
                return(HttpNotFound());
            }
            return(View(concentration));
        }
예제 #13
0
        public FormConcentration()
        {
            InitializeComponent();
            regle      = Concentration.selectionRègle();
            _difficile = MainMenu.difficile;
            string consigne = regle._consigne;

            if (_difficile)
            {
                consigne += "\nVous avez " + tempsDifficulte + "pour choisir le bon bouton.";
            }
            consigne += "\nAppuyer sur OK quand vous êtes prêt.";

            MessageBox.Show(consigne);
            lancerTest();
        }
예제 #14
0
        public void lancerTest()
        {
            Invalidate();        //permet d'effacer les dessins précédents pour éviter une superposition des formes
            bonneRep = "button"; //on va ajouter l'indice correspondant au bouton attendu
            groupBoxButton.Controls.Add(button1);
            groupBoxButton.Controls.Add(button2);
            groupBoxButton.Controls.Add(button3);

            labelConsigne.Text = regle._consigne;
            cptTest++;
            count.Text = cptTest.ToString() + "/5";
            if (cptTest == 1)
            {
                button1.Visible = false;
                button2.Visible = false;
            }
            else
            {
                button1.Visible = true;
                button2.Visible = true;
            }

            valeurs = Concentration.selectionForme(cptTest, valeurs, this);// la génération des dessins se fait dans OnPaint, on récupère ici les paramètres necessaires
            f       = new Forme(valeurs[1], valeurs[0], 129, 199, 100, 100);

            if (cptTest != 1)
            {
                switch (valeurs[3])
                {
                case "1":    //c'est la forme qui est conservée
                    bonneRep += regle._boutonForme;
                    break;

                case "2":    //c'est la couleur qui est conservée
                    bonneRep += regle._boutonCouleur;
                    break;

                case "3":    //c'est le nbDePoint
                    bonneRep += regle._boutonNbPoint;
                    break;
                }
            }
            else
            {
                bonneRep += "3";
            }
        }
예제 #15
0
        // GET: Concentrations/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Concentration concentration = db.Concentrations.Find(id);

            if (concentration == null)
            {
                return(HttpNotFound());
            }

            List <BaseCourse> RequiredCourses = concentration.RequiredCourses.ToList();

            return(View(concentration));
        }
예제 #16
0
        /// <summary>
        /// UpdateConcentration
        /// </summary>
        /// <param name="id">Id for a concentration</param>
        /// <returns></returns>
        public Concentration UpdateConcentration(int id, Concentration c)
        {
            if (id == -1)
            {
                var conc = _db.Concentrations.Add(c);
                _db.SaveChanges();
                return(c);
            }

            var concentration = _db.Concentrations.FirstOrDefault(con => con.Id == c.Id);

            concentration.Name = c.Name;

            _db.SaveChanges();

            return(c);
        }
예제 #17
0
        public void TestStructureWithOnlySemiconductorIsInvalid()
        {
            var semiconductor = new Semiconductor();

            semiconductor.BandGap                       = Energy.FromElectronVolts(1.125);
            semiconductor.ElectronAffinity              = Energy.FromElectronVolts(4.05);
            semiconductor.DielectricConstant            = 11.7;
            semiconductor.IntrinsicCarrierConcentration = Concentration.FromPerCubicCentimeter(1.41E10);
            semiconductor.DopingType                    = DopingType.N;
            semiconductor.DopantConcentration           = Concentration.FromPerCubicCentimeter(1E18);

            var structure = new Structure();

            structure.AddLayer(semiconductor);

            Assert.That(!structure.IsValid);
        }
예제 #18
0
        public ConcentrationGetDto CreateConcentration(ConcentrationCreateDto concentrationCreateDto)
        {
            var concentration = new Concentration
            {
                ConcentrationName = concentrationCreateDto.ConcentrationName,
                MajorId           = concentrationCreateDto.MajorId
            };

            _context.Set <Concentration>().Add(concentration);
            _context.SaveChanges();

            var concentrationGetDto = new ConcentrationGetDto
            {
                Id = concentration.Id,
                ConcentrationName = concentration.ConcentrationName,
                MajorId           = concentration.MajorId
            };

            return(concentrationGetDto);
        }
예제 #19
0
      public override IDeepCopyable CopyTo(IDeepCopyable other)
      {
        var dest = other as StrengthComponent;

        if (dest == null)
        {
          throw new ArgumentException("Can only copy to an object of the same type", "other");
        }

        base.CopyTo(dest);
        if(Presentation != null) dest.Presentation = (Hl7.Fhir.Model.Ratio)Presentation.DeepCopy();
        if(PresentationHighLimit != null) dest.PresentationHighLimit = (Hl7.Fhir.Model.Ratio)PresentationHighLimit.DeepCopy();
        if(PresentationTextElement != null) dest.PresentationTextElement = (Hl7.Fhir.Model.FhirString)PresentationTextElement.DeepCopy();
        if(Concentration != null) dest.Concentration = (Hl7.Fhir.Model.Ratio)Concentration.DeepCopy();
        if(ConcentrationHighLimit != null) dest.ConcentrationHighLimit = (Hl7.Fhir.Model.Ratio)ConcentrationHighLimit.DeepCopy();
        if(ConcentrationTextElement != null) dest.ConcentrationTextElement = (Hl7.Fhir.Model.FhirString)ConcentrationTextElement.DeepCopy();
        if(MeasurementPointElement != null) dest.MeasurementPointElement = (Hl7.Fhir.Model.FhirString)MeasurementPointElement.DeepCopy();
        if(Country != null) dest.Country = new List<Hl7.Fhir.Model.CodeableConcept>(Country.DeepCopy());
        if(ReferenceStrength != null) dest.ReferenceStrength = new List<Hl7.Fhir.Model.Ingredient.ReferenceStrengthComponent>(ReferenceStrength.DeepCopy());
        return dest;
      }
예제 #20
0
        public void TestStructureWithoutDielectricIsInvalid()
        {
            var topMetal = new Metal(Length.FromNanometers(10));

            topMetal.SetWorkFunction(Energy.FromElectronVolts(4.9));

            var semiconductor = new Semiconductor();

            semiconductor.BandGap                       = Energy.FromElectronVolts(1.125);
            semiconductor.ElectronAffinity              = Energy.FromElectronVolts(4.05);
            semiconductor.DielectricConstant            = 11.7;
            semiconductor.IntrinsicCarrierConcentration = Concentration.FromPerCubicCentimeter(1.41E10);
            semiconductor.DopingType                    = DopingType.N;
            semiconductor.DopantConcentration           = Concentration.FromPerCubicCentimeter(1E18);

            var structure = new Structure();

            structure.AddLayer(semiconductor);
            structure.AddLayer(topMetal);

            Assert.That(!structure.IsValid);
        }
예제 #21
0
 private void afficheResultat()
 {
     timerConcentration.Stop();
     if (bonneRep == repUtilisateur)
     {
         cptBonneRep++;
     }
     if (cptTest != 5)
     {
         lancerTest();
     }
     else
     {
         cptTotalBonneRep += cptBonneRep;
         if (cptSerie != 3)
         {
             MessageBox.Show("Vous avez eu un total de" + cptBonneRep * 20 + "% de bonnes réponses à la serie " + cptSerie + "\n Prêt pour la suivante ?");
             cptTest = 0;
             cptSerie++;
             cptBonneRep = 0;
             if (_difficile)
             {
                 regle = Concentration.selectionRègle();
                 MessageBox.Show(regle._consigne);
             }
             lancerTest();
         }
         else
         {
             MessageBox.Show("Vous avez eu un total de" + cptBonneRep + "/5 ! à la serie " + cptSerie);
             MessageBox.Show("Fin de l'exercice. Vous avez eu un total de " + 100 * cptTotalBonneRep / 15 + " % de bonnes réponses !");
             string resultatFinal = 100 * cptTotalBonneRep / 15 + "%";
             Sauvegarde.rConcentration = resultatFinal;
             this.Close();
         }
     }
 }
예제 #22
0
        public override JSONObject Serialize()
        {
            JSONObject obj = new JSONObject();

            obj.Add(cAppraise, Appraise.Serialize());
            obj.Add(cBalance, Balance.Serialize());
            obj.Add(cBluff, Bluff.Serialize());
            obj.Add(cClimb, Climb.Serialize());
            obj.Add(cConcentration, Concentration.Serialize());
            obj.Add(cDecipherScript, DecipherScript.Serialize());
            obj.Add(cDiplomacy, Diplomacy.Serialize());
            obj.Add(cDisableDevice, DisableDevice.Serialize());
            obj.Add(cDisguise, Disguise.Serialize());
            obj.Add(cEscapeArtist, EscapeArtist.Serialize());
            obj.Add(cForgery, Forgery.Serialize());
            obj.Add(cGatherInformation, GatherInformation.Serialize());
            obj.Add(cHandleAnimal, HandleAnimal.Serialize());
            obj.Add(cHeal, Heal.Serialize());
            obj.Add(cHide, Hide.Serialize());
            obj.Add(cIntimidate, Intimidate.Serialize());
            obj.Add(cJump, Jump.Serialize());
            obj.Add(cListen, Listen.Serialize());
            obj.Add(cMoveSilently, MoveSilently.Serialize());
            obj.Add(cOpenLock, OpenLock.Serialize());
            obj.Add(cRide, Ride.Serialize());
            obj.Add(cSearch, Search.Serialize());
            obj.Add(cSenseMotive, SenseMotive.Serialize());
            obj.Add(cSleightOfHand, SleightOfHand.Serialize());
            obj.Add(cSpellCraft, SpellCraft.Serialize());
            obj.Add(cSpot, Spot.Serialize());
            obj.Add(cSurvival, Survival.Serialize());
            obj.Add(cSwim, Swim.Serialize());
            obj.Add(cTumble, Tumble.Serialize());
            obj.Add(cUseMagicDevice, UseMagicDevice.Serialize());
            obj.Add(cUseRope, UseRope.Serialize());
            return(obj);
        }
예제 #23
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (Presentation != null)
            {
                writer.WritePropertyName("presentation");
                Presentation.SerializeJson(writer, options);
            }

            if (PresentationLowLimit != null)
            {
                writer.WritePropertyName("presentationLowLimit");
                PresentationLowLimit.SerializeJson(writer, options);
            }

            if (Concentration != null)
            {
                writer.WritePropertyName("concentration");
                Concentration.SerializeJson(writer, options);
            }

            if (ConcentrationLowLimit != null)
            {
                writer.WritePropertyName("concentrationLowLimit");
                ConcentrationLowLimit.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(MeasurementPoint))
            {
                writer.WriteString("measurementPoint", (string)MeasurementPoint !);
            }

            if (_MeasurementPoint != null)
            {
                writer.WritePropertyName("_measurementPoint");
                _MeasurementPoint.SerializeJson(writer, options);
            }

            if ((Country != null) && (Country.Count != 0))
            {
                writer.WritePropertyName("country");
                writer.WriteStartArray();

                foreach (CodeableConcept valCountry in Country)
                {
                    valCountry.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if ((ReferenceStrength != null) && (ReferenceStrength.Count != 0))
            {
                writer.WritePropertyName("referenceStrength");
                writer.WriteStartArray();

                foreach (MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrength valReferenceStrength in ReferenceStrength)
                {
                    valReferenceStrength.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
예제 #24
0
 /// <summary>
 /// Converts between various units of gas concentration.
 /// </summary>
 /// <param name="oldVal">the value to be converted</param>
 /// <param name="oldUnit">the original unit of measure</param>
 /// <param name="newUnit">the new unit of measure</param>
 /// <returns></returns>
 public static double ConvertConcentration(double oldVal, Concentration oldUnit, Concentration newUnit)
 {
     // Look up conversion from old unit to new unit.
     return(oldVal / ConcentrationConversion[oldUnit] * ConcentrationConversion[newUnit]);
 }