protected void radGridAmountReceived_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem) { AdhocInvoiceAmountReceived amt = (AdhocInvoiceAmountReceived)e.Item.DataItem; ((GridDataItem)e.Item)["IsSetPaid"].Text = "No"; if (amt.IsSetPaid) { ((GridDataItem)e.Item)["IsSetPaid"].Text = "Yes"; } try { ((GridDataItem)e.Item)["User"].Text = "" + Administrator.GetAdministrator(amt.CommentatorID).LoginId + ""; } catch { } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateForm()) { Guid paygroupId = new Guid(hldEntryId.Value); string InvoiceType = ""; AdhocInvoiceList adInvList = AdhocInvoiceList.GetAdhocInvoiceList(Guid.Empty, paygroupId); adInv = AdhocInvoice.GetAdhocInvoice(adInvList[0].Id); Registration reg = null; string invoice = ""; try { AdhocInvoiceItem adhocInvoiceItem = AdhocInvoiceItemList.GetAdhocInvoiceItemList(adInvList[0].PayGroupId, adInvList[0].Id)[0]; InvoiceType = adhocInvoiceItem.InvoiceType; reg = Registration.GetRegistration(adInvList[0].RegistrationId); invoice = adInvList[0].Invoice; } catch { } // save the amount to the first entry or this default entry adInv.AmountReceived += decimal.Parse(txtAmountRecieved.Text); adInv.Save(); // paid? bool isPaid = false; Guid paymentGroupId = adInv.PayGroupId; string paidstatus_org = adInv.PayStatus; if (chkPaid.Checked && paidstatus_org == StatusPaymentEntry.NotPaid) { adInv.PayStatus = StatusPaymentEntry.Paid; isPaid = true; adInv.Save(); if (!string.IsNullOrEmpty(invoice))// AD-HOC INVOICE – CONFIRMATION OF PAYMENT { if (InvoiceType == AdhocInvoiceType.ReOpen) { Email.SendAdhocReOpenPaymentEmailConfirm(reg, paygroupId, invoice); } else if (InvoiceType == AdhocInvoiceType.ChangeReq || InvoiceType == AdhocInvoiceType.Custom || InvoiceType == AdhocInvoiceType.ExtDeadLine) { Email.SendAdhocOtherRequestPaymentEmailConfirm(reg, paygroupId, invoice); } adInv.LastSendPaidEmailDateString = DateTime.Now.ToString(); } } if (!chkPaid.Checked && paidstatus_org == StatusPaymentEntry.Paid) { adInv.PayStatus = StatusPaymentEntry.NotPaid; } adInv.Save(); // send email? if sent before do not send any more string lastdatesent = GeneralFunction.CleanDateTimeToString(adInv.LastSendPaidEmailDate, "dd/MM/yy HH:mm tt"); //if (lastdatesent == "") //{ // if (adInv.PaymentMethod != PaymentType.PayPal) // { // if (IsAmountFullyPaidIncludeThisAmount()) // // Full payment // GeneralFunction.CompleteNewEntrySubmissionOthers(paymentGroupId); // else // { // // Partial payment // Email.SendAllowUploadEmailOthers(Registration.GetRegistration(list[0].RegistrationId), paymentGroupId, ""); // GeneralFunction.UpdateEntryLastSendPaidEmailDate(paymentGroupId); // } // } //} Administrator admin = Security.GetAdminLoginSession(); // history AdhocInvoiceAmountReceived amt = AdhocInvoiceAmountReceived.NewAdhocInvoiceAmountReceived(); amt.Amount = decimal.Parse(txtAmountRecieved.Text); amt.DateReceivedString = dpDateReceived.DateInput.SelectedDate.ToString(); amt.PaygroupId = adInv.PayGroupId; amt.Invoice = adInv.Invoice; amt.Remarks = txtRemarks.Text; amt.IsSetPaid = isPaid; amt.DateCreatedString = DateTime.Now.ToString(); if (admin != null) { amt.isAdmin = true; amt.CommentatorID = admin.Id; } else { amt.isAdmin = false; amt.CommentatorID = reg.Id; } amt.Save(); if (Save_Clicked != null) { Save_Clicked(this, EventArgs.Empty); } } }