示例#1
0
        static string AddFamilyToFluro(Elvanto.People.Person person)
        {
            Fluro.Realm realm = new Fluro.Realm
            {
                _id = FluroRidgehavenRealm
            };
            Fluro.Family.RootObject newfamily = new Fluro.Family.RootObject
            {
                items        = new List <string>(),
                phoneNumbers = new List <string>(),
                emails       = new List <string>(),
                address      = new Address(),
                _type        = "family",
                realms       = new List <Realm>()
            };
            newfamily.realms.Add(realm);



            if (newfamily.title == null)
            {
                newfamily.title = person.lastname;
            }

            newfamily.emails.Add(person.email);
            if (newfamily.address.addressLine1 == null)
            {
                newfamily.address.addressLine1 = person.home_address;
                newfamily.address.addressLine2 = person.home_address2;
                newfamily.address.suburb       = person.home_city;
                newfamily.address.state        = person.home_state;
                if (person.home_postcode != "")
                {
                    newfamily.address.postalCode = Convert.ToInt32(person.home_postcode);
                }
                newfamily.address.country = "Australia";
            }

            newfamily.phoneNumbers.Add(person.mobile);
            newfamily.phoneNumbers.Add(person.phone);

            if (person.archived > 0)
            {
                newfamily.status = "archived";
            }
            else
            {
                newfamily.status = "active";
            }


            return(Util.UploadToFluroReturnId(FluroFamilyURI, "POST", JsonConvert.SerializeObject(newfamily)));
        }
示例#2
0
        static void MigrateSongs()
        {
            string stringFullOfJson = Util.UploadToElvantoReturnJson(ElvantoSongURI, "POST", "{\"files\": true}");

            Fluro.Realm realm = new Fluro.Realm
            {
                _id = FluroCreativeRealm
            };



            SongRootObject rootobj = JsonConvert.DeserializeObject <SongRootObject>(stringFullOfJson);


            foreach (Song song in rootobj.songs.song)
            {
                logger.Info($"{song.id} {song.title}");
                Fluro.RootObject newsong = new Fluro.RootObject
                {
                    title  = song.title,
                    realms = new List <Fluro.Realm>()
                };
                newsong.realms.Add(realm);
                newsong.data = new Fluro.Data
                {
                    artist = song.artist,
                    album  = song.album,
                    ccli   = song.number
                };
                if (song.status == "0")
                {
                    newsong.status = "archived";
                }
                else
                {
                    newsong.status = "active";
                }

                List <Elvanto.File> elvantofiles = new List <Elvanto.File>();

                string filesstring = song.files.ToString();

                if (filesstring.Length >= 3)
                {
                    List <Elvanto.File> files = Util.GetFirstInstance <List <Elvanto.File> >("file", filesstring);
                    foreach (Elvanto.File file in files)
                    {
                        elvantofiles.Add(file);
                    }
                }



                string arrangementresult = Util.UploadToElvantoReturnJson(ElvantoSongArrangementURI, "POST", "{\"song_id\": \"" + song.id + "\",    \"files\": true}");

                var rootArrangement = JsonConvert.DeserializeObject <Elvanto.Arrangement.ArrangementRootObject>(arrangementresult);
                newsong.data.lyrics = new List <object>();
                foreach (Elvanto.Arrangement.Arrangement arrangement in rootArrangement.arrangements.arrangement)
                {
                    newsong.data.lyrics.Add(arrangement.lyrics);
                    if (arrangement.files.ToString().Length > 2)
                    {
                        ProcessIndividualArrangementFiles(arrangement.id, elvantofiles);
                        foreach (Elvanto.File flz in elvantofiles)
                        {
                            logger.Info($"{flz.title} {flz.content}");
                        }
                    }
                }

                AddSongToFluro(newsong, elvantofiles);
            }
        }