protected void LoadPayments(int sponsorProfileId) { using (var context = new CSBCDbContext()) { var rep = new SponsorPaymentRepository(context); var payments = rep.GetSponsorPayments(sponsorProfileId); grd.DataSource = payments; grd.DataBind(); } }
protected void btnSave_Click(object sender, EventArgs e) { using (var db = new CSBCDbContext()) { var rep = new SponsorPaymentRepository(db); rep.Insert( new SponsorPayment { Amount = Convert.ToDecimal(txtPaymentAmount.Text), TransactionDate = Convert.ToDateTime(txtPaymentDate.Text), CompanyID = Master.CompanyId, TransactionNumber = txtCheckNo.Text, PaymentType = GetPaymentType(radPayment.SelectedValue), SponsorProfileID = Convert.ToInt32(cmbSponsorNames.SelectedValue), CreatedDate = DateTime.Today, CreatedUser = Master.UserName, PaymentID = PaymentId }); LoadPayments(Master.SponsorProfileId); } }
private void PopulateRecord(int paymentId) { using (var db = new CSBCDbContext()) { var rep = new SponsorPaymentRepository(db); var payment = rep.GetById(paymentId); txtPaymentDate.Text = payment.TransactionDate.Value.ToShortDateString(); txtPaymentAmount.Text = payment.Amount.ToString(); txtCheckNo.Text = payment.TransactionNumber; radPayment.SelectedIndex = SetPaymentType(payment.PaymentType); PaymentId = paymentId; } }