Beispiel #1
0
        public ActionResult Edit(National national, HttpPostedFileBase IMG)
        {
            National natio = db.Nationals.Find(national.nation_id);

            national.nation_active     = natio.nation_active;
            national.nation_datecreate = natio.nation_datecreate;
            national.nation_dateupdate = DateTime.Now;
            national.nation_bin        = natio.nation_bin;
            national.nation_option     = natio.nation_option;

            //var i = new ImagesController();
            //if (IMG != null)
            //{
            //    var code = Guid.NewGuid().ToString();
            //    var img = new ImagesController();
            //    img.AddImages(IMG, Common.Link.IMG_AUTHOR, code);
            //    national.nation_img = code + IMG.FileName;
            //}
            //else
            //{
            //    national.nation_img = au.nation_img;
            //}


            var dao = new NationsDAO();

            if (dao.Edit(national))
            {
                return(Redirect("/Admin/NationsAdmin"));
            }
            else
            {
                return(Redirect(Common.Link.NOT_404));
            }
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,TrophiesNumber,NationalCupId")] National national)
        {
            if (id != national.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(national);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!NationalExists(national.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["NationalCupId"] = new SelectList(_context.NationalCups, "Id", "Name", national.NationalCupId);
            return(View(national));
        }
Beispiel #3
0
        public async Task <IHttpActionResult> PutNational(int id, National national)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != national.NationalID)
            {
                return(BadRequest());
            }

            db.Entry(national).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NationalExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            National national = db.Nationals.Find(id);

            db.Nationals.Remove(national);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #5
0
        /// <summary>
        /// Update an exsisting nation, or adds the nation if it dosent exsist
        /// </summary>
        /// <param name="updated">the updated nation</param>
        /// <returns></returns>
        public National UpdateNational(National updated)
        {
            nationalRepo.UpdateNational(updated);

            //update prosumers too in villages DOCDB

            return(updated);
        }
        private void barButtonNational_ItemClick(object sender, ItemClickEventArgs e)
        {
            panelMain.Controls.Clear();
            National uc = new National();

            uc.Dock = DockStyle.Fill;
            panelMain.Controls.Add(uc);
        }
Beispiel #7
0
        public override global::System.Data.DataSet Clone()
        {
            National cln = ((National)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #8
0
        public void UpdateNational(National National)
        {
            var temp = context.Nationals.FirstAsync(x => x.NationName == National.NationName).Result;

            National.NationalID = temp.NationalID;


            context.Nationals.AddOrUpdate(National);
            Save();
        }
Beispiel #9
0
        public IHttpActionResult GetNational(string tz, int cityOfBallotBox, int numBallotBox)
        {
            National singleNationalInBallotBox = db.National.FirstOrDefault(item => (item.cityId == cityOfBallotBox) && (item.numBallot.Equals(numBallotBox)) && (item.Identity == tz));

            if (singleNationalInBallotBox != null)
            {
                return(Ok(singleNationalInBallotBox));
            }
            return(NotFound());
        }
 public ActionResult Edit([Bind(Include = "nation_id,nation_name,nation_active,nation_bin,nation_datecreate,nation_dateupdate,nation_option")] National national)
 {
     if (ModelState.IsValid)
     {
         national.nation_dateupdate = DateTime.Now;
         db.Entry(national).State   = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(national));
 }
Beispiel #11
0
        public async Task <IHttpActionResult> GetNational(int id)
        {
            National national = await db.Nationals.FindAsync(id);

            if (national == null)
            {
                return(NotFound());
            }

            return(Ok(national));
        }
Beispiel #12
0
        public async Task <IHttpActionResult> PostNational(National national)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Nationals.Add(national);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = national.NationalID }, national));
        }
Beispiel #13
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            National ds = new National();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
        public ActionResult Create([Bind(Include = "nation_id,nation_name,nation_active,nation_bin,nation_datecreate,nation_dateupdate,nation_option")] National national)
        {
            if (ModelState.IsValid)
            {
                national.nation_bin        = false;
                national.nation_datecreate = DateTime.Now;
                db.Nationals.Add(national);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(national));
        }
Beispiel #15
0
        public ActionResult Platform([Bind(Include = "Name")] National national)
        {
            if (ModelState.IsValid)
            {
                var dataObj = new OrganogramLogic().Add(national);
                if (dataObj.Success)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(RedirectToAction("Index"));
        }
Beispiel #16
0
 //Option
 public bool Option(int?id)
 {
     try
     {
         National national = db.Nationals.Find(id);
         national.nation_option = !national.nation_option;
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Beispiel #17
0
        //Hàm sửa
        public bool Edit(National national)
        {
            try
            {
                db.Entry(national).State = EntityState.Modified;
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        // GET: AdminMain/NationalsA/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            National national = db.Nationals.Find(id);

            if (national == null)
            {
                return(HttpNotFound());
            }
            return(View(national));
        }
Beispiel #19
0
 //Active
 public bool Active(int?id)
 {
     try
     {
         National national = db.Nationals.Find(id);
         national.nation_active = !national.nation_active;
         db.SaveChanges();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
 public bool DeleteNational(int id)
 {
     try
     {
         National boat = db.National.Where(p => p.ID == id).FirstOrDefault();
         db.National.DeleteOnSubmit(boat);
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #21
0
        public async Task <IHttpActionResult> DeleteNational(int id)
        {
            National national = await db.Nationals.FindAsync(id);

            if (national == null)
            {
                return(NotFound());
            }

            db.Nationals.Remove(national);
            await db.SaveChangesAsync();

            return(Ok(national));
        }
Beispiel #22
0
        //Hàm xoá
        public bool Delete(int?id)
        {
            try
            {
                National national = db.Nationals.Find(id);
                db.Nationals.Remove(national);
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
        public async Task <IActionResult> Create(int nationalCupId, [Bind("Id,Name,TrophiesNumber,NationalCupId")] National national)
        {
            national.NationalCupId = nationalCupId;
            if (ModelState.IsValid)
            {
                _context.Add(national);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));
                return(RedirectToAction("Index", "Nationals", new { id = nationalCupId, name = _context.NationalCups.Where(m => m.Id == nationalCupId).FirstOrDefault().Name }));
            }
            ViewData["NationalCupId"] = new SelectList(_context.NationalCups, "Id", "Name", national.NationalCupId);
            // return View(national);
            return(RedirectToAction("Index", "Nationals", new { id = nationalCupId, name = _context.NationalCups.Where(m => m.Id == nationalCupId).FirstOrDefault().Name }));
        }
 public bool UpdateNational(int id, string name, byte[] image)
 {
     try
     {
         National national = GetNational(id);
         national.Name  = name;
         national.Image = image;
         db.SubmitChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
        // GET: AdminMain/NationalsA/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            National national = db.Nationals.Find(id);

            if (national == null)
            {
                return(HttpNotFound());
            }
            db.Nationals.Find(id).nation_bin = true;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #26
0
        //Thùng rác
        public bool Del(int?id)
        {
            try
            {
                National national = db.Nationals.Find(id);
                national.nation_bin = true;

                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Beispiel #27
0
        //Hàm thêm
        public bool Add(National national)
        {
            try
            {
                national.nation_datecreate = DateTime.Now;
                national.nation_dateupdate = DateTime.Now;

                db.Nationals.Add(national);
                db.SaveChanges();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool InsertNational(string name, byte[] image)
        {
            National national = new National();

            national.Name  = name;
            national.Image = image;
            try
            {
                db.National.InsertOnSubmit(national);
                db.SubmitChanges();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #29
0
        public Notification Add(National entity)
        {
            var notification = new Notification();

            try
            {
                entity.Id          = new ReferenceGenerator().GenerateId();
                entity.ProcessKind = "5B374CF9-4272-4137-9745-77911E863267";
                _ctx.National.Add(entity);
                _ctx.SaveChanges();
                notification.Message = "platform  was added successful";
                notification.Success = false;
            }
            catch (Exception ex)
            {
                notification.Message = "fail to add platform";
                notification.Success = false;
            }
            return(notification);
        }
Beispiel #30
0
        /// <summary>
        /// Creates a nation
        /// </summary>
        /// <param name="nation">The Nation to create</param>
        /// <returns>the created nation if its valid, else null</returns>
        public National CreateNational(National nation)
        {
            if (nation != null)
            {
                try
                {
                    var exsist = nationalRepo.FirstAsync(x => x.NationName == nation.NationName).Result;
                    return(exsist);
                }
                catch (Exception e)
                {
                    nationalRepo.InsertNational(nation);
                    nationalRepo.Save();

                    var returner = nationalRepo.FirstAsync(n => n.NationName == nation.NationName).Result;
                    return(returner);
                }
            }

            return(null);
        }
Beispiel #31
0
        public Event(DateTime ClockStart, DateTime ClockEnd, int ClockRunTime, System.Xml.Linq.XDocument XMLEvents, ref CrashHandler Crash)
        {
            ch = Crash;
            events = new Dictionary<string, List<EventItem>>();
            clock = new PartyClock(ClockStart, ClockEnd, ClockRunTime);
            Util.ShowClock = true;
            sound = new Sound(true);
            text = new Text2D();
            chess = new Chess();
            sf = new Starfield(150);

            intro = new Intro(ref sound, ref text);
            outro = new Outro(ref sound);

            advent = new Advent(ref sound);
            birthday = new Birthday(ref sound, ref text, ref chess);
            xmas = new Christmas(ref sound);
            smurf = new Datasmurf(ref sound, ref text); // random
            dif = new Dif(ref chess, ref sound); // random
            fbk = new Fbk(ref sound); // random
            hw = new Halloween(ref chess, ref sound, 25);
            lucia = new Lucia(ref chess, ref sound);
            newyear = new NewYear();
            richard = new RMS(ref sound, ref text); // random
            scroller = new Scroller(ref chess, ref sf, ref text); // random
            semla = new Semla();
            sune = new SuneAnimation(ref sound, ref text);
            tl = new TurboLogo(ref sound, ref chess, (OpenGL.Util.SpringOrFall.Equals("Spring")? true:false)/*((ClockStart.Month >= 1 && ClockStart.Month <= 8)? false:true)*/ ); // vilken termin är det? jan till början av augusti VT, resten HT... random
            valentine = new Valentine(ref sound);
            wl = new WinLinux(ref chess); //random
            creators = new Self(ref sound); // random
            bb = new BB(ref sound); // random
            GM = new GummiBears(ref sound);
            NDay = new National(ref chess, ref sound);
            easter = new Easter(ref sound);
            hajk = new Hajk(ref sound);
            mid = new Midsummer(ref sound);
            vaf = new Vaffla();
            wp = new Walpurgis();
            crayfish = new CrayFish();

            ts = new TeknatStyle(ref chess, ref sound, ref text);
            m = new Matrix(ref text);
            q = new Quiz(ref text, false, ref sound);
            talepsin = new Talespin(ref sound);
            cd = new ChipAndDale(ref sound, ref chess);
            nerd = new Nerdy(ref chess, ref sound);
            trex = new Trex(ref sound);
            sailormoon = new Sailormoon(ref sound,ref chess);
            gb = new GhostBusters(ref sound);
            zelda = new Zelda(ref sound, ref chess);
            tardis = new Tardis(ref sound);
            f**k = new F**k(ref sound, ref chess);

            silverFang = new SilverFang(ref sound);
            mt = new MoraT(ref sound);

            swine = new Swine(ref chess, ref text);
            tjall = new Tjall(ref chess, ref text);

            ronja = new Ronja(ref sound);
            emil = new Emil(ref sound);
            djungelboken = new Djungelboken(ref sound);
            fabbe = new Fabbe(ref sound);
            drink = new Drink(ref sound);
            frozen = new Frozen(ref sound);

            eventCurrent = null; // event item for events to be triggerd in clock_NewDate
            //randomEvent = new List<string>(new string[] { "starfield", "SuneAnimation", "TurboLogo", "Datasmurf", "WinLinux", "Scroller", "BB", "GummiBears", "TeknatStyle", "Matrix"});
            randomEvent = new List<string>(new string[] { "starfield", "Nerdy", "Talespin", "Sailormoon", "GhostBusters", "Zelda", "Tardis", "F**k", "SilverFang", "MoraT" });
            //new stuff
             List<UtilXML.EventData> ed = UtilXML.Loadeffectdata();

            // TODO: Make a clean list with all events allowed to be used implement so that it is actaully usable instead of a switch at the bottom of this file.
            Dictionary<string, Effect> effects = new Dictionary<string, Effect>()
            {
                {"SuneAnimation", new Effect(sune, ed.Find(e => e.Name == "SuneAnimation"))},
                {"Dif",new Effect(dif, ed.Find(e => e.Name == "Dif"))},
                {"Fbk",new Effect(fbk, ed.Find(e => e.Name == "Fbk"))},
                {"TurboLogo",new Effect(tl, ed.Find(e => e.Name == "TurboLogo"))},
                {"Datasmurf", new Effect(smurf, ed.Find(e => e.Name == "Datasmurf"))},
                {"RMS",new Effect(richard, ed.Find(e => e.Name == "RMS"))},
                {"WinLinux",new Effect(wl, ed.Find(e => e.Name == "WinLinux"))},
                {"Scroller",new Effect(scroller, ed.Find(e => e.Name == "Scroller"))},
                {"Self",new Effect(creators, ed.Find(e => e.Name == "Self"))},
                {"BB",new Effect(bb, ed.Find(e => e.Name == "BB"))},
                {"GummiBears",new Effect(GM, ed.Find(e => e.Name == "GummiBears"))},
                {"Hajk",new Effect(hajk, ed.Find(e => e.Name == "Hajk"))},
                {"TeknatStyle",new Effect(ts, ed.Find(e => e.Name == "TeknatStyle"))},
                {"Matrix",new Effect(m, ed.Find(e => e.Name == "Matrix"))},
                {"Quiz",new Effect(q, ed.Find(e => e.Name == "Quiz"))},
                {"Talespin",new Effect(talepsin, ed.Find(e => e.Name == "Talespin"))},
                {"ChipDale",new Effect(cd, ed.Find(e => e.Name == "ChipDale"))},
                {"Nerdy",new Effect(nerd, ed.Find(e => e.Name == "Nerdy"))},
              /*  {"Trex",new Effect(trex, ed.Find(e => e.Name == "Trex"))},*/
                {"Sailormoon",new Effect(sailormoon, ed.Find(e => e.Name == "Sailormoon"))},
                {"GhostBusters",new Effect(gb, ed.Find(e => e.Name == "GhostBusters"))},
                {"Zelda",new Effect(zelda, ed.Find(e => e.Name == "Zelda"))},
                {"Tardis",new Effect(tardis, ed.Find(e => e.Name == "Tardis"))},
                {"F**k",new Effect(f**k, ed.Find(e => e.Name == "F**k"))},
                {"SilverFang",new Effect(silverFang, ed.Find(e => e.Name == "SilverFang"))},
                {"MoraT",new Effect(mt, ed.Find(e => e.Name == "MoraT"))},
                {"Ronja",new Effect(ronja, ed.Find(e => e.Name == "Ronja"))},
                {"Emil",new Effect(emil, ed.Find(e => e.Name == "Emil"))},
                {"Djungelboken",new Effect(djungelboken, ed.Find(e => e.Name == "Djungelboken"))},
                {"Fabbe",new Effect(fabbe, ed.Find(e => e.Name == "Fabbe"))},
                {"Drink",new Effect(drink, ed.Find(e => e.Name == "Drink"))},
                {"Frozen",new Effect(drink, ed.Find(e => e.Name == "Frozen"))}
            };

            runEffectInMonth = new Dictionary<string, List<objdata>>();

            string[] months = Util.monthlist();
            int counter;
            foreach (KeyValuePair<string, Effect> pair in effects)
            {
                counter = 0;
                foreach (bool b in pair.Value.RunAllowedlist)
                {
                    if (b == true)
                    {
                        if (!runEffectInMonth.ContainsKey(months[counter]))
                        {
                            runEffectInMonth.Add(months[counter], new List<objdata>());
                        }

                        runEffectInMonth[months[counter]].Add(new objdata(pair.Key, pair.Value.Vetolist[counter], pair.Value.Priolist[counter], pair.Value.Runslist[counter]));
                    }
                    counter++;
                }
            }

            clock.NewDate += clock_NewDate; // Event listener

            if (ch.CrashDialogResult == System.Windows.Forms.DialogResult.Yes)
            {
                clock.clock = ch.CrashClock;
            }

            string name, date, type;
            // Event dates setup
            foreach (var item in XMLEvents.Descendants("event"))
            {
                name = item.Element("name").Value;
                date = item.Element("date").Value;
                type = item.Element("type").Value.ToLower();
                EventItem ei = new EventItem(name, type, date);
                if (!events.ContainsKey(date))
                {
                    List<EventItem> list = new List<EventItem>(); // seems most bad in my eyes...
                    events.Add(date, list);
                }

                for (int i = 0; i < events[date].Count; i++)
                {
                    EventItem e = events[date][i];
                    if ("birthday".Equals(e.Type) && "birthday".Equals(ei.Type))
                    {
                        e.Name += "\n\n" + ei.Name;
                        events[date][i] = e;
                    }
                }
                events[date].Add(ei);
                name = date = type = string.Empty;
            }

            // this needs to be fixed nicer...
            if (events.ContainsKey(ClockEnd.ToShortDateString()))
            {
                events[ClockEnd.ToShortDateString()].Clear(); // force this to be top..
                events[ClockEnd.ToShortDateString()].Add( new EventItem("outro", "outro", ClockEnd.ToShortDateString()) );
            }
            else
            {
                events.Add(ClockEnd.ToShortDateString(), new List<EventItem>() { new EventItem("outro", "outro", ClockEnd.ToShortDateString()) });
            }

            // Random effects on dates with no effects and check against new list of allowed things for them...
            DateTime dt = ClockStart;
            bool star = (Util.Rnd.Next(0, 1000) < 500 ? true:false); // make this random at the start too?
            int num = 0;

            while (dt <= ClockEnd)
            {
                date = dt.ToShortDateString();
                if (!events.ContainsKey(date))
                {
                    EventItem ei;

                    if (num == 0 || num == 1)
                    {
                        ei = new EventItem("starfield", "random", date);
                    }
                    else
                    {
                        //ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date);

                        string month = "";
                        if (dt != null)
                            month = dt.Month.ToString();

                        switch (month)
                        {
                            case "1": month = "jan"; break;
                            case "2": month = "feb"; break;
                            case "3": month = "mar"; break;
                            case "4": month = "apr"; break;
                            case "5": month = "maj"; break;
                            case "6": month = "jun"; break;
                            case "7": month = "jul"; break;
                            case "8": month = "aug"; break;
                            case "9": month = "sep"; break;
                            case "10": month = "okt"; break;
                            case "11": month = "nov"; break;
                            case "12": month = "dec"; break;
                        }//switch

                        if (runEffectInMonth.ContainsKey(month))
                        {
                            List<objdata> mobj = runEffectInMonth[month];

                            List<objdata> vetolist = new List<objdata>();
                            List<objdata> novetolist = new List<objdata>();

                            foreach (objdata n in mobj)
                            {

                                if ("Quiz".Equals(n.Name) && eventnum == 4)
                                {
                                    n.vetoAgain();
                                    eventnum = 0;
                                }

                                if (n.Veto == true)
                                {
                                    if (n.Runs > 0)
                                        vetolist.Add(n);
                                }
                                else
                                {
                                    if (n.Runs > 0)
                                        novetolist.Add(n);
                                }
                            }

                            vetolist.Sort();
                            novetolist.Sort();

                            if (vetolist.Count > 0)
                            {
                                ei = new EventItem(vetolist[0].Name, "random", date);
                                vetolist[0].noMoreVeto();
                            }
                            else if (novetolist.Count > 0)
                            {
                                ei = new EventItem(novetolist[0].Name, "random", date);
                                novetolist[0].decRuns();
                                if (eventnum < 4)
                                    eventnum++;
                            }
                            else
                            {
                                ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date);
                            }
                        }
                        else
                        {
                            ei = new EventItem(randomEvent[Util.Rnd.Next(1, randomEvent.Count)], "random", date);
                        }
                    }

                    num++;
                    if (num == 3)
                    {
                        num = 0;
                    }
                    ei = new EventItem("Self", "random", date); // this is for debuging new events
                    events.Add(date, new List<EventItem>());
                    events[date].Add(ei);
                }

                dt = dt.AddDays(1);
                date = string.Empty;
            }
        }