public void RemoveGift(gift myGift) { var procedure = "[removegift]"; var values = new { description = myGift.description }; conn.Query(procedure, values, commandType: CommandType.StoredProcedure); }
public Gifts(gift entity) : this() { ModelObjectHelper.CopyObject(entity, this); this.image = SiteSettings.GetGiftFilePath(this.image); this.SoundPath = !string.IsNullOrWhiteSpace(this.sound) ? SiteSettings.GetGiftFilePath(this.sound) : string.Empty; }
public void CompleteGift(gift myGift) { var procedure = "[giftToggle]"; var values = new { description = myGift.description }; conn.Query(procedure, values, commandType: CommandType.StoredProcedure); }
public IHttpActionResult Putgift(int id, gift gift) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gift.id) { return(BadRequest()); } db.Entry(gift).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!giftExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { gift gift = db.gifts.Find(id); db.gifts.Remove(gift); db.SaveChanges(); return(RedirectToAction("Index")); }
public void RemoveGift(string description) { gift destoryGift = new gift() { description = description }; DAL.RemoveGift(destoryGift); }
public ActionResult Edit([Bind(Include = "id,name,description,cost,material,photo,houseId,available")] gift gift) { if (ModelState.IsValid) { db.Entry(gift).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.houseId = new SelectList(db.houses, "id", "name", gift.houseId); return(View(gift)); }
public IHttpActionResult Postgift(gift gift) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.gifts.Add(gift); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = gift.id }, gift)); }
public IHttpActionResult Deletegift(int id) { gift gift = db.gifts.Find(id); if (gift == null) { return(NotFound()); } db.gifts.Remove(gift); db.SaveChanges(); return(Ok(gift)); }
// GET: gifts/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } gift gift = db.gifts.Find(id); if (gift == null) { return(HttpNotFound()); } return(View(gift)); }
// GET: gifts/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } gift gift = db.gifts.Find(id); if (gift == null) { return(HttpNotFound()); } ViewBag.houseId = new SelectList(db.houses, "id", "name", gift.houseId); return(View(gift)); }
public ActionResult Create(gift gift) { if (gift.photo_file != null) { string filename = Path.GetFileNameWithoutExtension(gift.photo_file.FileName.Replace(" ", string.Empty)); string extention = Path.GetExtension(gift.photo_file.FileName.Replace(" ", string.Empty)); filename = filename + DateTime.Now.ToString("yymmddssfff") + extention; gift.photo = "~/Content/images/" + filename; filename = Path.Combine(Server.MapPath("~/Content/images/"), filename); gift.photo_file.SaveAs(filename); } if (ModelState.IsValid) { db.gifts.Add(gift); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.houseId = new SelectList(db.houses, "id", "name", gift.houseId); return(View(gift)); }
public gift GetGift(uint id_gift) { gift new_gift = new gift(); string query = @"select name, description, category, condition, avantage, special from dnd.gift where id_gift = " + id_gift + ";"; if (OpenConnection()) { using (MySqlCommand cmd = new MySqlCommand(query, connection)) { MySqlDataReader dataReader = cmd.ExecuteReader(); if (dataReader.HasRows) { while (dataReader.Read()) { new_gift = new gift() { uid = id_gift, name = dataReader.IsDBNull(0) ? null : dataReader.GetString(0), description = dataReader.IsDBNull(1) ? null : dataReader.GetString(1), category = dataReader.IsDBNull(2) ? null : dataReader.GetString(2), conditions = dataReader.IsDBNull(3) ? null : dataReader.GetString(3), advantages = dataReader.IsDBNull(4) ? null : dataReader.GetString(4), specials = dataReader.IsDBNull(5) ? null : dataReader.GetString(5) }; } } dataReader.Close(); } this.CloseConnection(); } return new_gift; }
public void AddGif(gift newGift) { //party myTask = new party() { description = "TEST DESCRIPTION", done = false }; DAL.AddGift(newGift); }
public void toggle(gift desc) { DAL.CompleteGift(desc); }
public void AddGift(gift myGift) { conn.Insert <gift>(myGift); }
public void AddGif(gift newGift) { DAL.AddGift(newGift); }
private static void AddGiftToConstituent(Donation donation, ref constituent constt) { /* 12/16/2014 * For now, send all of our donations over as "CASH" until OLOD's API can handle pre-processed donations. * * */ try { var g = new gift(); var ps = new paymentSource(); var fieldMap = new abstractCustomizableEntityEntry[1]; fieldMap[0] = createCustomFieldMap("source", 0, constt.id, "source", "source", donation.SourceCode); ps.paymentType = PaymentType.Cash; ps.constituentId = constt.id; g.paymentSource = ps; var billing = donation.Donor.DonorAddresses.FirstOrDefault(x => x.AddressType == Enum_AddressType.Billing); var nowDate = DateTime.Now; g.createDate = nowDate; g.updateDate = nowDate; g.currencyCode = "USD"; g.address = TranslateAddress(billing, false); g.amount = donation.Amount; g.comments = "Processed by RaiseDonors using card ending in x" + donation.Last4ofCC; if (!string.IsNullOrEmpty(donation.Comment)) { g.comments += "Donor provided comment: " + donation.Comment; } g.customFieldMap = fieldMap; g.constituentId = constt.id; g.deductible = false; g.deductibleAmount = 0.00m; g.donationDate = nowDate; g.email = constt.primaryEmail; g.giftStatus = "Paid"; //Paid, Pending, Not Paid g.paymentType = PaymentType.Cash; g.phone = constt.primaryPhone; g.transactionDate = nowDate; g.transactionDateSpecified = true; //conditionally hide these -- wait for paul's response on what is best. //g.paymentStatus = ""; g.paymentMessage = "Processed thru RaiseDonors"; g.authCode = donation.AuthorizationNumber; g.txRefNum = donation.TransactionId; var distLines = new List <distributionLine>(); foreach (var d in donation.DonationFundAllocations) { //read project codes, and use in setup on which one to use. var fieldMaps = new List <abstractCustomizableEntityEntry> { createCustomFieldMap("anonymous", 0, constt.id, "distributionline", "anonymous", "false"), createCustomFieldMap("recognitionName", 0, constt.id, "distributionline", "recognitionName", donation.Donor.FullName), createCustomFieldMap("totalAdjustedAmount", 0, constt.id, "distributionline", "totalAdjustedAmount", d.Amount.ToString("0.00")), createCustomFieldMap("taxDeductible", 0, constt.id, "distributionline", "taxDeductible", "true"), }; var dLine = new distributionLine { customFieldMap = fieldMaps.ToArray(), amount = d.Amount, amountSpecified = true, other_motivationCode = donation.MotivationCode, //percentage = Math.Round((d.Amount / donation.Amount) * 100, 2, MidpointRounding.AwayFromZero), //motivationCode = donation.MotivationCode, //what motivated to give - don't use this one projectCode = d.Fund.Name //gift designation? }; distLines.Add(dLine); } //source-code, use customfield on the gift. //project, and source will throw error if not pre-existing. //throws error //Value cannot be null. //Parameter name: source g.distributionLines = distLines.ToArray(); var request = new SaveOrUpdateGiftRequest { gift = g, constituentId = constt.id }; var response = _client.SaveOrUpdateGift(request); Console.WriteLine("Successfully sent gift to OLOD, gift ID: " + response.gift.id + "."); } catch (FaultException exception) { Type exType = exception.GetType(); MessageFault mf = exception.CreateMessageFault(); Console.WriteLine("Error when adding gift to constituent // " + exception.Message); if (mf.HasDetail) { var detailedMessage = mf.GetDetail <System.Xml.Linq.XElement>(); String message = detailedMessage.FirstNode.ToString(); Console.WriteLine("More details // " + message); } } catch (Exception exc) { var text = exc; } }
public Gifts(gift entity, List<gift_categories> categories) : this(entity) { if (categories.Exists(i => i.id == this.gift_category_id)) this.Category = categories.SingleOrDefault(i => i.id == gift_category_id).name; }