Exemplo n.º 1
0
        private async void btn_delet(object sender, EventArgs e)
        {
            try
            {
                var item         = (MenuItem)sender;
                var selectedItem = ((DocumentsReports)this.BindingContext).FileName.FirstOrDefault(d => d.id == item.CommandParameter.ToString());

                deleteLicences deletebutton = new deleteLicences();
                var            answer       = await DisplayAlert("Confirmation message", AlertMessages.DeleteConfirmation(selectedItem.title), "Yes", "No");

                if (answer == true)
                {
                    if (await deletebutton.deleteData(item.CommandParameter.ToString(), URLConfig.DeleteAsyncurl))
                    {
                        ((DocumentsReports)this.BindingContext).BindingMethod((int)DocumentType.BackgroundCheck);
                        await EmployeeProfileHelper.RefreshEmployeeCurrentProfile(true);
                    }
                }
            }
            catch (Exception ex)
            {
                var logged = new LoggedException.LoggedException("Error in backgroundcheck.xaml.cs", ex);
                await logged.LoggAPI();
            }
        }
Exemplo n.º 2
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            deleteLicences deletebutton = new deleteLicences();


            var item = (Xamarin.Forms.Button)sender;

            var succeed = await deletebutton.deleteData(item.CommandParameter.ToString(), URLConfig.DeleteSchdeualurl);

            if (succeed)
            {
                var deletedItem = ((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule.FirstOrDefault(d => d.Id == item.CommandParameter.ToString());
                ((EmployeeScheduleViewmodel)this.BindingContext).MYschdeule.Remove(deletedItem);
                Toast.LongMessage("Deleted succesfully");
            }
            else
            {
                Toast.LongMessage(constants.Message);
            }
            //  uu.Remove()
        }