Beispiel #1
0
        public static async Task InsertGroupInfo(Model.CreateGroupComponsePackage package)
        {
            GetGroupPackage p = new GetGroupPackage()
            {
                data = new GetGroupPackage.Data
                {
                    groupId = package.data.groupId,
                    item    = package.data
                }
            };

            DB.GroupInfo info = new DB.GroupInfo()
            {
                getGroupPackage = Util.Helpers.Json.ToJson(p),
                groupId         = package.data.groupId
            };

            try
            {
                await SDKProperty.SQLiteConn.InsertAsync(info);
            }
            catch (Exception)
            {
            }
        }
Beispiel #2
0
        public static async Task InsertGroupInfo(Model.GetGroupListPackage getGroupListPackage)
        {
            List <DB.GroupInfo> lst = new List <DB.GroupInfo>();
            var glist = await SDKProperty.SQLiteConn.Table <DB.GroupInfo>().ToListAsync();

            foreach (var group in getGroupListPackage.data.items.adminGroup)
            {
                var model = glist.Find(g => g.groupId == group.groupId);
                if (model != null)
                {
                    continue;
                }
                GetGroupPackage package = new GetGroupPackage()
                {
                    data = new Model.GetGroupPackage.Data()
                    {
                        groupId = group.groupId,
                        item    = group
                    }
                };
                DB.GroupInfo info = new DB.GroupInfo()
                {
                    getGroupPackage = Util.Helpers.Json.ToJson(package),
                    groupId         = group.groupId
                };
                lst.Add(info);
            }
            foreach (var group in getGroupListPackage.data.items.joinGroup)
            {
                var model = glist.Find(g => g.groupId == group.groupId);
                if (model != null)
                {
                    continue;
                }
                GetGroupPackage package = new GetGroupPackage()
                {
                    data = new Model.GetGroupPackage.Data()
                    {
                        groupId = group.groupId,
                        item    = group
                    }
                };
                DB.GroupInfo info = new DB.GroupInfo()
                {
                    getGroupPackage = Util.Helpers.Json.ToJson(package),
                    groupId         = group.groupId
                };


                lst.Add(info);
            }
            foreach (var group in getGroupListPackage.data.items.ownerGroup)
            {
                var model = glist.Find(g => g.groupId == group.groupId);
                if (model != null)
                {
                    continue;
                }
                GetGroupPackage package = new GetGroupPackage()
                {
                    data = new Model.GetGroupPackage.Data()
                    {
                        groupId = group.groupId,
                        item    = group
                    }
                };
                DB.GroupInfo info = new DB.GroupInfo()
                {
                    getGroupPackage = Util.Helpers.Json.ToJson(package),
                    groupId         = group.groupId
                };


                lst.Add(info);
            }
            try
            {
                await SDKProperty.SQLiteConn.InsertAllAsync(lst);
            }
            catch (Exception)
            {
            }
        }