private bool MergeEntries <T>(EntryList <T> source, EntryList <T> target, EntryType type, Func <T, T, bool> action) where T : EntryBase { var changed = false; foreach (var b in source) { var a = target.FirstOrDefault(e => e.Entry.Id == b.Entry.Id); if (a == null) { AddNewEntry <T>(type, b.AllBytes, b.Entry.Id); changed = true; continue; } if (action != null) { changed = action.Invoke(a, b) || changed; } } return(changed); }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateForm()) { AdhocInvoice adInv = SaveForm(); if (adInv != null) { GeneralFunction.CompletePendingPaymentAdhoc(adInv.RegistrationId, adInv.PayGroupId, adInv.PaymentMethod, lbTotalFees.Text, false); //if (entrySelected != null) { Administrator admin = Security.GetAdminLoginSession(); AdhocInvoiceItemList adhocInvItemList = AdhocInvoiceItemList.GetAdhocInvoiceItemList(payGroupId, adInv.Id); EntryList entries = EntryList.GetEntryList(Guid.Empty, adInv.RegistrationId, ""); foreach (AdhocInvoiceItem adhocInvItem in adhocInvItemList) { try { //FILTER For REOPEN ENTRY PROCESSING Entry entry = entries.FirstOrDefault(x => x.Id == adhocInvItem.EntryId && ((x.Status == StatusEntry.Completed) && (x.ProcessingStatus == StatusEntry.PendingVerification))); if (adhocInvItem.InvoiceType == "ReOpen") { //To set to Upload Complete if Payment Method is selected if (adInv.Invoice == "" && adInv.PaymentMethod != "") { entry.Status = StatusEntry.UploadCompleted; entry.ReopenedBy = admin.Id.ToString(); entry.ProcessingStatus = StatusEntry.Reopened; entry.IDAdhocInvoice = adhocInvItem.AdhocInvoiceId.ToString(); } else { entry.ReopenedBy = admin.Id.ToString(); entry.ProcessingStatus = StatusEntry.PendingReopen; entry.IDAdhocInvoice = adhocInvItem.AdhocInvoiceId.ToString(); } entry.Save(); } } catch { } } //if (rblPayment.SelectedValue == PaymentType.PayPal) //{ // // get the string of serial numbers // string serials = ""; // EntryList list = EntryList.GetEntryList(adInv.PayGroupId, Guid.Empty, ""); // contains the pay group id // foreach (Entry entry in list) // { // serials += entry.Serial + ","; // } // if (serials != "") serials = serials.Substring(0, serials.Length - 1); // PayPal(serials); //} //else { if (!string.IsNullOrEmpty(Request.QueryString["Page"]) && (entrySelected != null)) { Response.Redirect("EntryProcessing.aspx?Page=Management"); } else if (entrySelected != null) { Response.Redirect("EntryProcessing.aspx"); } else { Response.Redirect("../Admin/AdhocInvoiceList.aspx"); } //Response.Redirect("../Main/PendingPayment.aspx"); } } } } }
protected void btnSubmit_Click(object sender, EventArgs e) { if (ValidateForm()) { AdhocInvoice adInv = SaveForm(); // id admin mode, go back to admin page if (isAdminEdit) { Response.Redirect(GeneralFunction.GetRedirect("../Admin/InvoiceList.aspx")); } //To set to Upload Complete if Payment Method is selected //Administrator admin = Security.GetAdminLoginSession(); AdhocInvoiceItemList adhocInvItemList = AdhocInvoiceItemList.GetAdhocInvoiceItemList(payGroupId, adInv.Id); EntryList entries = EntryList.GetEntryList(Guid.Empty, adInv.RegistrationId, ""); foreach (AdhocInvoiceItem adhocInvItem in adhocInvItemList) { try { //FILTER For REOPEN ENTRY PROCESSING Entry entry = entries.FirstOrDefault(x => x.Id == adhocInvItem.EntryId && ((x.Status == StatusEntry.Completed) && (x.ProcessingStatus == StatusEntry.PendingReopen))); if (adhocInvItem.InvoiceType == "ReOpen") { //To set to Upload Complete if Payment Method is selected if (adInv.Invoice == "" && adInv.PaymentMethod != "") { entry.Status = StatusEntry.UploadCompleted; entry.ReopeningDate = DateTime.Now.ToString(); // entry.ProcessingStatus = StatusEntry.Reopened; // entry.IDAdhocInvoice = adhocInvItem.AdhocInvoiceId.ToString(); // } entry.Save(); } } catch { } } GeneralFunction.CompletePendingPaymentAdhoc(adInv.RegistrationId, adInv.PayGroupId, adInv.PaymentMethod, lbTotalFees.Text, true); if (rblPayment.SelectedValue == PaymentType.PayPal) { // get the string of serial numbers string serials = ""; EntryList list = EntryList.GetEntryList(adInv.PayGroupId, Guid.Empty, ""); // contains the pay group id foreach (Entry entry in list) { serials += entry.Serial + ","; } if (serials != "") { serials = serials.Substring(0, serials.Length - 1); } PayPal(serials); } else { Response.Redirect("../Main/PendingPayment.aspx"); } } }