public async Task <IHttpActionResult> UpdateDonationAsync(string id, DonationInfo donationInfo) { if (!ModelState.IsValid) { return(BadRequest()); } await sf.SFLoginAsync(); var recordType = "Donation__c"; var recordFields = new JObject(); recordFields.Add("Name", donationInfo.DonationName); recordFields.Add("Amount__c", donationInfo.Amount); recordFields.Add("Account_Name__c", donationInfo.AccountId); recordFields.Add("Donation_Date__c", donationInfo.DonationDate); var record = await sf.UpdateRecordAsync(id, recordFields, recordType); return(Created(new Uri(Request.RequestUri + "/"), record)); }
private bool CheckDonationInfo(DonationInfo donationInfo, int billID) { if (donationInfo == null) { Logger.WarnToUI("Could not find DonationInfo for BillID: " + billID); } return(donationInfo != null); }
public void ExportPDF() { if (Donations != null && Donations.Count() != 0) { DocumentManager.ExportDataPDF(DonationInfo.ConvertToList(Donations), "Export zvířata"); } else { MessageBox.Show("Žádná data pro export."); } }
private bool ValidateAll(DonationInfo newDonation, DonationPickupInfo newPickUp) { bool valid = true; //address check if (!Validator.NullOrEmptyRule(newDonation.Address)) { lblVAddress.Text = "Please enter Address"; valid = false; } else { lblVAddress.Text = ""; } //zip check if (!Validator.NullOrEmptyRule(newDonation.ZipCode)) { lblVZIP.Text = "Please enter ZIP Code"; valid = false; } else if (!Validator.ZIPCheck(newDonation.ZipCode)) { lblVZIP.Text = "Invalid ZIP Code"; valid = false; } else { lblVZIP.Text = ""; } //check pickup times if (newPickUp.PickupWindowStart > newPickUp.PickupWindowEnd) { lblVTimeWindow.Text = "Pickup window start must be before end"; valid = false; } else if (newPickUp.PickupWindowStart.Date <= DateTime.Today) { lblVTimeWindow.Text = "Pickup must be a date in the future"; valid = false; } else { lblVTimeWindow.Text = ""; } return(valid); }
private void btnSubmit_Clicked(object sender, EventArgs e) { DonationInfo donation = GetDonation(); DonationPickupInfo pickupInfo = GetPickupInfo(); if (ValidateAll(donation, pickupInfo)) { btnSubmit.IsEnabled = false; DependencyService.Get <IToast>().ShortAlert("Submitting... please wait."); InsertDonationToDatabase(donation, items, pickupInfo); InsertItems(items); } }
private void Callbacks_BillUpdated(object sender, Communication.EventArguments.Callbacks.BillUpdatedEventArgs e) { RunCatchLog(() => { DonationInfo donationInfo = BillDictionary.ContainsKey(e.BillID) ? BillDictionary[e.BillID] : null; switch (e.State) { case BillState.Payed: Logger.Error(string.Format("Donation successfull: {0} (TransactionID: {1}, BillId: {2})", e.StateName, e.TransactionID, e.BillID)); if (!CheckDonationInfo(donationInfo, e.BillID)) { break; } BillDictionary.Remove(e.BillID); SendFormattedMessageToLogin(donationInfo.Login, Settings.DonationThanksMessage, "Coppers", donationInfo.Coppers.ToString(CultureInfo.InvariantCulture)); break; case BillState.Refused: Logger.Error(string.Format("Donation Refused: {0} (TransactionID: {1}, BillId: {2})", e.StateName, e.TransactionID, e.BillID)); if (!CheckDonationInfo(donationInfo, e.BillID)) { break; } BillDictionary.Remove(e.BillID); SendFormattedMessageToLogin(donationInfo.Login, Settings.RefuseMessage); break; case BillState.Erroneous: Logger.Error(string.Format("Donation erroneous: {0} (TransactionID: {1}, BillId: {2})", e.StateName, e.TransactionID, e.BillID)); if (!CheckDonationInfo(donationInfo, e.BillID)) { break; } BillDictionary.Remove(e.BillID); SendFormattedMessageToLogin(donationInfo.Login, Settings.DonationErrorMessage, "ErrorMessage", e.StateName); break; default: // skip Issued/CreatingTransaction/ValidatingPayement break; } }, "Error in Callbacks_BillUpdated Method.", true); }
private void InsertDonationToDatabase(DonationInfo donation, ObservableCollection <ItemInfo> items, DonationPickupInfo pickupInfo) { try { //first removes handler so that this event can only be subscribed to once App.service.InsertDonationCompleted -= Service_InsertDonationCompleted; App.service.InsertDonationCompleted += Service_InsertDonationCompleted; App.service.InsertDonationAsync(donation, pickupInfo); } catch (Exception ex) { DependencyService.Get <IToast>().LongAlert("Error, unable to access server."); btnSubmit.IsEnabled = true; Debug.WriteLine(ex); } }
private DonationInfo GetDonation() { DonationInfo donation = new DonationInfo(); donation.Donor_ID = donor.Donor_ID; donation.Address = entAddress.Text; donation.Address2 = entAddress2.Text; donation.City = entCity.Text; donation.State = pickState.SelectedItem.ToString(); donation.ZipCode = entZIP.Text; donation.Store_ID = GetStoreByZIP(); donation.Status_Map_ID = 3; donation.Bypass_Flag = false; return(donation); }
public List <DonationInfo> GetDonations(int userkey) { var dons = from d in db.Donations where d.PersonKey == userkey select d; List <DonationInfo> donationInfo = new List <DonationInfo>(); foreach (var don in dons) { DonationInfo doninfo = new DonationInfo(); doninfo.DonationAmount = (decimal)don.DonationAmount; doninfo.DonationDate = don.DonationDate; donationInfo.Add(doninfo); } return(donationInfo); }
public List <DonationInfo> GetDonations(int PersonKey) { List <DonationInfo> donations = new List <DonationInfo>(); var ds = (from d in db.Donations where d.PersonKey == PersonKey select new { d.DonationAmount, d.DonationDate }).ToList(); foreach (var d in ds) { DonationInfo donation = new DonationInfo(); donation.DonationAmount = d.DonationAmount; donation.DonationDate = d.DonationDate.ToShortDateString(); donations.Add(donation); } return(donations); }
public async Task <ActionResult> UpdateAsync(string id) { var sf = new SalesforceTools(); await sf.SFLoginAsync(); var donation = await sf.FindRecordAsync(id, "Donation__c"); var accountName = await sf.FindRecordAsync(donation["Account_Name__c"].ToString(), "Account"); var donationInfo = new DonationInfo() { Id = donation["Id"].ToString(), DonationName = donation["Name"].ToString(), AccountId = donation["Account_Name__c"].ToString(), Amount = (int)donation["Amount__c"], DonationDate = donation["Donation_Date__c"].ToString(), AccountName = accountName["Name"].ToString() }; return(View("DonationForm", donationInfo)); }
public ActionResult New() { var donationInfo = new DonationInfo(); return(View("DonationForm", donationInfo)); }