Пример #1
0
        private async void btnSubmitdailyList_Clicked(object sender, EventArgs e)
        {
            try
            {
                string SelecetedCheckIds = string.Empty;
                string SelectedRadioIds  = string.Empty;
                string Comments          = txtComments.Text;
                foreach (var Checkbx in CheckBoxObj)
                {
                    SelecetedCheckIds += Checkbx.ToString() + ",";
                }
                foreach (var radiobx in RadiobBtnObj)
                {
                    SelectedRadioIds += radiobx.ToString() + ",";
                }
                _objHeaderModel.TokenCode            = Settings.TokenCode;
                _objDriver_DailyCheckLestPostRequest = new Driver_DailyCheckLestPostRequest
                {
                    VechicleId        = Settings.VehicleID.ToString(),
                    WorksheetId       = WorkSheetId.ToString(),
                    EmployeeId        = Settings.UserId.ToString(),
                    CreatedBy         = Settings.UserId.ToString(),
                    Comments          = Comments,
                    QuestionChecelist = SelectedRadioIds,
                    EngineHrs         = txtEnginehours.Text,
                    Odometer          = txtOdometer.Text,
                    SelectChecklist   = SelecetedCheckIds
                };
                if (string.IsNullOrEmpty(SelecetedCheckIds) || string.IsNullOrEmpty(SelectedRadioIds))
                {
                    DependencyService.Get <IToast>().Show("Please select the right Answers first and the checkbox!");
                }
                else
                {
                    await Navigation.PushPopupAsync(new LoadingPopPage());

                    _objDriver_DailyCheckListPostResponse = await _apiServices.DriverDailyCheckListPostAsync(new Get_API_Url().DriverDailyCheckListAddDataApi(_baseUrlPostdata), true, _objHeaderModel, _objDriver_DailyCheckLestPostRequest);

                    if (_objDriver_DailyCheckListPostResponse.Response.statusCode == 200)
                    {
                        DailyCheckListID = _objDriver_DailyCheckListPostResponse.Response.Id;
                        await App.NavigationPage.Navigation.PushAsync(new Driver_SignatureScreenPage(DailyCheckListID));

                        DependencyService.Get <IToast>().Show(_objDriver_DailyCheckListPostResponse.Response.Message);
                        await Navigation.PopAllPopupAsync();
                    }
                    else
                    {
                        DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!");
                        await Navigation.PopAllPopupAsync();
                    }
                }
            }
            catch (Exception ex)
            {
                var msg = ex.Message;
            }
        }
Пример #2
0
 public Driver_DailyCheckListPage(int sheetId, int vehicleId)
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     _objDailyEntryViewModel = new DailyEntryViewModel();
     _objHeaderModel         = new HeaderModel();
     _apiServices            = new RestApi();
     _baseUrl         = Settings.Url + Domain.DriverDailyCheckListApiConstant;
     _baseUrlPostdata = Settings.Url + Domain.DriverDailyCheckListSubmitDataApiConstant;
     _objDriver_DailyCheckListGetResponse  = new Driver_DailyCheckListGetResponse();
     _objDriver_DailyCheckListPostResponse = new Driver_DailyCheckListPostResponse();
     WorkSheetId  = sheetId;
     VehicleId    = vehicleId;
     RbtnList     = new List <string>();
     CheckBoxObj  = new List <int>();
     RadiobBtnObj = new List <int>();
     LoadPageData();
 }