protected void btnDelete_Click(object sender, EventArgs e) { var donation = Donation; donation.TotalQuantity = _donationDetailsManager.FetchAll(Donation.Id).Sum(dd => dd.Quantity)-DonationDetail.Quantity; _donationManager.Save(donation); txtTotalQuantity.Text = donation.TotalQuantity.ToString(); var donationDetailToDelete = new DonationDetail { Id = DonationDetailId }; _donationDetailsManager.Delete(donationDetailToDelete); divMessageBox.Visible = true; divMessageBox.Attributes.Add("class", "notify warning"); ltrlMessageHeader.Text = "Saved Sucessful!"; ltrlMessage.Text = "Donation Detail Entry has been deleted!"; btnDelete.Enabled = false; btnSave.Enabled = false; }
protected void btnSave_Click(object sender, EventArgs e) { var donationDetail = new DonationDetail { Barcode = txtBarcode.Text, DonationId = Donation.Id, Id = DonationDetailId, ItemId = int.Parse(DDLItems.SelectedValue), Price = decimal.Parse(txtPrice.Text), Quantity = int.Parse(txtItemQuantity.Text), Uid = Guid.NewGuid(), UnitId = int.Parse(DDLUnits.SelectedValue) }; _donationDetailsManager.Save(donationDetail); var donation = Donation; donation.TotalQuantity = _donationDetailsManager.FetchAll(Donation.Id).Sum(dd=>dd.Quantity); _donationManager.Save(donation); txtTotalQuantity.Text = donation.TotalQuantity.ToString(); divMessageBox.Visible = true; divMessageBox.Attributes.Add("class", "notify info"); ltrlMessageHeader.Text = "Saved Sucessful!"; ltrlMessage.Text = "Donation Detail Entry has been saved!"; }