public static void deleteInvoice(string sInvoiceID) { Invoice invoice = null; Claim claim = null; try { int invoiceID = Convert.ToInt32(Core.SecurityManager.DecryptQueryString(sInvoiceID)); using (TransactionScope scope = new TransactionScope()) { invoice = InvoiceManager.Get(invoiceID); if (invoice != null) { invoice.IsVoid = true; InvoiceManager.Save(invoice); // change claim progress status claim = ClaimsManager.GetByID(invoice.ClaimID); if (claim != null) { claim.ProgressStatusID = (int)Globals.ClaimProgressStatus.ClaimInvoiceRejectedRedo; ClaimsManager.Save(claim); scope.Complete(); } } } } catch (Exception ex) { Core.EmailHelper.emailError(ex); } }
private void batchDeleteInvoices() { Claim claim = null; int invoiceID = 0; Invoice invoice = null; try { using (TransactionScope scope = new TransactionScope()) { foreach (GridViewRow row in gvInvoiceQ.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cbxSelected = row.FindControl("cbxSelected") as CheckBox; if (cbxSelected.Checked) { invoiceID = (int)gvInvoiceQ.DataKeys[row.RowIndex].Values[0]; invoice = InvoiceManager.Get(invoiceID); if (invoice != null) { // make invoice as rejected/void invoice.IsVoid = true; InvoiceManager.Save(invoice); // change claim progress status claim = ClaimsManager.GetByID(invoice.ClaimID); if (claim != null) { claim.ProgressStatusID = (int)Globals.ClaimProgressStatus.ClaimInvoiceRejectedRedo; ClaimsManager.Save(claim); } } } } } // complete transaction scope.Complete(); } lblMessage.Text = "Selected invoices have been rejected."; lblMessage.CssClass = "ok"; } catch (Exception ex) { lblMessage.Text = "Selected invoices were not rejected."; lblMessage.CssClass = "error"; Core.EmailHelper.emailError(ex); } finally { bindData(); } }
protected void btnAssign_Click(object sender, EventArgs e) { int adjusterID = 0; Claim claim = null; int claimID = 0; AdjusterMaster adjuster = null; StringBuilder claimList = new StringBuilder(); if (int.TryParse(ddlAdjuster.SelectedValue, out adjusterID) && adjusterID > 0) { adjuster = AdjusterManager.GetAdjusterId(adjusterID); foreach (GridViewRow row in gvSearchResult.Rows) { if (row.RowType == DataControlRowType.DataRow) { CheckBox cbxSelected = row.FindControl("cbxSelected") as CheckBox; if (cbxSelected.Checked) { claimID = (int)gvSearchResult.DataKeys[row.RowIndex].Value; claim = ClaimsManager.GetByID(claimID); if (claim != null) { claim.AdjusterID = adjusterID; ClaimsManager.Save(claim); HyperLink lnkLead = row.FindControl("hlnkLead") as HyperLink; claimList.Append(string.Format("<tr align=\"center\"><td>{0}</td><td>{1}</td><td>{2}</td></tr>", lnkLead.Text, claim.AdjusterClaimNumber ?? "", claim.InsurerClaimNumber ?? "")); } } } } // foreach notifyAdjuster(adjuster, claimList); btnSearch_Click(null, null); } }