コード例 #1
0
        private async Task PostPropertyUserStatus()
        {
            try
            {
                PropertyUserStatus propertyUserStatus = new PropertyUserStatus();
                //  propertyUserStatus.Id = PropertyModel.PropertyModel.Id;
                propertyUserStatus.UserId     = Client.userId;
                propertyUserStatus.PropertyId = PropertyModel.PropertyModel.PropertyId;
                propertyUserStatus.StatusId   = PropertyModel.Status.Id;
                propertyUserStatus.PropertySubStatusMstrsId = (PropertyModel.SubStatus == null ? null : PropertyModel.SubStatus.Id);
                propertyUserStatus.Notes = Notes;
                propertyUserStatus.PropertyUserMapsId = PropertyModel.PropertyModel.Id;
                propertyUserStatus.UserId             = Client.userId;
                propertyUserStatus.RoleId             = Client.roleId;
                propertyUserStatus.StatusChangedOn    = DateTime.UtcNow;
                propertyUserStatus.CreatedBy          = Client.userId;
                await manager.SaveTaskAsync(propertyUserStatus);

                networkAccess = Connectivity.NetworkAccess;
                if (networkAccess == NetworkAccess.Internet)
                {
                    await manager.SyncAsync();
                }
                else
                {
                    Client.PendingCount = Client.PendingCount + 1;
                }
            }
            catch (Exception ex)
            {
                Debug.Write(ex.Message);
            }
        }
コード例 #2
0
        public async Task SaveTaskAsync(PropertyUserStatus item)
        {
            try
            {
                Debug.WriteLine("Panding Sync Data: {0}", client.SyncContext.PendingOperations);
                var data = await propertyUserStatusTable.OrderByDescending(i => i.StatusChangedOn).ToListAsync();

                Debug.WriteLine(data.Count());
                if (item.Id == null)
                {
                    await propertyUserStatusTable.InsertAsync(item);
                }
                else
                {
                    await propertyUserStatusTable.UpdateAsync(item);
                }
                Debug.WriteLine("Panding Sync Data: {0}", client.SyncContext.PendingOperations);
                //  await SyncAsync();
                data = await propertyUserStatusTable.OrderByDescending(i => i.StatusChangedOn).ToListAsync();

                Debug.WriteLine(data.Count());
                Debug.WriteLine("Panding Sync Data: {0}", client.SyncContext.PendingOperations);
            }
            catch (Exception e)
            {
                Debug.WriteLine("Save error: {0}", new[] { e.Message });
            }
        }