Example #1
0
        private void SyncSingers(MvcList local, MvcList remote, SingingClub scRemote)
        {
            foreach (object o in local)
            {
                TSCSingers localitem = o as TSCSingers;
                if (localitem != null && localitem.SingerKey.Trim().Length > 0)
                {
                    bool found = false;
                    foreach (object oremote in remote)
                    {
                        TSCSingers remoteitem = oremote as TSCSingers;
                        if (remoteitem != null && remoteitem.SingerKey.Trim().Length > 0)
                        {
                            if (localitem.KeyEquals(remoteitem) == true)
                            {
                                if (localitem.Equals(remoteitem) == false)
                                {
                                    UpdateSinger(localitem, remoteitem, scRemote);
                                }
                                found = true;
                                break;
                            }
                        }
                    }
                    if (found == false)
                    {
                        InsertSinger(localitem, scRemote);
                    }
                }
            }

            foreach (object o in remote)
            {
                TSCSingers remoteitem = o as TSCSingers;
                if (remoteitem != null && remoteitem.SingerKey.Trim().Length > 0)
                {
                    bool found = false;
                    foreach (object olocal in local)
                    {
                        TSCSingers localitem = olocal as TSCSingers;
                        if (localitem != null && localitem.SingerKey.Trim().Length > 0)
                        {
                            if (remoteitem.KeyEquals(localitem) == true)
                            {
                                found = true;
                                break;
                            }
                        }
                    }
                    if (found == false)
                    {
                        DeleteSinger(remoteitem, scRemote);
                    }
                }
            }
        }
Example #2
0
        private List <TSCSingers> GetSingerList(SingingClub sc)
        {
            List <TSCSingers> list = new List <TSCSingers>();
            string            xml  = sc.GeneralStore(TableName.TSCSingers, TableAction.GET, (new TSCSingers().GetDataXml()));

            if (xml.Trim().Length > 0)
            {
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(xml);
                XmlNodeList nodes = doc.SelectNodes("/Root/Data");
                foreach (XmlNode node in nodes)
                {
                    TSCSingers singers = new TSCSingers(node);
                    list.Add(singers);
                }
            }
            return(list);
        }
Example #3
0
 private void DeleteSinger(TSCSingers remote, SingingClub scRemote)
 {
     _sb.AppendLine(string.Format("Delete: {0}", remote.SingerKey));
     scRemote.GeneralStore(TableName.TSCSingers, TableAction.DELETE, remote.GetDataXml());
 }
Example #4
0
 private void InsertSinger(TSCSingers local, SingingClub scRemote)
 {
     _sb.AppendLine(string.Format("Insert: {0}", local.SingerKey));
     scRemote.GeneralStore(TableName.TSCSingers, TableAction.INSERT, local.GetDataXml());
 }
Example #5
0
 private void UpdateSinger(TSCSingers local, TSCSingers remote, SingingClub scRemote)
 {
     _sb.AppendLine(string.Format("Update: {0}", local.SingerKey));
     scRemote.GeneralStore(TableName.TSCSingers, TableAction.UPDATE, local.GetDataXml());
 }