Beispiel #1
0
        // GET: Admin/News
        public ActionResult Index()
        {

            List<NewsAdminViewModel> result = new List<NewsAdminViewModel>();

            foreach (News N in reposetory.GetNews())
            {
                NewsAdminViewModel tmp = new NewsAdminViewModel
                {
                    News = N
                };
                if (N.Source == LevelType.Local)
                { 
                    tmp.Association = reposetory.GetAssociation(N.SourceLink);
                    tmp.SourceName = tmp.Association == null ? "-" : tmp.Association.Name;
                }
                if (N.Source == LevelType.Network)
                { 
                    tmp.Network = reposetory.GetNetwork(N.SourceLink);
                    tmp.SourceName = tmp.Network == null ? "-" : tmp.Network.NetworkName;
                }
                result.Add(tmp);
            }

            return View(result);
        }
Beispiel #2
0
 public BoardModel()
 {
     BoardMembers = new List<Guid>();
     Alternate = new List<Guid>();
     minMember = Int32.TryParse(ConfigurationManager.AppSettings["BoardMemberMin"], out minMember) ? minMember : 0;
     maxMember = Int32.TryParse(ConfigurationManager.AppSettings["BoardMemberMax"], out maxMember) ? maxMember : 99;
     minAlternate = Int32.TryParse(ConfigurationManager.AppSettings["BoardAlternateMin"], out minAlternate) ? minAlternate : 0;
     maxAlternate = Int32.TryParse(ConfigurationManager.AppSettings["BoardAlternateMax"], out maxAlternate) ? maxAlternate : 99;
 }
Beispiel #3
0
        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            var results = new List<ValidationResult>();
            var Distinct = new List<Guid>();

            Distinct.AddRange(this.BoardMembers.Where(b => b != Guid.Empty));
            Distinct.AddRange(this.Alternate.Where(b => b != Guid.Empty));
            Distinct.Add(Chairmann);
            Distinct.Add(Accountant);
            if (Auditor != Guid.Empty) Distinct.Add(Auditor);
            if (AuditorAlternate != Guid.Empty) Distinct.Add(AuditorAlternate);

            int BoardMembers = this.BoardMembers == null ? 0 : this.BoardMembers.Where(g => g != Guid.Empty).Count();
            int BoardAlternate = this.Alternate == null ? 0 : this.Alternate.Where(g => g != Guid.Empty).Count();

            if (Chairmann == Guid.Empty) results.Add(new ValidationResult(General.BoardCharimannMissing));
            if (Accountant == Guid.Empty) results.Add(new ValidationResult(General.BoardAccountantMissing));
            //if (Auditor == Guid.Empty) results.Add(new ValidationResult(General.BoardAuditorMissing));
            
            if (BoardMembers < minMember)
            {
                results.Add(new ValidationResult(string.Format(General.BoardMemeberMin, minMember)));
            }
            if (BoardMembers > maxMember)
            {
                results.Add(new ValidationResult(string.Format(General.BoardMemeberMax, maxMember)));
            }
            if (BoardAlternate < minAlternate)
            {
                results.Add(new ValidationResult(string.Format(General.BoardAlternateMin, minAlternate)));
            }
            if (BoardAlternate > maxAlternate)
            {
               results.Add(new ValidationResult(string.Format(General.BoardAlternateMax, maxAlternate)));
            }
            if (ConfigurationManager.AppSettings["BoardEvenOdd"].ToLower() == "odd" & BoardMembers % 2 == 0)
            {
                results.Add(new ValidationResult(General.BoardOdd));
            }
            if (ConfigurationManager.AppSettings["BoardEvenOdd"].ToLower() == "even" & BoardMembers % 2 != 0)
            {
                results.Add(new ValidationResult(General.BoardEven));
            }
            if (Distinct.Count() != Distinct.Distinct().Count())
            {
                results.Add(new ValidationResult(General.BoardSamePerson));
            }


            return results;
        }
 public MessageListModel()
 {
     NewMessage = new Message();
     NewMessageTo = new List<Guid>();
 }
        public ActionResult Communicate(MessageFolderModel MessageContext)
        {
            List<NR.Models.NRMembership> Active = new List<NR.Models.NRMembership>();
            if (MessageContext.NewMessageTo == null || !MessageContext.NewMessageTo.Any())
            {
                ModelState.AddModelError("NewMessageTo", General.ErrorNoRecipients);

            }

            if (MessageContext.Short)
            {
                if (String.IsNullOrWhiteSpace(MessageContext.BodyShort)) ModelState.AddModelError("BodyShort", General.ErrorNoBody);
            }
            else
            {
                if (String.IsNullOrWhiteSpace(MessageContext.Head) & String.IsNullOrWhiteSpace(MessageContext.Body)) ModelState.AddModelError("", General.ErrorNoHeadOrBody);
            }

            if (ModelState.ContainsKey("Folder.FoldereName"))
                ModelState["Folder.FoldereName"].Errors.Clear();

            MessageContext.Folder = reposetory.GetFolder(MessageContext.Folder.FolderID);
            MessageContext.LinkActive = MessageContext.Folder.Status != FolderStatus.Input;

            if (ModelState.IsValid)
            {

                List<Guid> Recivers = new List<Guid>();

                Active = reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID);
                Person Sender = reposetory.GetPerson(CurrentProfile.PersonID);


                foreach (Guid PersonID in MessageContext.NewMessageTo)
                {
                    if (PersonID == MistConversations.Int2Guid(0))
                    {
                        Recivers = Active.Select(m => m.Person.PersonID).ToList();
                    }
                    else if (PersonID == MistConversations.Int2Guid(1))
                    {
                        Recivers.AddRange(reposetory.GetAssociationTeamLeadersPersons(CurrentProfile.AssociationID).Select(m => m.PersonID).ToList());
                    }
                    else if (PersonID == MistConversations.Int2Guid(2))
                    {
                        Recivers.AddRange(reposetory.GetAssociationPersonsNoFeedback(CurrentProfile.AssociationID, MessageContext.Folder.FolderID).Select(m => m.PersonID).ToList());
                    }
                    else
                    {
                        Recivers.Add(PersonID);
                    }
                }

                foreach (Guid PID in Recivers)
                {
                    Person P = reposetory.GetPerson(PID);
                    if (!string.IsNullOrWhiteSpace(P.Email))
                    {
                        FeedbackFolder email = new FeedbackFolder();
                        //// set up the email ...
                        email.To = P.Email;
                        email.ReplyTo = CurrentProfile.Email;
                        email.folder = MessageContext.Folder;
                        email.Person = P;
                        email.message = MessageContext.Body;
                        email.Link = MessageContext.Link;
                        try
                        {
                            email.Send();
                        }
                        catch (Exception e)
                        {
                            LogFile.Write(e, "Email:" + P.Email);
                        }
                    }
                    if (MessageContext.Short)
                    {
#if DUMMYTEXT
                        ITextMessage SMSGateway = TextServiceProviderFactory.GetTextServiceProviderrInstance("NR.Infrastructure.DummyTextGateway", CurrentProfile.TextServiceProviderUserName, CurrentProfile.TextServiceProviderPassword);
#else
                        ITextMessage SMSGateway = TextServiceProviderFactory.GetTextServiceProviderrInstance(CurrentProfile.TextServiceProvider, CurrentProfile.TextServiceProviderUserName, CurrentProfile.TextServiceProviderPassword);
#endif

                        if (CurrentProfile.PersonID == Guid.Empty)
                        {
                            SMSGateway.FromText = General.SystemTextMessagesFrom;
                        }
                        else
                        {
                            SMSGateway.From = Sender;
                        }
                        
                        //SMSGateway.FromText = CurrentProfile.PersonID == Guid.Empty ? General.SystemTextMessagesFrom : string.IsNullOrWhiteSpace(CurrentProfile.Mobile) ? General.SystemTextMessagesFrom : CurrentProfile.Mobile;
                        SMSGateway.Message = MessageContext.BodyShort.ReplaceTagPerson(P);

                        //if (MessageContext.Link) SMSGateway.Message += "\r\n" + string.Format(General.FeedbackTextLink, Url.Action("FeedBack", "Planning", new { P = PID, F = MessageContext.Folder.FolderID }, "http"));
                        SMSGateway.Recipient = new List<Person> { P };
                        if (DateTime.Now.AddMinutes(1).Hour < 11) SMSGateway.DeliveryTime = DateTime.Now.AddMinutes(1).Date.AddHours(11);
                        reposetory.NewTextMessage(SMSGateway, CurrentProfile.AssociationID);

                        SMSGateway.HandShakeUrl = Url.Action("TextXStatus", "Account", new { ID = SMSGateway.TextId }, "http");

                        if (SMSGateway.Send())
                        {

                        };
                    }

                }

                ViewBag.FormSucces = true;

            }


            List<SelectListItem> AssItems = reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID).Select(d => new SelectListItem { Value = d.Person.PersonID.ToString(), Text = d.Person.FullName }).ToList();
            AssItems.Insert(0, new SelectListItem { Text = General.MissingFeedback, Value = MistConversations.Int2Guid(2).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.Teamleaders, Value = MistConversations.Int2Guid(1).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.All, Value = MistConversations.Int2Guid(0).ToString() });

            MessageContext.List = AssItems;

            return View(MessageContext);
        }
        public ActionResult View(Guid Id)
        {
            Team team = reposetory.GetTeam(Id);

            if (team == null) return HttpNotFound();
            List<Team> teams = new List<Team>();
            teams.Add(team);
            return View(teams);
        }
        public ActionResult Ajax([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest param)
        {
            if (param.Draw == 0)
            {
                return Json(new
                {
                    draw = param.Draw,
                    error = "ERROR"
                },
               JsonRequestBehavior.AllowGet);
            }

            int recordsTotal = reposetory.People.Count();
            int recordsFiltered = recordsTotal;
            List<PersonAdminList> result = new List<PersonAdminList>();


            if (recordsTotal > 0)
            {

                IOrderedQueryable<Person> FilteredPersons;

                //Filtering
                if (param.Search != null && !string.IsNullOrEmpty(param.Search.Value))
                {
                    FilteredPersons = (IOrderedQueryable<Person>)(from p in reposetory.People.Include(p => p.Memberships.Select(m => m.Association))
                                                                  where p.UserName.Contains(param.Search.Value) | String.Concat(p.FirstName, " ", p.FamilyName).Contains(param.Search.Value) |
                                                                      p.Mobile.Contains(param.Search.Value) | p.Phone.Contains(param.Search.Value) |
                                                                      p.Email.Contains(param.Search.Value)
                                                                  select p);

                    recordsFiltered = (from p in reposetory.People
                                       where p.UserName.Contains(param.Search.Value) | String.Concat(p.FirstName, " ", p.FamilyName).Contains(param.Search.Value) |
                                            p.Mobile.Contains(param.Search.Value) | p.Phone.Contains(param.Search.Value) |
                                            p.Email.Contains(param.Search.Value)
                                       select p).Count();
                }
                else
                {
                    FilteredPersons = (IOrderedQueryable<Person>)reposetory.People;

                }


                //Sorting
                var sortedColumns = param.Columns.GetSortedColumns();
                var isSorted = false;
                string sortdata;
                foreach (var column in sortedColumns)
                {
                    sortdata = column.Data;
                    //Fullname not supportet by Entity ordering
                    if (column.Data == "FullName")
                    {
                        if (!isSorted)
                        {
                            if (column.SortDirection == DataTables.Mvc.Column.OrderDirection.Ascendant)
                            {
                                FilteredPersons = FilteredPersons.OrderBy(p => p.FirstName.Trim()).ThenBy(p => p.FamilyName.Trim());

                            }
                            else
                            {
                                FilteredPersons = FilteredPersons.OrderByDescending(p => p.FirstName.Trim()).ThenByDescending(p => p.FamilyName.Trim());
                            }
                        }
                        else
                        {
                            if (column.SortDirection == DataTables.Mvc.Column.OrderDirection.Ascendant)
                            {
                                FilteredPersons = FilteredPersons.ThenBy(p => p.FirstName).ThenBy(p => p.FamilyName);

                            }
                            else
                            {
                                FilteredPersons = FilteredPersons.ThenByDescending(p => p.FirstName).ThenByDescending(p => p.FamilyName);
                            }
                        }
                        isSorted = true;
                    }

                    else if (!isSorted)
                    {
                        if (column.SortDirection == DataTables.Mvc.Column.OrderDirection.Ascendant)
                        {
                            FilteredPersons = FilteredPersons.OrderBy(column.Data);

                        }
                        else
                        {
                            FilteredPersons = FilteredPersons.OrderByDescending(column.Data);
                        }

                        isSorted = true;
                    }
                    else
                    {
                        if (column.SortDirection == DataTables.Mvc.Column.OrderDirection.Ascendant)
                        {
                            FilteredPersons = FilteredPersons.ThenBy(column.Data);
                        }
                        else
                        {
                            FilteredPersons = FilteredPersons.OrderByDescending(column.Data);
                        }
                    }
                }

                foreach (Person p in FilteredPersons.Skip(param.Start)
                            .Take(param.Length == 0 ? 10 : param.Length).Include("Memberships.Association").Include("Causes.Cause"))
                {
                    result.Add(new PersonAdminList(p));
                }



            }
            return Json(new
            {
                draw = param.Draw,
                recordsTotal = recordsTotal,
                recordsFiltered = recordsFiltered,
                error = "",
                data = result
            },
            JsonRequestBehavior.AllowGet);
        }
Beispiel #8
0
        //[HttpPost]
        public ActionResult _GetDirectory(string id)
        {
            string DirSetting = Url.Content(ConfigurationManager.AppSettings["BrowseDir"]);
            UrlHelper u = new UrlHelper(this.ControllerContext.RequestContext);

            if (string.IsNullOrWhiteSpace(id)) id = "/";


            string realPath = Server.MapPath(DirSetting + id);
            if (System.IO.Directory.Exists(realPath))
            {
                
                List<FulexTree> Dir = new List<FulexTree>();
                IEnumerable<string> dirList = Directory.EnumerateDirectories(realPath);
                foreach (string dir in dirList)
                {
                    DirectoryInfo d = new DirectoryInfo(dir);

                    FulexTree dirModel = new FulexTree {
                        name = Path.GetFileName(dir),
                        type = "folder",
                        dataAttributes = new FulexdataAttributes 
                        { 
                            id =  id + Path.GetFileName(dir) + "/",
                            children = d.GetDirectories().Any() ? true : false
                        }
                    };
                    
                    Dir.Add(dirModel);
                   
                }
                IEnumerable<string> fileList = Directory.EnumerateFiles(realPath);
                foreach (string file in fileList)
                {
                    FileInfo f = new FileInfo(file);

                    if ((f.Attributes & FileAttributes.Hidden) != 0) continue;

                    FulexTree dirModel = new FulexTree
                    {
                        name = Path.GetFileName(file),
                        type = "item",
                        url = u.Action("DownloadFile", "SI") + id +  Path.GetFileName(file).Replace(".","|"),
                        dataAttributes = new FulexdataAttributes { id = Path.GetFileName(file) }
                    };

                    switch (f.Extension.ToLower())
                    {
                        case ".pdf":
                            dirModel.name = "<i class=\"fa fa-file-pdf-o\"></i> " + dirModel.name;
                            break;
                        case ".xls":
                        case ".xlt":
                        case ".xlm":
                        case ".xlsx":
                        case ".xlsm":
                        case ".xltx":
                            dirModel.name = "<i class=\"fa fa-file-excel-o\"></i> " + dirModel.name;
                            break;
                        case ".doc":
                        case ".dot":
                        case ".docx":
                        case ".docm":
                        case ".dotm":
                            dirModel.name = "<i class=\"fa fa-file-word-o\"></i> " + dirModel.name;
                            break;
                        case ".ppt":
                        case ".pot":
                        case ".pptx":
                        case ".potm":
                        case ".potx":
                            dirModel.name = "<i class=\"fa fa-file-powerpoint-o\"></i> " + dirModel.name;
                            break;
                        case ".jpg":
                        case ".jpeg":
                        case ".png":
                        case ".gif":
                            dirModel.name = "<i class=\"fa fa-file-image-o\"></i> " + dirModel.name;
                            break;
                        case ".zip":
                            dirModel.name = "<i class=\"fa fa-file-archive-o\"></i> " + dirModel.name;
                            break;
                        case ".mov":
                        case ".mpg":
                        case ".wmv":
                            dirModel.name = "<i class=\"fa fa-file-video-o\"></i> " + dirModel.name;
                            break;
                        case ".html":
                            dirModel.name = "<i class=\"fa fa-file-code-o\"></i> " + dirModel.name;
                            break;
                        default:
                            dirModel.name = "<i class=\"fa fa-file-o\"></i> " + dirModel.name;
                            break;

                    }
                    
                    //dirModel.name = "<a href=\"" + u.Action("DownloadFile", "SI", new { src = System.Web.HttpUtility.UrlEncode(id + Path.GetFileName(file)) }) + "\" target=\"_blank\" >" + dirModel.name + "</a>";


                  Dir.Add(dirModel);

                    
                    
                    
                    
                }




                return Json(new
                {
                    error = "",
                    status = "OK",
                    data = Dir
                },
                JsonRequestBehavior.AllowGet);
            }
            return null;
        }
        public static Person ConvertPerson(SqlDataReader reader, Country country)
        {
            var personen = new Person();
            personen.PersonID = (Guid)reader["UserId"];
            personen.Email = reader["Email"] == DBNull.Value ? "" : ((String)reader["Email"]);
            personen.UserName = ((String)reader["UserName"]);
            personen.Password = reader["Password"] == DBNull.Value ? "" : (String)reader["Password"];
            personen.FirstName = ReturnProperty("Fornavn", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.FamilyName = ReturnProperty("Efternavn", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.Address = ReturnProperty("Vej", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.City = ReturnProperty("By", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.Zip = ReturnProperty("Postnr", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.Phone = ReturnProperty("Telefon", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.Mobile = ReturnProperty("Mobil", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            String Koen = ReturnProperty("gender", (string)reader["PropertyNames"], (string)reader["PropertyValuesString"]);
            personen.Created = (DateTime)reader["CreateDate"];

            personen.Gender = Gender.NotDefined;
            if (Koen == "K") personen.Gender = Gender.Woman;
            if (Koen == "M") personen.Gender = Gender.Man;
            personen.Trim();

            personen.Country = country;
            if (string.IsNullOrWhiteSpace(personen.Phone) | personen.Phone.Length < 8) personen.Phone = String.Empty;
            if (string.IsNullOrWhiteSpace(personen.Mobile) | personen.Mobile.Length < 8) personen.Mobile = String.Empty;
            if (personen.Address.Length < 2) personen.Address = "  ";
            if (personen.Address.Length > 70) personen.Address = personen.Address.Substring(0, 70);
            if (personen.City.Length < 2) personen.City = "  ";
            if (personen.Zip.Length < 2) personen.Zip = "  ";
            if (personen.FirstName.Length < 2) personen.FirstName = "**";
            if (personen.FamilyName.Length < 2) personen.FamilyName = "**";

            if (personen.UserName.Length > 10 || Regex.Replace(personen.UserName, @"[^A-Z0-9ÆØÅ]", "") != personen.UserName || WebSecurity.GetUserId(personen.UserName) > 0)
                GenerateUniqUsername(personen);

            if (!string.IsNullOrEmpty(personen.Email) && !Regex.IsMatch(personen.Email, @"^(['\""]{1,}.+['\""]{1,}\s+)?<?[\w\.\-]+@([\w\-]+\.)+[A-Za-z]{2,}>?$"))
                personen.Email = "";

            var results = new List<ValidationResult>();
            var context = new ValidationContext(personen, null, null);
            if (!Validator.TryValidateObject(personen, context, results))
            {
                foreach (ValidationResult res in results)
                {
                    System.Diagnostics.Debug.WriteLine("ModelFaileur: " + res.ErrorMessage);

                }
            }

            return personen;
        }
Beispiel #10
0
        public static void MigrateAssociation(int id)
        {
            #region SEEDDATA


            List<SeedData> Seed = new List<SeedData>{
                            new SeedData { Name = "Haslev", Number = 44, Network = 12, Established = "29-1-2001",
                            Governance = GovernanceType.Traditionel,
                            Chairmann ="DTA",
                            Auditor = "PECH",
                            Accountant = "JEDY",
                            BoardMembers = new List<string> 
                            { "KULA", "ULHA", "RIWI", "SUKI", "CLSM" }
                            },
                            
                            
                            
                            
                            new SeedData { Name = "Albertslund", Number = 217, Network = 15, Established = "26-1-2009"},
                            new SeedData { Name = "Almind", Number = 167, Network = 8, Established = "3-2-2011"},
                            new SeedData { Name = "Ansager (Ølgod)", Number = 199, Network = 6, Established = "?"},
                            new SeedData { Name = "Arden", Number = 65, Network = 2, Established = "5-9-2001"},
                            new SeedData { Name = "Askerød (Greve)", Number = 220, Network = 16, Established = "21-11-2008"},
                            new SeedData { Name = "Assens", Number = 72, Network = 9, Established = "26-9-2001"},
                            new SeedData { Name = "Ballerup", Number = 70, Network = 0, Established = "24-9-2001"},
                            new SeedData { Name = "Billund", Number = 118, Network = 6, Established = "26-3-2003"},
                            new SeedData { Name = "Birkerød", Number = 189, Network = 10, Established = "25-10-2006"},
                            new SeedData { Name = "Bispebjerg", Number = 179, Network = 14, Established = "5-4-2006"},
                            new SeedData { Name = "Bispehaven", Number = 48, Network = 4, Established = "21-2-2001"},
                            new SeedData { Name = "Bispehavens Kvindegruppe", Number = 251, Network = 4, Established = "11-6-2010"},
                            new SeedData { Name = "Bjerringbro", Number = 27, Network = 3, Established = "18-9-2000"},
                            new SeedData { Name = "Blaabjerg (Varde)", Number = 114, Network = 6, Established = "27-1-2003"},
                            new SeedData { Name = "Bogense", Number = 143, Network = 9, Established = "26-8-2004"},
                            new SeedData { Name = "Bramming", Number = 94, Network = 6, Established = "27-5-2002"},
                            new SeedData { Name = "Bramsnæs", Number = 210, Network = 11, Established = "23-8-2008"},
                            new SeedData { Name = "Brande", Number = 159, Network = 5, Established = "27-4-2005"},
                            new SeedData { Name = "Brandrupdam (Kolding)", Number = 216, Network = 8, Established = "7-10-2008"},
                            new SeedData { Name = "Brovst", Number = 151, Network = 1, Established = "28-10-2004"},
                            new SeedData { Name = "Brædstrup (Horsens)", Number = 264, Network = 8, Established = "28-12-2012"},
                            new SeedData { Name = "Brøndby Strand", Number = 43, Network = 16, Established = "23-1-2001"},
                            new SeedData { Name = "Brøndbyøster", Number = 121, Network = 15, Established = "12-5-2003"},
                            new SeedData { Name = "Brønderslev", Number = 37, Network = 1, Established = "7-11-2000"},
                            new SeedData { Name = "Brønshøj ", Number = 226, Network = 14, Established = "9-3-2009"},
                            new SeedData { Name = "Brønshøj-Husum", Number = 58, Network = 14, Established = "19-4-2001"},
                            new SeedData { Name = "Brønshøj-Husum", Number = 0, Network = 14, Established = "9-3-2009"},
                            new SeedData { Name = "Brørup", Number = 156, Network = 6, Established = "10-3-2005"},
                            new SeedData { Name = "Børkop", Number = 207, Network = 8, Established = "21-3-2005"},
                            new SeedData { Name = "Christiansfeld", Number = 135, Network = 8, Established = "18-3-2004"},
                            new SeedData { Name = "Dalby", Number = 191, Network = 12, Established = "12-3-2007"},
                            new SeedData { Name = "De etniske kvinder i Kbh.", Number = 200, Network = 14, Established = "31-10-2007"},
                            new SeedData { Name = "Den grønne Trekant", Number = 184, Network = 14, Established = "21-6-2006"},
                            new SeedData { Name = "Dronninglund", Number = 18, Network = 1, Established = "10-6-2000"},
                            new SeedData { Name = "Ebeltoft", Number = 136, Network = 4, Established = "23-3-2004"},
                            new SeedData { Name = "Esbjerg", Number = 267, Network = 6, Established = "12-3-2014"},
                            new SeedData { Name = "Esbjerg City", Number = 6, Network = 6, Established = "4-10-1999"},
                            new SeedData { Name = "Espergærde (Helsingør)", Number = 194, Network = 10, Established = "11-5-2007"},
                            new SeedData { Name = "Fakse og Ladepladsen", Number = 76, Network = 12, Established = "26-11-2001"},
                            new SeedData { Name = "Fakseladeplads", Number = 19, Network = 12, Established = "13-6-2000"},
                            new SeedData { Name = "Farsø", Number = 74, Network = 2, Established = "13-1-2001"},
                            new SeedData { Name = "Farum", Number = 176, Network = 10, Established = "7-3-2006"},
                            new SeedData { Name = "Fjerritslev", Number = 175, Network = 1, Established = "7-3-2006"},
                            new SeedData { Name = "Folehaven", Number = 174, Network = 14, Established = "22-2-2006"},
                            new SeedData { Name = "Fredericia", Number = 113, Network = 8, Established = "3-12-2002"},
                            new SeedData { Name = "Fredericia Vest (Fredericia)", Number = 248, Network = 8, Established = "12-5-2010"},
                            new SeedData { Name = "Frederiksberg", Number = 221, Network = 14, Established = "27-11-2008"},
                            new SeedData { Name = "Frederikshavn (Skagen)", Number = 23, Network = 1, Established = "31-8-2000"},
                            new SeedData { Name = "Frederikssund", Number = 81, Network = 10, Established = "12-2-2002"},
                            new SeedData { Name = "Faaborg-Midtfyn", Number = 11, Network = 9, Established = "29-2-2000"},
                            new SeedData { Name = "Gedved", Number = 232, Network = 8, Established = "25-6-2009"},
                            new SeedData { Name = "Gentofte", Number = 68, Network = 10, Established = "18-9-2001"},
                            new SeedData { Name = "Give", Number = 45, Network = 8, Established = "29-1-2001"},
                            new SeedData { Name = "Gjesing", Number = 178, Network = 6, Established = "28-3-2006"},
                            new SeedData { Name = "Gladsaxe", Number = 130, Network = 15, Established = "7-10-2003"},
                            new SeedData { Name = "Glamsbjerg", Number = 84, Network = 9, Established = "25-2-2002"},
                            new SeedData { Name = "Glostrup-Hvissinge", Number = 31, Network = 0, Established = "25-10-2000"},
                            new SeedData { Name = "Gram", Number = 166, Network = 7, Established = "3-11-2005"},
                            new SeedData { Name = "Grenå", Number = 195, Network = 4, Established = "16-5-2007"},
                            new SeedData { Name = "Greve", Number = 10, Network = 16, Established = "28-2-2000"},
                            new SeedData { Name = "Grindsted", Number = 17, Network = 6, Established = "6-6-2000"},
                            new SeedData { Name = "Græsted/Gilleleje", Number = 96, Network = 10, Established = "13-6-2002"},
                            new SeedData { Name = "Gråsten (under Åbenrå)", Number = 0, Network = 0, Established = "11-6-2012"},
                            new SeedData { Name = "Gullestrup", Number = 234, Network = 5, Established = "9-12-2009"},
                            new SeedData { Name = "Gørlev", Number = 149, Network = 11, Established = "27-9-2004"},
                            new SeedData { Name = "Haderslev - Syd", Number = 127, Network = 7, Established = "19-6-2007"},
                            new SeedData { Name = "Haderslev", NewName= "Haderslev C", Number = 168, Network = 7, Established = "1-12-2005"},
                            new SeedData { Name = "Hadsund", Number = 26, Network = 2, Established = "12-9-2000"},
                            new SeedData { Name = "Hals", NewName = "Hals-Aalborg", Number = 85, Network = 1, Established = "11-3-2002"},
                            new SeedData { Name = "Halsnæs", Number = 115, Network = 10, Established = "4-2-2003"},
                            new SeedData { Name = "Hammel", Number = 89, Network = 4, Established = "23-4-2002"},
                            new SeedData { Name = "Hedehusene", Number = 180, Network = 15, Established = "27-10-2009"},
                            new SeedData { Name = "Hedensted", Number = 205, Network = 8, Established = "7-5-2008"},
                            new SeedData { Name = "Hedensted - Vest", Number = 116, Network = 8, Established = "27-2-2003"},
                            new SeedData { Name = "Helsinge", Number = 134, Network = 10, Established = "10-12-2003"},
                            new SeedData { Name = "Helsingør", Number = 1, Network = 10, Established = "6-3-1998"},
                            new SeedData { Name = "Herlev", Number = 187, Network = 0, Established = "12-10-2006"},
                            new SeedData { Name = "Herning", Number = 34, Network = 3, Established = "30-10-2000"},
                            new SeedData { Name = "Herredsvang (Aarhus V)", Number = 80, Network = 4, Established = "20-2-2002"},
                            new SeedData { Name = "Hillerød", Number = 124, Network = 10, Established = "10-6-2003"},
                            new SeedData { Name = "Hinnerup", Number = 109, Network = 4, Established = "11-11-2002"},
                            new SeedData { Name = "Hirtshals", Number = 53, Network = 1, Established = "21-3-2001"},
                            new SeedData { Name = "Hjordkær (Aabenraa)", Number = 170, Network = 7, Established = "19-1-2006"},
                            new SeedData { Name = "Hjørring", Number = 57, Network = 1, Established = "9-4-2001"},
                            new SeedData { Name = "Hobro", Number = 120, Network = 2, Established = "10-4-2003"},
                            new SeedData { Name = "Holbæk", Number = 108, Network = 11, Established = "28-10-2002"},
                            new SeedData { Name = "Holmbladsgade", Number = 186, Network = 0, Established = "9-10-2006"},
                            new SeedData { Name = "Holstebro", Number = 4, Network = 5, Established = "20-5-1999"},
                            new SeedData { Name = "Holsted", Number = 209, Network = 6, Established = "18-6-2008"},
                            new SeedData { Name = "Holtbjerg", Number = 144, Network = 5, Established = "20-6-2004"},
                            new SeedData { Name = "Hornbæk (Helsingør)", Number = 139, Network = 10, Established = "31-3-2004"},
                            new SeedData { Name = "Hornslet", Number = 202, Network = 4, Established = "11-3-2008"},
                            new SeedData { Name = "Horsens", Number = 16, Network = 8, Established = "30-5-2000"},
                            new SeedData { Name = "Hovedgaard", Number = 238, Network = 8, Established = "27-1-2010"},
                            new SeedData { Name = "Hundested (Halsnæs)", Number = 188, Network = 11, Established = "?"},
                            new SeedData { Name = "Husum", Number = 246, Network = 14, Established = "1-3-2011"},
                            new SeedData { Name = "Hvide Sande (Holmsland)", Number = 153, Network = 5, Established = "17-11-2004"},
                            new SeedData { Name = "Hvidebæk Kommune", Number = 155, Network = 0, Established = "22-2-2005"},
                            new SeedData { Name = "Hvidovre (tidligere Avedøre)", Number = 95, Network = 0, Established = "6-6-2002"},
                            new SeedData { Name = "Hvidovre Syd", Number = 211, Network = 16, Established = "25-8-2008"},
                            new SeedData { Name = "Høje Gladsaxe (Gammel)", Number = 250, Network = 0, Established = "24-11-2010"},
                            new SeedData { Name = "Høng", Number = 63, Network = 11, Established = "7-8-2001"},
                            new SeedData { Name = "Hørning", Number = 243, Network = 4, Established = "8-3-2010"},
                            new SeedData { Name = "Hørsholm", Number = 240, Network = 10, Established = "16-3-2010"},
                            new SeedData { Name = "Haarby", Number = 87, Network = 9, Established = "6-4-2002"},
                            new SeedData { Name = "Ikast", Number = 138, Network = 5, Established = "25-3-2004"},
                            new SeedData { Name = "Ilulissat", Number = 92, Network = 19, Established = "09-052002"},
                            new SeedData { Name = "Indre Nørrebro", Number = 212, Network = 14, Established = "25-8-2008"},
                            new SeedData { Name = "Ishøj", Number = 47, Network = 16, Established = "15-2-2001"},
                            new SeedData { Name = "Juelsminde", Number = 148, Network = 8, Established = "23-9-2004"},
                            new SeedData { Name = "Jyderup (overgået til Holbæk)", Number = 196, Network = 11, Established = "19-6-2007"},
                            new SeedData { Name = "Jyllinge", Number = 163, Network = 10, Established = "30-6-2005"},
                            new SeedData { Name = "Kalundborg", Number = 62, Network = 11, Established = "7-6-2001"},
                            new SeedData { Name = "Karup", Number = 123, Network = 3, Established = "4-6-2003"},
                            new SeedData { Name = "Kastrup", NewName  = "Tårnby", Number = 219, Network = 14, Established = "18-11-2008"},
                            new SeedData { Name = "Kgs. Enghave", Number = 157, Network = 0, Established = "17-3-2005"},
                            new SeedData { Name = "Kjellerup", Number = 54, Network = 3, Established = "29-3-2001"},
                            new SeedData { Name = "Klaksvig", Number = 190, Network = 18, Established = "14-12-2006"},
                            new SeedData { Name = "Klarup", Number = 225, Network = 2, Established = "4-3-2009"},
                            new SeedData { Name = "Kokkedal", Number = 40, Network = 10, Established = "23-11-2000"},
                            new SeedData { Name = "Kolding", Number = 15, Network = 8, Established = "22-5-2000"},
                            new SeedData { Name = "Korsør", Number = 100, Network = 11, Established = "22-8-2002"},
                            new SeedData { Name = "Kvaglund-Stengårdsvej", Number = 214, Network = 6, Established = "16-9-2008"},
                            new SeedData { Name = "København C (Kritiske Muslimer)", Number = 99, Network = 14, Established = "19-8-2002"},
                            new SeedData { Name = "København City", Number = 204, Network = 14, Established = "2-11-2007"},
                            new SeedData { Name = "Køge", Number = 42, Network = 16, Established = "28-11-2000"},
                            new SeedData { Name = "Langeland", Number = 140, Network = 9, Established = "27-4-2004"},
                            new SeedData { Name = "Langeskov", Number = 197, Network = 9, Established = "8-10-2007"},
                            new SeedData { Name = "Lemvig", Number = 192, Network = 3, Established = "15-3-2007"},
                            new SeedData { Name = "Lunderskov", Number = 66, Network = 8, Established = "6-9-2001"},
                            new SeedData { Name = "Lundtoftegade", Number = 9, Network = 14, Established = "9-2-2000"},
                            new SeedData { Name = "Lyngby", Number = 229, Network = 10, Established = "13-5-2009"},
                            new SeedData { Name = "Løgstør", Number = 8, Network = 1, Established = "23-11-1999"},
                            new SeedData { Name = "Løgumkloster (Tønder)", Number = 161, Network = 7, Established = "2-5-2005"},
                            new SeedData { Name = "Løkken", Number = 101, Network = 1, Established = "5-9-2002"},
                            new SeedData { Name = "Maniitsoq", Number = 249, Network = 19, Established = "20-10-2010"},
                            new SeedData { Name = "Mariager", Number = 24, Network = 4, Established = "7-9-2000"},
                            new SeedData { Name = "Maribo", Number = 119, Network = 13, Established = "7-4-2003"},
                            new SeedData { Name = "MC - Natteravnene", Number = 215, Network = 10, Established = "29-6-2008"},
                            new SeedData { Name = "Middelfart", Number = 7, Network = 9, Established = "27-10-1999"},
                            new SeedData { Name = "Mjølnerparken-Kbh. N", Number = 83, Network = 0, Established = "21-2-2002"},
                            new SeedData { Name = "Munkebo", Number = 141, Network = 9, Established = "11-5-2004"},
                            new SeedData { Name = "Møldrup", Number = 12, Network = 3, Established = "4-5-2000"},
                            new SeedData { Name = "Nakskov", Number = 60, Network = 13, Established = "29-5-2001"},
                            new SeedData { Name = "Nanortalik", Number = 103, Network = 19, Established = "14-9-2002"},
                            new SeedData { Name = "Narsaq", Number = 255, Network = 19, Established = "12-11-2011"},
                            new SeedData { Name = "Nexø", Number = 46, Network = 17, Established = "13-2-2001"},
                            new SeedData { Name = "Nibe", Number = 51, Network = 2, Established = "19-3-2001"},
                            new SeedData { Name = "Nordals", Number = 41, Network = 7, Established = "23-11-2000"},
                            new SeedData { Name = "Nr. Rangstrup", Number = 150, Network = 7, Established = "27-10-2004"},
                            new SeedData { Name = "Nuuk", Number = 25, Network = 19, Established = "7-9-2000"},
                            new SeedData { Name = "Nykøbing Falster", Number = 61, Network = 13, Established = "6-6-2001"},
                            new SeedData { Name = "Nykøbing Falster", Number = 247, Network = 13, Established = "5-7-2010"},
                            new SeedData { Name = "Nykøbing Mors", Number = 133, Network = 3, Established = "7-10-2003"},
                            new SeedData { Name = "Næstved", Number = 3, Network = 13, Established = "23-4-1999"},
                            new SeedData { Name = "Nørager (Bero marts  2013)", Number = 110, Network = 2, Established = "14-11-2002"},
                            new SeedData { Name = "Odden (Odsherred)", Number = 145, Network = 11, Established = "30-6-2004"},
                            new SeedData { Name = "Odense", Number = 259, Network = 9, Established = "15-2-2012"},
                            new SeedData { Name = "Odsherred", Number = 97, Network = 11, Established = "17-6-2002"},
                            new SeedData { Name = "Otterup", Number = 49, Network = 9, Established = "27-2-2001"},
                            new SeedData { Name = "Padborg (Aabenraa)", Number = 128, Network = 7, Established = "9-9-2003"},
                            new SeedData { Name = "Pal Familie Natteravne ", Number = 237, Network = 0, Established = "?"},
                            new SeedData { Name = "Pandrup", Number = 77, Network = 1, Established = "22-11-2001"},
                            new SeedData { Name = "Præstø", Number = 86, Network = 0, Established = "18-3-2002"},
                            new SeedData { Name = "Paamiut", Number = 254, Network = 19, Established = "31-3-2011"},
                            new SeedData { Name = "Qaqortog", Number = 201, Network = 19, Established = "20-2-2008"},
                            new SeedData { Name = "Qasigiannguit", Number = 0, Network = 19, Established = "16-9-2004"},
                            new SeedData { Name = "Qasigiannguit", Number = 147, Network = 19, Established = "16-9-2004"},
                            new SeedData { Name = "Qaanaaq", Number = 262, Network = 19, Established = "24-5-2012"},
                            new SeedData { Name = "Ramløse (Helsinge)", Number = 252, Network = 10, Established = "0-1-1900"},
                            new SeedData { Name = "Randers", Number = 2, Network = 4, Established = "25-9-1998"},
                            new SeedData { Name = "Ribe", Number = 67, Network = 6, Established = "17-9-2001"},
                            new SeedData { Name = "Ringkøbing & Søndervig", NewName = "Ringkøbing", Number = 142, Network = 5, Established = "17-8-2004"},
                            new SeedData { Name = "Ringsted", Number = 73, Network = 11, Established = "9-10-2001"},
                            new SeedData { Name = "Roskilde/Viby",  NewName = "Roskilde", Number = 52, Network = 10, Established = "21-3-2001"},
                            new SeedData { Name = "Rudersdal", Number = 231, Network = 10, Established = "17-6-2009"},
                            new SeedData { Name = "Ruds Vedby", Number = 263, Network = 11, Established = "24-10-2012"},
                            new SeedData { Name = "Ry", Number = 182, Network = 4, Established = "18-5-2006"},
                            new SeedData { Name = "Røde Kro (Aabenraa)", Number = 171, Network = 7, Established = "0-1-1900"},
                            new SeedData { Name = "Rødovre", Number = 227, Network = 15, Established = "30-3-2009"},
                            new SeedData { Name = "Rønde", Number = 122, Network = 4, Established = "26-5-2003"},
                            new SeedData { Name = "Rønne", Number = 5, Network = 17, Established = "11-6-1999"},
                            new SeedData { Name = "Samsø", Number = 228, Network = 4, Established = "3-6-2009"},
                            new SeedData { Name = "Seest (Kolding)", Number = 233, Network = 8, Established = "0-1-1900"},
                            new SeedData { Name = "Silkeborg", Number = 56, Network = 3, Established = "20-6-2004"},
                            new SeedData { Name = "Sindal", Number = 36, Network = 1, Established = "1-11-2000"},
                            new SeedData { Name = "Sisimiut (tidligere)", Number = 22, Network = 19, Established = "25-8-2000"},
                            new SeedData { Name = "Sisimiut", Number = 268, Network = 19, Established = "18-1-2014"},
                            new SeedData { Name = "Sjælør", Number = 104, Network = 14, Established = "17-9-2002"},
                            new SeedData { Name = "Skagen (Frederikshavn)", Number = 32, Network = 1, Established = "26-10-2000"},
                            new SeedData { Name = "Skanderborg", Number = 206, Network = 4, Established = "13-5-2008"},
                            new SeedData { Name = "Skive", Number = 93, Network = 3, Established = "14-5-2002"},
                            new SeedData { Name = "Skjern-Egvad", Number = 132, Network = 5, Established = "28-10-2003"},
                            new SeedData { Name = "Skovlunde", Number = 106, Network = 15, Established = "18-9-2002"},
                            new SeedData { Name = "Skovparken (Kolding)", Number = 154, Network = 8, Established = "5-1-2005"},
                            new SeedData { Name = "Skælskør", Number = 125, Network = 11, Established = "16-6-2003"},
                            new SeedData { Name = "Skærbæk", Number = 177, Network = 7, Established = "14-3-2006"},
                            new SeedData { Name = "Skævinge", Number = 152, Network = 10, Established = "8-11-2004"},
                            new SeedData { Name = "Skørping-Terndrup", Number = 13, Network = 2, Established = "8-6-2000"},
                            new SeedData { Name = "Slagelse", Number = 29, Network = 11, Established = "16-10-2000"},
                            new SeedData { Name = "Slangerup", Number = 137, Network = 10, Established = "24-3-2004"},
                            new SeedData { Name = "Smidstrup-Skærup", Number = 208, Network = 8, Established = "21-5-2008"},
                            new SeedData { Name = "Smørum", Number = 185, Network = 10, Established = "29-6-2006"},
                            new SeedData { Name = "Solrød", Number = 164, Network = 16, Established = "19-9-2005"},
                            new SeedData { Name = "Sorø", Number = 242, Network = 11, Established = "26-4-2010"},
                            new SeedData { Name = "St.Heddinge", Number = 126, Network = 13, Established = "17-6-2003"},
                            new SeedData { Name = "Stege", Number = 35, Network = 13, Established = "31-10-2000"},
                            new SeedData { Name = "Stenløse", Number = 14, Network = 10, Established = "15-5-2000"},
                            new SeedData { Name = "Struer", Number = 64, Network = 3, Established = "16-8-2001"},
                            new SeedData { Name = "Støvring", Number = 88, Network = 2, Established = "10-4-2002"},
                            new SeedData { Name = "Suðuroy", Number = 256, Network = 18, Established = "19-11-2011"},
                            new SeedData { Name = "Sundbyvester", Number = 224, Network = 14, Established = "21-2-2009"},
                            new SeedData { Name = "Glumsø", NewName = "Suså-Glumsø", Number = 38, Network = 13, Established = "14-11-2000"},
                            new SeedData { Name = "Svendborg", NewName = "Svendborg - Ærø", Number = 69, Network = 9, Established = "20-9-2001"},
                            new SeedData { Name = "Svogerslev (Roskilde)", Number = 98, Network = 10, Established = "18-6-2002"},
                            new SeedData { Name = "Sæby", Number = 158, Network = 1, Established = "14-4-2005"},
                            new SeedData { Name = "Sønderborg", Number = 30, Network = 7, Established = "24-10-2000"},
                            new SeedData { Name = "Sønderris", Number = 82, Network = 6, Established = "21-2-2002"},
                            new SeedData { Name = "Tasiilaq", Number = 253, Network = 19, Established = "31-3-2011"},
                            new SeedData { Name = "Thisted", Number = 131, Network = 3, Established = "20-10-2003"},
                            new SeedData { Name = "Thyregod", Number = 230, Network = 8, Established = "13-5-2009"},
                            new SeedData { Name = "Tilst", Number = 21, Network = 4, Established = "17-8-2000"},
                            new SeedData { Name = "Tingbjerg (Husum)", Number = 236, Network = 0, Established = "11-1-2010"},
                            new SeedData { Name = "Tistrup (Ølgod)", Number = 198, Network = 6, Established = "0-1-1900"},
                            new SeedData { Name = "Tommerup", Number = 222, Network = 9, Established = "2-12-2008"},
                            new SeedData { Name = "Tórshavn", Number = 75, Network = 18, Established = "14-11-2001"},
                            new SeedData { Name = "Trige", Number = 160, Network = 4, Established = "28-4-2005"},
                            new SeedData { Name = "Tune (Greve)", Number = 146, Network = 16, Established = "0-1-1900"},
                            new SeedData { Name = "Tønder", Number = 181, Network = 7, Established = "9-5-2006"},
                            new SeedData { Name = "Taastrup", Number = 55, Network = 0, Established = "2-4-2001"},
                            new SeedData { Name = "Tåstrup (Gadehavegård)", Number = 112, Network = 15, Established = "07 03 2012"},
                            new SeedData { Name = "Ullerslev", Number = 102, Network = 9, Established = "12-9-2002"},
                            new SeedData { Name = "Urbanplanen", Number = 1, Network = 14, Established = "14-6-2005"},
                            new SeedData { Name = "Uummannaq", Number = 59, Network = 19, Established = "20-4-2001"},
                            new SeedData { Name = "Uummannaq", Number = 258, Network = 19, Established = "10-1-2012"},
                            new SeedData { Name = "Vagum", Number = 218, Network = 18, Established = "1-11-2008"},
                            new SeedData { Name = "Valby Centrum", NewName= "Valby", Number = 203, Network = 14, Established = "1-4-2008"},
                            new SeedData { Name = "Vallensbæk", Number = 20, Network = 16, Established = "14-6-2000"},
                            new SeedData { Name = "Vamdrup", Number = 28, Network = 8, Established = "2-10-2000"},
                            new SeedData { Name = "Vanløse", Number = 260, Network = 14, Established = "8-3-2012"},
                            new SeedData { Name = "Varde", Number = 33, Network = 6, Established = "30-10-2000"},
                            new SeedData { Name = "Vejen", Number = 50, Network = 6, Established = "19-3-2001"},
                            new SeedData { Name = "Vejle", Number = 241, Network = 8, Established = "21-4-2010"},
                            new SeedData { Name = "Vejle-C", Number = 105, Network = 8, Established = "17-9-2002"},
                            new SeedData { Name = "Vejle-Nord", Number = 90, Network = 8, Established = "2-5-2002"},
                            new SeedData { Name = "Vejle-Syd", Number = 91, Network = 8, Established = "2-5-2002"},
                            new SeedData { Name = "Vemmelev", Number = 213, Network = 11, Established = "3-9-2008"},
                            new SeedData { Name = "Viborg", Number = 107, Network = 3, Established = "1-12-2008"},
                            new SeedData { Name = "Viby Sjælland (Roskilde)", Number = 245, Network = 10, Established = "21-6-2010"},
                            new SeedData { Name = "Videbæk", Number = 183, Network = 5, Established = "7-6-2006"},
                            new SeedData { Name = "Vojens", Number = 79, Network = 7, Established = "5-2-2002"},
                            new SeedData { Name = "Vordingborg", Number = 39, Network = 13, Established = "20-11-2000"},
                            new SeedData { Name = "Ældre Sagens Natteravne", Number = 239, Network = 4, Established = "29-10-2010"},
                            new SeedData { Name = "Ældre Sagens Natteravne", Number = 0, Network = 0, Established = "0-1-1900"},
                            new SeedData { Name = "Ærø (Svendborg -  Ærø)", Number = 261, Network = 9, Established = "7-4-2012"},
                            new SeedData { Name = "Ølgod", Number = 111, Network = 6, Established = "21-11-2002"},
                            new SeedData { Name = "Ølsemagle/Ølby", Number = 129, Network = 0, Established = "6-10-2003"},
                            new SeedData { Name = "Ørbæk", Number = 169, Network = 9, Established = "5-12-2005"},
                            new SeedData { Name = "Ragnhildgade", NewName= "Østerbro", Number = 71, Network = 14, Established = "10-10-2001"},
                            new SeedData { Name = "AAB58/Nørrebro", Number = 257, Network = 0, Established = "14 11 2011"},
                            new SeedData { Name = "AAB58/Nørrebro", Number = 257, Network = 14, Established = "14-11-2011"},
                            new SeedData { Name = "Aabenraa", Number = 117, Network = 7, Established = "13-3-2003"},
                            new SeedData { Name = "Aakirkeby (Nexø)", Number = 165, Network = 17, Established = "29-9-2005"},
                            new SeedData { Name = "Aalborg C (slået sam<men med Hals marts 14)", Number = 235, Network = 1, Established = "7-12-2009"},
                            new SeedData { Name = "Aalborg Ø", Number = 223, Network = 2, Established = "19-1-2009"},
                            new SeedData { Name = "Aalestrup", Number = 173, Network = 2, Established = "30-1-2006"},
                            new SeedData { Name = "Ålholm", Number = 172, Network = 1, Established = "30-1-2006"},
                            new SeedData { Name = "Århus Nord", NewName = "Århus N", Number = 244, Network = 4, Established = "22-6-2010"},
                            new SeedData { Name = "Århus V ", Number = 193, Network = 4, Established = "24-4-2007"},
                            new SeedData { Name = "Års", Number = 78, Network = 2, Established = "4-12-2001"}

        
        };

            Dictionary<string, DateTime> PersonCreated = new Dictionary<string, DateTime>();
            Dictionary<string, Guid> PersonGuid = new Dictionary<string, Guid>();


            #endregion


            using (var context = new Repository())
            {
                StringBuilder SQLIdentity = new StringBuilder();
                Association ass = ExtractAssociation(id);
                System.Diagnostics.Debug.WriteLine("Start migrating Association: \"" + ass.Name + "\"");




                DateTime Created = ass.Created;




                SeedData rec = Seed.Find(n => n.Name.ToLower() == ass.Name.ToLower());
                if (rec != null)
                {
                    ass.Network = context.Networks.Where(n => n.NetworkNumber == rec.Network).FirstOrDefault();
                    ass.Established = rec.EstablishedDT;
                    if (!String.IsNullOrWhiteSpace(rec.NewName)) ass.Name = rec.NewName;
                    ass.Number = rec.Number;
                    ass.Governance = rec.Governance;
                }

                foreach (NRMembership m in ass.Memberships)
                {
                    PersonCreated.Add(m.Person.UserName, m.Person.Created);
                    PersonGuid.Add(m.Person.UserName, m.Person.PersonID);
                    var tmpPerson = new Person
                    {
                        UserName = m.Person.UserName,
                        FirstName = "Test",
                        FamilyName = "Test",
                        Address = "Test",
                        City = "Test",
                        Zip = "Test"
                    };
                    context.Entry(tmpPerson).State = EntityState.Added;

                    context.SaveChanges();

                    StringBuilder SQLIdentityPerson = new StringBuilder();
                    Created = (DateTime)PersonCreated[m.Person.UserName.ToString()];
                    Guid Gid = (Guid)PersonGuid[m.Person.UserName.ToString()];
                    SQLIdentityPerson.AppendLine(string.Format("UPDATE [People] SET Created = '{0}' WHERE Username = '******';", Created.ToString("yyyy-MM-dd hh:mm:ss.mmm"), m.Person.UserName.ToString()));
                    SQLIdentityPerson.AppendLine(string.Format("UPDATE [People] SET PersonID = '{0}' WHERE Username = '******';", Gid.ToString(), m.Person.UserName.ToString()));
                    context.Database.ExecuteSqlCommand(SQLIdentityPerson.ToString());

                    if (rec != null)
                    {
                        if (m.Person.UserName == rec.Chairmann)
                        { m.BoardFunction = BoardFunctionType.Chairman; }
                        else if (m.Person.UserName == rec.Accountant)
                        { m.BoardFunction = BoardFunctionType.Accountant; }
                        else if (m.Person.UserName == rec.Auditor)
                        { m.BoardFunction = BoardFunctionType.Auditor; }
                        else if (m.Person.UserName == rec.AuditorAlternate)
                        { m.BoardFunction = BoardFunctionType.AuditorAlternate; }
                        else if (rec.BoardMembers != null && rec.BoardMembers.Contains(m.Person.UserName))
                        { m.BoardFunction = BoardFunctionType.BoardMember; }
                        else if (rec.Alternate != null && rec.Alternate.Contains(m.Person.UserName))
                        { m.BoardFunction = BoardFunctionType.Alternate; }
                    }

                    context.Entry(m.Person).State = EntityState.Modified;
                    System.Diagnostics.Debug.WriteLine("  - ("+ ass.Name + ") ["+ m.Person.FullName + "]");

                    context.SaveChanges();

                    if (!m.Absent) //&& !WebSecurity.UserExists(m.Person.UserName))
                    {
                        WebSecurity.CreateAccount(m.Person.UserName, m.Person.Password);
                        if (WebSecurity.ConfirmAccount(m.Person.UserName))
                        {
                            System.Diagnostics.Debug.WriteLine("**Migrating Person: \"" + m.Person.UserName + "\" / (" + m.Person.Password + ")");
                        }
                    }

                }

                System.Diagnostics.Debug.WriteLine("  - Saving (" + ass.Name + ")");
                context.Entry(ass).State = EntityState.Added;

                context.SaveChanges();

                context.Memberships.Where(m => m.Association.AssociationID == ass.AssociationID)
                    .ToList()
                    .ForEach(p => p.Person.CurrentAssociation = p.Association.AssociationID);
                context.SaveChanges();


                //SQLIdentity.AppendLine("SET IDENTITY_INSERT [Associations] ON;");
                SQLIdentity.AppendLine(string.Format("UPDATE [Associations] SET Created = '{0}' WHERE AssociationID = '{1}';", Created.ToString("yyyy-MM-dd hh:mm:ss.mmm"), ass.AssociationID.ToString()));
                //SQLIdentity.AppendLine("SET IDENTITY_INSERT [Associations] OFF;");


                context.Database.ExecuteSqlCommand(SQLIdentity.ToString());



            }

        }
        public ActionResult RemoveExternalLogins()
        {
            ICollection<OAuthAccount> accounts = OAuthWebSecurity.GetAccountsFromUserName(User.Identity.Name);
            List<ExternalLogin> externalLogins = new List<ExternalLogin>();
            foreach (OAuthAccount account in accounts)
            {
                AuthenticationClientData clientData = OAuthWebSecurity.GetOAuthClientData(account.Provider);

                externalLogins.Add(new ExternalLogin
                {
                    Provider = account.Provider,
                    ProviderDisplayName = clientData.DisplayName,
                    ProviderUserId = account.ProviderUserId,
                });
            }

            ViewBag.ShowRemoveButton = externalLogins.Count > 1 || OAuthWebSecurity.HasLocalAccount(WebSecurity.GetUserId(User.Identity.Name));
            return PartialView("_RemoveExternalLoginsPartial", externalLogins);
        }
 public MessageFolderModel()
 {
     NewMessageTo = new List<Guid>();
 }
Beispiel #13
0
        public ActionResult Setup(Person CU)
        {
            Person dbPerson = reposetory.GetPersonComplete(CurrentProfile.PersonID);
            if (CU == null | dbPerson.PersonID != CurrentProfile.PersonID) return HttpNotFound();
 
            dbPerson.ListLines = CU.ListLines < 10 ? 10 : CU.ListLines;
            if (dbPerson.CurrentAssociation != CU.CurrentAssociation) dbPerson.CurrentAssociation = CU.CurrentAssociation; 

            reposetory.SavePerson(dbPerson);
            CurrentProfile.Clear();
            ModelState.Clear();
            ViewBag.FormSucces = true;

            var Associations = dbPerson.Memberships.Select(d => new SelectListItem { Value = d.AssociationID.ToString(), Text = d.Association.Name }).ToList();
            if (Associations == null)
            {
                Associations = new List<SelectListItem>();
                Associations.Insert(0, new SelectListItem { Value = Guid.Empty.ToString(), Text = General.DropDownEmpty });
            }
            if (Associations != null)
            {
                ViewBag.Associations = Associations;
            }
            return View(CU);
        }
Beispiel #14
0
        public ActionResult Setup()
        {
            Person CU = reposetory.GetPersonComplete(CurrentProfile.PersonID);
            if (CU == null) return HttpNotFound();

            var Associations = CU.Memberships.Select(d => new SelectListItem { Value = d.AssociationID.ToString(), Text = d.Association.Name }).ToList();
            if (Associations == null)
            {
                Associations = new List<SelectListItem>();
                Associations.Insert(0, new SelectListItem { Value = Guid.Empty.ToString(), Text = General.DropDownEmpty });
            }
            if (Associations != null) 
            {
                ViewBag.Associations = Associations;
            }

            return View(CU);
        }
Beispiel #15
0
        public ActionResult StatusUpdateRequest(Guid ID)
        {
            Lead dbLead = new Lead();

            dbLead = reposetory.GetLead(ID);
            if (dbLead == null) return null;
            if (dbLead.AssociationID == null) return null;


            dbLead.RequestUpdateMail = true;

            if (reposetory.Save(dbLead))
            {

                if (dbLead.AssociationID != null)
                {
                    string to = string.Empty;
                    List<string> cc = new List<string>();

                    AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID);

                    BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID);

                    to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email);

                    foreach (PersonAccess M in Access.Form)
                    {
                        if (M.Secretary)
                        {
                            NRMembership p = reposetory.GetMembership(M.FunctionID);
                            //cc += string.Format("{0},", p.Person.Email);
                            cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                        }
                        else if (M.Planner)
                        {
                            NRMembership p = reposetory.GetMembership(M.FunctionID);
                            //cc += string.Format("{0},", p.Person.Email);
                            cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                        }
                    }



                    var mail = new LeadRequestUpdate
                    {
                        to = to,
                        cc = cc,
                        lead = dbLead
                    };

                    //return new EmailViewResult(mail);

                    mail.Send();

                }
















                ViewBag.FormSucces = true;
            }

            return RedirectToAction("Index");
        }
        // GET: Migration
        public ActionResult Index()
        {
            List<SelectListItem> Forningliste = new List<SelectListItem>();
            using (SqlConnection cn = new SqlConnection(seedConnectionString))
            {


                SqlCommand cmd = new SqlCommand("SELECT * FROM [Foreninger] ORDER BY Navn", cn);
                cmd.CommandType = CommandType.Text;
                cn.Open();
                var reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);


                Forningliste.Add(new SelectListItem
                {
                    Text = "Alle",
                    Value = "0"
                });

                while ((reader.Read()))
                {
                    int StrId = (int)TjekDBNull(reader["ForeningsID"]);
                    if (StrId != 0 && !NoGoAss.Contains(StrId))
                    {
                        Forningliste.Add(new SelectListItem
                        {
                            Text = (String)reader["Navn"],
                            Value = StrId.ToString()
                        });
                    }
                }
            }


            return View(Forningliste);
        }
Beispiel #17
0
        public ActionResult Edit (Lead lead)
        {

            Lead dbLead = new Lead();
            if (lead.LeadID != Guid.Empty)
            {
                dbLead = reposetory.GetLead(lead.LeadID);
                if (dbLead == null) return RedirectToAction("Index");
            }
           
            if (ModelState.IsValid)
            {
                LeadStatus oldStatus = dbLead.Status;
                
                
                
                dbLead.FirstName = lead.FirstName;
                dbLead.FamilyName = lead.FamilyName;
                dbLead.Status = lead.Status;
                dbLead.AssociationID = lead.AssociationID == Guid.Empty ? null : lead.AssociationID;
                dbLead.Address = lead.Address;
                dbLead.City = lead.City;
                dbLead.Zip = lead.Zip;
                dbLead.Phone = lead.Phone;
                dbLead.Mobile = lead.Mobile;
                dbLead.Email = lead.Email;
                dbLead.Age = lead.Age;
                dbLead.Comments = lead.Comments;
                dbLead.RequestUpdateMail = false;

                if (reposetory.Save(dbLead))
                {
                    if ((oldStatus == LeadStatus.New | oldStatus == LeadStatus.Acknowledge | 
                        oldStatus == LeadStatus.Clarification  | lead.LeadID == Guid.Empty) 
                        & dbLead.Status == LeadStatus.Assigned & dbLead.AssociationID != null)
                    {
                        string to = string.Empty;
                        List<string> cc = new List<string>();

                        AccessModel Access = reposetory.GetAccess((Guid)dbLead.AssociationID);

                        BoardModelView Board = reposetory.GetBoardView((Guid)dbLead.AssociationID);

                        to = string.Format("{0} <{1}>", Board.Chairmann.FullName, Board.Chairmann.Email);

                        foreach (PersonAccess M in Access.Form)
                        {
                            if (M.Secretary)
                            {
                                NRMembership p =  reposetory.GetMembership(M.FunctionID);
                                //cc += string.Format("{0},", p.Person.Email);
                                cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                            }
                            else if (M.Planner)
                            {
                                NRMembership p = reposetory.GetMembership(M.FunctionID);
                                //cc += string.Format("{0},", p.Person.Email);
                                cc.Add(string.Format("{0} <{1}>", p.Person.FullName, p.Person.Email));
                            }
                        }
                        
                        
                        
                        var mail = new LeadAssign
                        {
                            to = to,
                            cc = cc,
                            lead  = dbLead
                        };

                        //return new EmailViewResult(mail);

                        mail.Send();


                    }
                    lead.LeadID = dbLead.LeadID;
                    ModelState.Clear();
                    
                    
                    ViewBag.FormSucces = true;
                }






            }
            
            List<AssociationListModel> tmp = reposetory.GetAssociationList(); //.RemoveAll(item => CU.Memberships.ToList().Exists(p => p.Association.AssociationID == item.AssociationID));
            ViewBag.Attach = new SelectList(tmp, "AssociationID", "Name");
            return View(lead);
        }
        public ActionResult _UploadCSV(HttpPostedFileBase file, Guid id, string Forening)
        {
            if (file != null)
            {
                string line;
                Dictionary<string, string> ProfilImages = new Dictionary<string, string>();
                ProfilDirSetting = Server.MapPath(Url.Content(ConfigurationManager.AppSettings["ProfileImage"]));
                var Memberships = new List<NRMembership>();
                List<String[]> Data = new List<String[]>();

                //FileStream aFile = new FileStream("../../sportsResults.csv", FileMode.Open);
                StreamReader sr = new StreamReader(file.InputStream, Encoding.GetEncoding(1252));

                // read data in line by line
                string header = sr.ReadLine();
                if (!header.StartsWith(@"""ID"";""Forening (R)"";""Username"";""Password"";""Indmeldt"";""Fodselsdag"";""Fornavn"";""Efternavn"";""Adresse"";""Postnr"";""By"";""Email"";""Mobil"";""Telefon"";""Notat"";""Aktiv"";""Udmeldt"";""Udmeldt"";""Ønsker IKKE Natteravnenyt"";""Idkort"";""Førstehjælp"";""Grunduddannelse"";""Billede"";""Login"";""Netværk"";""Login"";""Funktioner"";")) return Json(new { success = false, errorMessage = "Ikke korrekt header" });
                Data.Add(header.Split(';'));

                while ((line = sr.ReadLine()) != null)
                {
                    while (!line.Trim().EndsWith("\";"))
                    {
                        line += sr.ReadLine();
                    }
                    var AvivaData = line.Split(';');
                    for (int t = 0; t < AvivaData.Length; t++)
                    {
                        AvivaData[t] = AvivaData[t].TrimStart('"').TrimEnd('"');
                    }


                    if (AvivaData.Length > 15 & (Forening == string.Empty | Forening == AvivaData[1]))
                    {
                        Data.Add(AvivaData);
                        DateTime OutDate;
                        var membership = new NRMembership
                        {
                            Person = new Person()
                        };
                        int Avivaid;
                        if (int.TryParse(AvivaData[0].Trim(), out Avivaid)) membership.Person.IDWEB = Avivaid;
                        membership.Person.UserName = AvivaData[2] + new Guid().ToString();
                        membership.Person.Password = AvivaData[3];
                        if (DateTime.TryParse(AvivaData[4], out OutDate)) membership.SignupDate = OutDate;
                        if (DateTime.TryParse(AvivaData[5], out OutDate)) membership.Person.BirthDate = OutDate;
                        membership.Person.FirstName = AvivaData[6];
                        membership.Person.FamilyName = AvivaData[7];
                        membership.Person.Address = AvivaData[8];
                        membership.Person.Zip = AvivaData[9];
                        membership.Person.City = AvivaData[10];
                        membership.Person.Email = AvivaData[11];
                        membership.Person.Mobile = AvivaData[12];
                        membership.Person.Phone = AvivaData[13];
                        membership.Note = AvivaData[14];

                        membership.Type = AvivaData[15].Contains("x") ? PersonType.Active : PersonType.Passiv;

                        if (AvivaData[16].Contains("x")) membership.AbsentDate = DateTime.Now;
                        if (AvivaData[18].Contains("x")) membership.Person.PrintNewslettet = false;

                        if (AvivaData[26].Contains("Holdleder")) membership.Teamleader = true;
                        if (AvivaData[26].Contains("Administrator")) membership.Secretary = true;

                        if (AvivaData[26].Contains("Formand")) membership.BoardFunction = BoardFunctionType.BoardMember;
                        if (AvivaData[26].Contains("Næstformand")) membership.BoardFunction = BoardFunctionType.BoardMember;
                        if (AvivaData[26].Contains("Kasserer")) membership.BoardFunction = BoardFunctionType.Accountant;
                        if (AvivaData[26].Contains("Sekretær")) membership.BoardFunction = BoardFunctionType.BoardMember;
                        if (AvivaData[26].Contains("Bestyrelses medlem")) membership.BoardFunction = BoardFunctionType.BoardMember;
                        if (AvivaData[26].Contains("Suppleant")) membership.BoardFunction = BoardFunctionType.Alternate;
                        
                        
                        if (AvivaData[26].Contains("Revisor")) membership.BoardFunction = BoardFunctionType.Auditor;
                        if (AvivaData[26].Contains("Revisor Suppleant")) membership.BoardFunction = BoardFunctionType.AuditorAlternate;

                        membership.Person.Gender = Gender.NotDefined;

                        membership.Person.Trim();

                        if (!string.IsNullOrWhiteSpace(membership.Person.FullName) &
                            !string.IsNullOrWhiteSpace(membership.Person.Mobile) &
                            !string.IsNullOrWhiteSpace(membership.Person.Email)
                            )
                        {
                            membership.Person.Country = Country.DK;
                            if (string.IsNullOrWhiteSpace(membership.Person.Phone) | membership.Person.Phone.Length < 8) membership.Person.Phone = String.Empty;
                            if (string.IsNullOrWhiteSpace(membership.Person.Mobile) | membership.Person.Mobile.Length < 8) membership.Person.Mobile = String.Empty;
                            if (membership.Person.Address.Length < 2) membership.Person.Address = "  ";
                            if (membership.Person.Address.Length > 70) membership.Person.Address = membership.Person.Address.Substring(0, 70);
                            if (membership.Person.City.Length < 2) membership.Person.City = "  ";
                            if (membership.Person.Zip.Length < 2) membership.Person.Zip = "  ";
                            if (membership.Person.FirstName.Length < 2) membership.Person.FirstName = "**";
                            if (membership.Person.FamilyName.Length < 2) membership.Person.FamilyName = "**";

                            if (membership.Person.UserName.Length > 10 || Regex.Replace(membership.Person.UserName, @"[^A-Z0-9ÆØÅ]", "") != membership.Person.UserName || WebSecurity.GetUserId(membership.Person.UserName) > 0)
                                GenerateUniqUsername(membership.Person);

                            if (!string.IsNullOrEmpty(membership.Person.Email) && !Regex.IsMatch(membership.Person.Email, @"^\S+@\S+\.\S+$"))
                                membership.Person.Email = "";
                            if (membership.Person.UserName.Length < 3) GenerateUniqUsername(membership.Person);
                            if (Regex.IsMatch(membership.Person.Password, @"^[a-zA-Z0-9æøåÆØÅ*!#%&]{6,10}$")) membership.Person.Password.GeneratePassword();

                            Memberships.Add(membership);
                            if (AvivaData[22].Contains("media/"))
                            {
                                ProfilImages.Add(membership.Person.UserName, AvivaData[22]);
                            }
                        }
                    }

                    //line = sr.ReadLine();
                }
                sr.Close();

                string HtmlData = "<table border=\"1\">";


                foreach (var ld in Data)
                {
                    HtmlData += "<tr>";
                    foreach (string str in ld)
                    {
                        HtmlData += "<td>" + str + "</td>";
                    }

                    HtmlData += "</tr>";
                }
                HtmlData += "</table>";

                using (var context = new Repository())
                {

                    Association association = context.Associations.Find(id);

                    foreach (var M in Memberships)
                    {
                        M.AssociationID = association.AssociationID;
                        context.Entry(M).State = EntityState.Added;
                        try
                        {
                            context.SaveChanges();
                            if (!M.Absent) //&& !WebSecurity.UserExists(m.Person.UserName))
                            {
                                WebSecurity.CreateAccount(M.Person.UserName, M.Person.Password);
                                //if (WebSecurity.ConfirmAccount(M.Person.UserName))
                                //{
                                //    System.Diagnostics.Debug.WriteLine("**Migrating Person: \"" + M.Person.UserName + "\" / (" + M.Person.Password + ")");
                                //}


                            }

                            string ImagePath;
                            if (ProfilImages.TryGetValue(M.Person.UserName, out ImagePath))
                            {

                                var img = DownloadImageFromUrl(string.Format("http://www.natteravnene.dk/aviva/{0}", ImagePath));

                            if (img != null)
                            {
                                string newFileName = string.Format(ProfilDirSetting, M.Person.PersonID.ToString());
                                string newFileLocation = newFileName;
                                if (Directory.Exists(Path.GetDirectoryName(newFileLocation)) == false)
                                {
                                    Directory.CreateDirectory(Path.GetDirectoryName(newFileLocation));
                                }

                                img.Save(newFileLocation);
                                //progress += " - Image transferred";
                            }
                            }

                        }
                        catch (Exception e)
                        {
                            System.Diagnostics.Debug.WriteLine(string.Format("{0} Exception caught.", e));


                        }



                    }
                }


                return Json(new
                           {
                               success = true,
                               data = HtmlData
                           });

            }


            return Json(new { success = false, errorMessage = "Tjaa... Fejl" });
        }
        public ActionResult NewMessage(MessageListModel MessageContext)
        {
            List<NR.Models.NRMembership> Active = new List<NR.Models.NRMembership>();
            if (MessageContext.NewMessageTo == null || !MessageContext.NewMessageTo.Any())
            {
                ModelState.AddModelError("NewMessageTo", General.ErrorNoRecipients);

            }

            if (MessageContext.Short)
            {
                if (String.IsNullOrWhiteSpace(MessageContext.BodyShort)) ModelState.AddModelError("BodyShort", General.ErrorNoBody);
            }
            else
            {
                if (String.IsNullOrWhiteSpace(MessageContext.Head) & String.IsNullOrWhiteSpace(MessageContext.Body)) ModelState.AddModelError("", General.ErrorNoHeadOrBody);
            }

            if (ModelState.IsValid)
            {
                //An entity object cannot be referenced by multiple instances of IEntityChangeTracker

                Message Msg = new Message
                {
                    Recivers = new List<MessageReciver>(),
                    SenderID = CurrentProfile.PersonID
                };

                List<Guid> Recivers = new List<Guid>();

                Active = reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID);



                foreach (Guid PersonID in MessageContext.NewMessageTo)
                {
                    if (PersonID == MistConversations.Int2Guid(0))
                    {
                        Recivers = Active.Select(m => m.Person.PersonID).ToList();
                    }
                    else if (PersonID == MistConversations.Int2Guid(1))
                    {
                        Recivers.AddRange(reposetory.GetAssociationTeamLeadersPersons(CurrentProfile.AssociationID).Select(m => m.PersonID).ToList());
                    }
                    else if (PersonID == MistConversations.Int2Guid(2))
                    {
                        Recivers.AddRange(reposetory.GetAssociationBoardPersons(CurrentProfile.AssociationID).Select(m => m.PersonID).ToList());
                    }
                    else if (PersonID == MistConversations.Int2Guid(3))
                    {
                        Recivers.AddRange(reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID, Gender.Woman).Select(m => m.PersonID).ToList());
                    }
                    else if (PersonID == MistConversations.Int2Guid(4))
                    {
                        Recivers.AddRange(reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID, Gender.Man).Select(m => m.PersonID).ToList());
                    }
                    else
                    {
                        Recivers.Add(PersonID);
                    }
                }

                //Recivers = Recivers.Distinct().ToList();

                Msg.Recivers = Recivers.Distinct().Select(Id => new MessageReciver { ReciverID = Id }).ToList();
                //.Add(
                //   new MessageReciver
                //   {
                //       ReciverID = Active.Where(p => p.PersonID == PersonID).FirstOrDefault().PersonID
                //   }
                //   );
                if (MessageContext.Short)
                {
                    Msg.Body = MessageContext.BodyShort;
                    Msg.Type = MessageType.shortMessage;
                }
                else
                {
                    Msg.Head = MessageContext.Head;
                    Msg.Body = MessageContext.Body;
                    Msg.Type = MessageType.LongMessage;
                }
                reposetory.MessageSend(Msg);
                ViewBag.FormSucces = true;

            }


            List<SelectListItem> AssItems = reposetory.GetAssociationActivePersons(CurrentProfile.AssociationID).Select(d => new SelectListItem { Value = d.Person.PersonID.ToString(), Text = d.Person.FullName }).ToList();
            AssItems.Insert(0, new SelectListItem { Text = General.GenderMale, Value = MistConversations.Int2Guid(4).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.GenderFemale, Value = MistConversations.Int2Guid(3).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.Board, Value = MistConversations.Int2Guid(2).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.Teamleaders, Value = MistConversations.Int2Guid(1).ToString() });
            AssItems.Insert(0, new SelectListItem { Text = General.All, Value = MistConversations.Int2Guid(0).ToString() });

            MessageContext.List = AssItems;

            return View(MessageContext);
        }
Beispiel #20
0
        public ActionResult PrintNewsList()
        {
            IEnumerable<PrintMailingModel> All = reposetory.GetPrintNewsPersons().Select(X => new PrintMailingModel(X)).ToList();

            List<PrintMailingModel> result = new List<PrintMailingModel>();

            //var duplicate = All.GroupBy(x => x.SortAddress).Where(x => x.Count() > 1).Select(x => x);
            var duplicate = All.GroupBy(x => x.SortAddress).Select(x => x);
            foreach (var group in duplicate)
            {
                PrintMailingModel tmpMail = null;
                foreach (PrintMailingModel item in group)
                {
                    if (!string.IsNullOrWhiteSpace(item.Address) & !string.IsNullOrWhiteSpace(item.Zip) & !string.IsNullOrWhiteSpace(item.City))
                    {
                        if (tmpMail == null)
                        {
                            tmpMail = item;
                            tmpMail.Names = new List<NameModel>();
                            tmpMail.Names.Add(new NameModel { FirstName = item.FirstName, FamilyName = item.FamilyName });
                        }
                        else
                        {
                            tmpMail.ID = "00000000000000000000000000000000";
                            tmpMail.UserName += " / " + item.UserName;
                            tmpMail.Names.Add(new NameModel { FirstName = item.FirstName, FamilyName = item.FamilyName });
                        }
                    }
                }
                if (tmpMail != null) result.Add(tmpMail);
            }
            Response.ClearContent();
            Response.AddHeader("Content-Type", "application/vnd.ms-excel");
            Response.AddHeader("content-disposition", @"attachment;filename=""Natteravne Mailingliste.xls""");
            return View(result.OrderBy(r => r.Country).ThenBy(r => r.Zip).ToList());

        }