private void UpdateUploadedFiles() { try { DbContext = new Service1Client(Service1Client.EndpointConfiguration.BasicHttpBinding_IService1); QRAttachedFileData[] data = new QRAttachedFileData[0]; if (AllImages != null && AllImages.Count > 0) { data = new QRAttachedFileData[AllImages.Count]; QRAttachedFileData filedata; int i = 0; foreach (QRAttachedFile photo in AllImages) { filedata = new QRAttachedFileData { FileName = photo.FileName, FilePath = photo.FilePath, Id = photo.Id }; data[i] = filedata; i++; } } var result = DbContext.UpdateQRAttatchedFiles(Application.Current.Properties["UN"].ToString(), Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(), IniQRId, data); Application.Current.MainPage.DisplayAlert("Meddelande", result.Message, "STÄNG"); } catch (Exception e) { Application.Current.MainPage.DisplayAlert("Fel", e.Message, "STÄNG"); } }
private void TrySaveQR(object param) { try { if (ValuesCheck()) { DbContext = new Service1Client(Service1Client.EndpointConfiguration.BasicHttpBinding_IService1); QualityReportData qrData = new QualityReportData(); qrData.Description = Text_Info; qrData.RegNr = Text_RegNr; qrData.AoNr = Text_AoNr; if (AllPhotoFiles != null && AllPhotoFiles.Count > 0) { qrData.QRAttachedFileData = new QRAttachedFileData[AllPhotoFiles.Count]; QRAttachedFileData file; int i = 0; foreach (PhotoCls phfile in AllPhotoFiles) { file = new QRAttachedFileData { FileName = phfile.Name, FilePath = phfile.Path }; qrData.QRAttachedFileData[i] = file; i++; } } qrData.OfficeId = SelectedOffice.Id; qrData.QRReportResponsibleId = SelectedResponsibleEmployee.Id; qrData.OfficeDepartmentTaskId = SelectedDeptTask.Id; qrData.CreatedBy = Convert.ToInt32(Application.Current.Properties["EmpId"]); qrData.Created = SelectedDate; var result = DbContext.InsertQualityReport(Application.Current.Properties["UN"].ToString(), Application.Current.Properties["PW"].ToString(), Application.Current.Properties["Ucid"].ToString(), qrData); Application.Current.MainPage.DisplayAlert("Meddelande", result.Message, "STÄNG"); Application.Current.MainPage.Navigation.PopAsync(); } } catch (Exception e) { Application.Current.MainPage.DisplayAlert("Fel", e.Message, "STÄNG"); } }