public override bool Equals(object obj) { if (obj == null) { return(false); } if (obj == this) { return(true); } return(obj is Invoice other && ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) && ((Version == null && other.Version == null) || (Version?.Equals(other.Version) == true)) && ((LocationId == null && other.LocationId == null) || (LocationId?.Equals(other.LocationId) == true)) && ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) && ((PrimaryRecipient == null && other.PrimaryRecipient == null) || (PrimaryRecipient?.Equals(other.PrimaryRecipient) == true)) && ((PaymentRequests == null && other.PaymentRequests == null) || (PaymentRequests?.Equals(other.PaymentRequests) == true)) && ((DeliveryMethod == null && other.DeliveryMethod == null) || (DeliveryMethod?.Equals(other.DeliveryMethod) == true)) && ((InvoiceNumber == null && other.InvoiceNumber == null) || (InvoiceNumber?.Equals(other.InvoiceNumber) == true)) && ((Title == null && other.Title == null) || (Title?.Equals(other.Title) == true)) && ((Description == null && other.Description == null) || (Description?.Equals(other.Description) == true)) && ((ScheduledAt == null && other.ScheduledAt == null) || (ScheduledAt?.Equals(other.ScheduledAt) == true)) && ((PublicUrl == null && other.PublicUrl == null) || (PublicUrl?.Equals(other.PublicUrl) == true)) && ((NextPaymentAmountMoney == null && other.NextPaymentAmountMoney == null) || (NextPaymentAmountMoney?.Equals(other.NextPaymentAmountMoney) == true)) && ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) && ((Timezone == null && other.Timezone == null) || (Timezone?.Equals(other.Timezone) == true)) && ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) && ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)) && ((CustomFields == null && other.CustomFields == null) || (CustomFields?.Equals(other.CustomFields) == true))); }
public void ShareFile(string forLocation) { DateTime selectedExpirationDate = DateTime.Now.AddDays(7); //Selectie standaard op 7 dagen na vandaag ActionSheetDatePickerCustom actionSheetDatePicker; actionSheetDatePicker = new ActionSheetDatePickerCustom(HomeController.homeController.View); actionSheetDatePicker.Title = "Kies een vervaldatum:"; actionSheetDatePicker.Picker.Mode = UIDatePickerMode.Date; actionSheetDatePicker.Picker.MinimumDate = NSDateHelper.DateTimeToNSDate(DateTime.Today.AddDays(1)); //Zet selectie standaard op 7 dagen na vandaag actionSheetDatePicker.Picker.SetDate(NSDateHelper.DateTimeToNSDate(DateTime.Today.AddDays(7)), true); actionSheetDatePicker.Picker.ValueChanged += (sender, e) => { var nsDate = (sender as UIDatePicker).Date; DateTime selectedDate = NSDateHelper.NSDateToDateTime(nsDate); selectedExpirationDate = selectedDate.AddDays(1); Console.WriteLine(selectedExpirationDate.ToString()); }; actionSheetDatePicker.DoneButton.Clicked += (object sender, EventArgs e) => { //Dismiss actionsheet actionSheetDatePicker.Hide(true); //Show progress dialog DialogHelper.ShowProgressDialog("Delen", "Publieke url aan het ophalen", async() => { try { PublicUrl publicUrl = await DataLayer.Instance.CreatePublicFileShare(forLocation, selectedExpirationDate.Date); MFMailComposeViewController mvc = new MFMailComposeViewController(); mvc.SetSubject("Publieke URL naar gedeeld Pleiobox bestand"); string bodyText = "Mijn gedeelde bestand: \n" + publicUrl.publicUri + "\n \n" + "Deze link is geldig tot: " + selectedExpirationDate.ToString("dd-MM-yyyy"); mvc.SetMessageBody(bodyText, false); mvc.Finished += (object s, MFComposeResultEventArgs args) => { args.Controller.DismissViewController(true, null); }; _nodeViewController.PresentViewController(mvc, true, null); DialogHelper.HideProgressDialog(); } catch (Exception ex) { Insights.Report(ex); DialogHelper.HideProgressDialog(); DialogHelper.ShowErrorDialog("Fout", "Er is een fout opgetreden bij het delen van het bestand." + "\nVervers a.u.b. de map en probeer het opnieuw."); } }); }; actionSheetDatePicker.Show(); }
public Task <PublicUrl> CreatePublicFileShare(string pathOfFileToShare, DateTime expirationDateOfShare) { return(Task.Run(() => { if (!IsAuthorized()) { ReAuthorise(); } try { string iso8601FormattedDate = expirationDateOfShare.ToString("yyyy-MM-ddTHH:mm:ssZ"); StringBuilder localBoxUrl = new StringBuilder(); localBoxUrl.Append(_localBox.BaseUrl + "lox_api/links"); localBoxUrl.Append(pathOfFileToShare); string AccessToken = _authorization.AccessToken; var handler = new HttpClientHandler { }; using (var httpClient = new HttpClient(handler)) { httpClient.MaxResponseContentBufferSize = int.MaxValue; httpClient.DefaultRequestHeaders.ExpectContinue = false; httpClient.DefaultRequestHeaders.Add("x-li-format", "json"); httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Uri.EscapeDataString(AccessToken)); var data = new List <KeyValuePair <string, string> > (); data.Add(new KeyValuePair <string, string> ("expires", iso8601FormattedDate)); HttpContent content = new FormUrlEncodedContent(data); var response = httpClient.PostAsync(new Uri(localBoxUrl.ToString()), content).Result; if (response.IsSuccessStatusCode) { var jsonString = response.Content.ReadAsStringAsync().Result; PublicUrl createdPublicUrl = JsonConvert.DeserializeObject <PublicUrl> (jsonString); string incompletePublicUrl = createdPublicUrl.publicUri; createdPublicUrl.publicUri = _localBox.BaseUrl + "public/" + incompletePublicUrl; return createdPublicUrl; } return null; } } catch (Exception ex) { Insights.Report(ex); return null; } })); }
private void GeneratePublicUrls(string owaHttpExternalUrl, StoreObjectId folderId) { SmtpAddress primarySmtpAddress = this.user.PrimarySmtpAddress; string folderName = null; using (Folder folder = Folder.Bind(base.InnerMailboxFolderDataProvider.MailboxSession, folderId)) { folderName = folder.DisplayName; } PublicUrl publicUrl = PublicUrl.Create(owaHttpExternalUrl, SharingDataType.Calendar, primarySmtpAddress, folderName, this.user.SharingAnonymousIdentities); this.DataObject.PublishedCalendarUrl = publicUrl.ToString() + ".html"; this.DataObject.PublishedICalUrl = publicUrl.ToString() + ".ics"; }
public void ShowShareFileDatePicker(string pathToNewFileShare) { homeActivity.HideProgressDialog(); var selectedExpirationDate = DateTime.Now.AddDays(7); //Selectie standaard op 7 dagen na vandaag var picker = new DatePickerDialog(homeActivity, (object sender, DatePickerDialog.DateSetEventArgs e) => { selectedExpirationDate = e.Date; if (selectedExpirationDate.Date <= DateTime.Now.Date) { homeActivity.HideProgressDialog(); Toast.MakeText(Android.App.Application.Context, "Gekozen vervaldatum moet na vandaag zijn. Probeer het a.u.b. opnieuw.", ToastLength.Long).Show(); } else { ThreadPool.QueueUserWorkItem(async o => { PublicUrl createdPublicUrl = await DataLayer.Instance.CreatePublicFileShare(pathToNewFileShare, selectedExpirationDate); if (createdPublicUrl != null) { //Open e-mail intent var emailIntent = new Intent(Android.Content.Intent.ActionSend); string bodyText = "Mijn gedeelde bestand: \n" + createdPublicUrl.publicUri + "\n \n" + "Deze link is geldig tot: " + selectedExpirationDate.ToString("dd-MM-yyyy"); emailIntent.PutExtra(Android.Content.Intent.ExtraSubject, "Publieke URL naar gedeeld LocalBox bestand"); emailIntent.PutExtra(Android.Content.Intent.ExtraText, bodyText); emailIntent.SetType("message/rfc822"); homeActivity.RunOnUiThread(() => { homeActivity.HideProgressDialog(); homeActivity.StartActivity(emailIntent); }); } else { homeActivity.HideProgressDialog(); Toast.MakeText(Android.App.Application.Context, "Bestand delen mislukt", ToastLength.Short).Show(); } }); } }, selectedExpirationDate.Year, selectedExpirationDate.Month - 1, selectedExpirationDate.Day); picker.SetTitle("Selecteer vervaldatum:"); picker.Show(); }
public override int GetHashCode() { int hashCode = 1321207967; if (Id != null) { hashCode += Id.GetHashCode(); } if (Version != null) { hashCode += Version.GetHashCode(); } if (LocationId != null) { hashCode += LocationId.GetHashCode(); } if (OrderId != null) { hashCode += OrderId.GetHashCode(); } if (PrimaryRecipient != null) { hashCode += PrimaryRecipient.GetHashCode(); } if (PaymentRequests != null) { hashCode += PaymentRequests.GetHashCode(); } if (DeliveryMethod != null) { hashCode += DeliveryMethod.GetHashCode(); } if (InvoiceNumber != null) { hashCode += InvoiceNumber.GetHashCode(); } if (Title != null) { hashCode += Title.GetHashCode(); } if (Description != null) { hashCode += Description.GetHashCode(); } if (ScheduledAt != null) { hashCode += ScheduledAt.GetHashCode(); } if (PublicUrl != null) { hashCode += PublicUrl.GetHashCode(); } if (NextPaymentAmountMoney != null) { hashCode += NextPaymentAmountMoney.GetHashCode(); } if (Status != null) { hashCode += Status.GetHashCode(); } if (Timezone != null) { hashCode += Timezone.GetHashCode(); } if (CreatedAt != null) { hashCode += CreatedAt.GetHashCode(); } if (UpdatedAt != null) { hashCode += UpdatedAt.GetHashCode(); } if (CustomFields != null) { hashCode += CustomFields.GetHashCode(); } return(hashCode); }