示例#1
0
        public async Task <string> DeleteForm(FormItem _item)
        {
            await Initialize();

            try
            {
                await formTable.DeleteAsync(_item);
                await SyncForm();

                await MobileService.SyncContext.PushAsync();

                return("SUCCESS");
            }
            catch (Exception ex)
            {
                Debug.WriteLine($"*********{ex}*****");
                return("FAILED");
            }
        }
示例#2
0
        public async Task <FormItem> AddForm(string type, string data, string imageSource = "")
        {
            await Initialize();

            var form = new FormItem
            {
                EnteredDateUTC    = DateTime.UtcNow.ToString(),
                FirstName         = Settings.Current.CurrentUser.firstName,
                LastName          = Settings.Current.CurrentUser.lastName,
                UserID            = Settings.Current.CurrentUser.userID,
                FormType          = type,
                FormData          = data,
                Byte64StringImage = imageSource
            };

            try
            {
                await formTable.InsertAsync(form);

                //Synchronize form
                await SyncForm();

                return(form);
            }
            //catch (MobileServicePushFailedException ex)
            //{
            //	Debug.WriteLine($"*********{ex}*****");
            //}
            //catch (MobileServiceInvalidOperationException ex)
            //{
            //	Debug.WriteLine($"*********{ex}*****");
            //}
            catch (Exception ex)
            {
                Debug.WriteLine($"*********{ex}*****");
            }

            return(null);
        }