public int Prioritera(Fraga fraga)
        {
            var avtal = _avtalsFactory.Hamta(fraga.Avsandare.ServiceAvtalId);
            int prioritet = 0;

            foreach (var regel in avtal.ServiceRegler)
            {
                if (!regel.Uppfyller(fraga))
                {
                    prioritet += regel.Prioritet;
                }
            }

            return prioritet;
        }
Ejemplo n.º 2
0
        public void GivetAttEttServiceavtalHarFoljandeSLARegler(Table table)
        {
            var fixture = new Fixture();

            _serviceAvtal = fixture.CreateAnonymous<ServiceAvtal>();
            _serviceAvtal.ServiceRegler = table.CreateSet<StandardRegel>().Cast<SLARegel>().ToList();

            _fraga = fixture.CreateAnonymous<Fraga>();
            _fraga.Avsandare.ServiceAvtalId = 1;

            var serviceAvtalRepository = new Mock<IRepository<ServiceAvtal>>();
            serviceAvtalRepository.Setup(s => s.GetById(1)).Returns(_serviceAvtal);

            IoC.Init();
            IoC.InjectBinding(typeof(IRepository<ServiceAvtal>), serviceAvtalRepository.Object);
            IoC.Map();
        }
Ejemplo n.º 3
0
        protected void loadForm(bool knowledgetest)
        {
            string xmlFile = Server.MapPath("Licensetest.xml");

            if (knowledgetest == true)
            {
                xmlFile = Server.MapPath("knowledgetest.xml");
            }

            XmlDocument doc = new XmlDocument();
            StringBuilder str = new StringBuilder();
            doc.Load(xmlFile);

            XmlNodeList nodeList = doc.SelectNodes("/formular/fraga");

            foreach (XmlNode node in nodeList)
            {
                Fraga fraga = new Fraga();
                fraga.titel = node["titel"].InnerText;
                fraga.id = Convert.ToInt16(node.Attributes[0].Value);
                fraga.del = node["del"].InnerText;
                fraga.bild = node["bild"].InnerText;

                foreach (XmlNode svarNode in node["svar"].ChildNodes)
                {
                    Svar svar = new Svar();
                    svar.id = Convert.ToInt16(svarNode.Attributes[0].Value);
                    svar.titel = svarNode.InnerText;
                    svar.ratt = Convert.ToBoolean(Convert.ToInt16(svarNode.Attributes[1].Value));
                    fraga.svarsLista.Add(svar);
                }

                frageLista.Add(fraga);
            }
            if (knowledgetest == true)
            {
                str.Append("<div class='what_test' style='display: none;'>1</div>");
            }
            else
            {
                str.Append("<div class='what_test' style='display: none;'>0</div>");
            }
            str.Append("<div id='fragor' class='rearrange' runat='server' ID='rattning'>");
            foreach (Fraga fraga in frageLista)
            {
                int antalRattSvar = 0;
                str.Append("<div class='fraga' data=" + fraga.id + ">");
                str.Append("<div class='del'><span>Del:</span> " + fraga.del + "</div>");
                str.Append("<h2>" + fraga.titel + "</h2>");
                if (fraga.bild != "null")
                {
                    str.Append("<div class='img_form'><img src='" + fraga.bild + "'></div>");
                }
                foreach (Svar svar in fraga.svarsLista)
                {
                    if (svar.ratt == true)
                    {
                        antalRattSvar++;
                    }
                    str.Append("<div class='cbLabel'>");
                    str.Append("<input type='checkbox' name='" + fraga.id + "-" + svar.id + "' class='checkBox'> ");
                    str.Append("<label>" + svar.titel + "</label><br />");
                    str.Append("</div>");
                }
                str.Append("<p class='antalRattSvar' data='" + antalRattSvar + "'>Det finns <span>" + antalRattSvar + "</span> rätt svar på den här frågan.</p>");
                str.Append("</div>");
            }

            str.Append("</div>");
            lblForm.Text = str.ToString();
        }
Ejemplo n.º 4
0
 public override bool Uppfyller(Fraga arende)
 {
     return arende.Inskickad.AddHours(-8) < DateTime.Now;
 }
Ejemplo n.º 5
0
 public override bool Uppfyller(Fraga arende)
 {
     return true;
 }
Ejemplo n.º 6
0
 public abstract bool Uppfyller(Fraga arende);