Пример #1
0
 public JSONPlayer(Player model)
 {
     if (model == null) return;
     this.ID = model.ID;
     this.FirstName = model.FirstName;
     this.LastName = model.LastName;
     this.Gender = model.Gender;
 }
Пример #2
0
 public static List<Player> ImportCSV(string CSV)
 {
     List<Player> Result = new List<Player>();
     string[] separator = new string[] {"\n\r", "\r\n" };
     var rows = CSV.Trim().Split(separator,StringSplitOptions.None).ToList();
     if (rows.Count > 0) rows.RemoveAt(0);
     var cells = new string[4];
     var temp = new Player();
     foreach (var item in rows)
     {
         cells = item.Trim().Split(';');
         temp = new Player();
         temp.FirstName = cells[0];
         temp.LastName = cells[1];
         temp.Gender = cells[2].ToLower() == "m" ? Gender.Male : Gender.Female;
         temp.IsTemporary = cells[3].ToLower() == "j" ? true : false;
         temp.CreatedOn = DateTime.Now;
         temp.Deleted = false;
         Result.Add(temp);
     }
     return Result;
 }