Example #1
0
        protected void gvInvoiceProfile_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            CarrierInvoiceProfile invoiceProfile = null;
            int carrierInvoiceProfileTypeID      = 0;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Label lblProfileTypeDescription = e.Row.FindControl("lblProfileTypeDescription") as Label;

                if (e.Row.DataItem != null)
                {
                    invoiceProfile = e.Row.DataItem as CarrierInvoiceProfile;

                    if (invoiceProfile.CarrierInvoiceProfileTypeID != null)
                    {
                        carrierInvoiceProfileTypeID = invoiceProfile.CarrierInvoiceProfileTypeID ?? 0;
                        try {
                            lblProfileTypeDescription.Text = carrierInvoiceProfileTypes[carrierInvoiceProfileTypeID];
                        }
                        catch (Exception ex) {
                            Core.EmailHelper.emailError(ex);
                        }
                    }
                }
            }
        }
Example #2
0
        private void copyCarrierInvoiceProfiles(List <CarrierInvoiceProfile> profiles, int cloneCarrierID)
        {
            int carrierInvoiceProfileID = 0;

            foreach (CarrierInvoiceProfile profile in profiles)
            {
                CarrierInvoiceProfile copyProfile = new CarrierInvoiceProfile();

                copyProfile.CarrierID = cloneCarrierID;

                //copyProfile.CarrierInvoiceProfileID = profile.CarrierInvoiceProfileID;
                copyProfile.CarrierInvoiceProfileTypeID = profile.CarrierInvoiceProfileTypeID;
                copyProfile.CoverageArea   = profile.CoverageArea;
                copyProfile.EffiectiveDate = profile.EffiectiveDate;
                copyProfile.ExpirationDate = profile.ExpirationDate;
                copyProfile.IsActive       = true;
                copyProfile.ProfileName    = profile.ProfileName;

                copyProfile = CarrierInvoiceProfileManager.Save(copyProfile);

                carrierInvoiceProfileID = copyProfile.CarrierInvoiceProfileID;

                copyProfileItemizedItems(profile.CarrierInvoiceProfileFeeItemized.ToList(), carrierInvoiceProfileID);

                copyProfileFeeProvision(profile.CarrierInvoiceProfileFeeProvision.ToList(), carrierInvoiceProfileID);

                copyProfileFeeSchedule(profile.CarrierInvoiceProfileFeeSchedule.ToList(), carrierInvoiceProfileID);
            }
        }
Example #3
0
        static public CarrierInvoiceProfile Get(int id)
        {
            CarrierInvoiceProfile profile = null;

            profile = (from x in DbContextHelper.DbContext.CarrierInvoiceProfile
                       .Include("CarrierInvoiceType")
                       where x.CarrierInvoiceProfileID == id
                       select x).FirstOrDefault <CarrierInvoiceProfile>();

            return(profile);
        }
Example #4
0
        public static CarrierInvoiceProfile Save(CarrierInvoiceProfile profile)
        {
            if (profile.CarrierInvoiceProfileID == 0)
            {
                DbContextHelper.DbContext.Add(profile);
            }


            DbContextHelper.DbContext.SaveChanges();

            return(profile);
        }
Example #5
0
        static public CarrierInvoiceProfile GetProfileForInvoicing(int id)
        {
            CarrierInvoiceProfile profile = null;

            profile = (from x in DbContextHelper.DbContext.CarrierInvoiceProfile
                       .Include("CarrierInvoiceProfileFeeSchedule")
                       .Include("CarrierInvoiceProfileFeeItemized.InvoiceServiceType")
                       .Include("CarrierInvoiceProfileFeeItemized.ExpenseType")
                       where  x.CarrierInvoiceProfileID == id
                       select x).FirstOrDefault <CarrierInvoiceProfile>();

            return(profile);
        }
Example #6
0
        /// <summary>
        /// Returns full object
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        static public CarrierInvoiceProfile GetProfileForInvoicing(int id, int?ClaimDesignationID)
        {
            CarrierInvoiceProfile profile = null;

            profile = (from x in DbContextHelper.DbContext.CarrierInvoiceProfile
                       .Include("CarrierInvoiceProfileFeeItemized")
                       //.Include("CarrierInvoiceProfileFeeProvisions")
                       .Include("CarrierInvoiceProfileFeeSchedule")
                       where x.CarrierInvoiceProfileID == id &&
                       x.CarrierInvoiceProfileTypeID == ClaimDesignationID
                       select x).FirstOrDefault <CarrierInvoiceProfile>();

            return(profile);
        }
Example #7
0
        public static CarrierInvoiceProfile GetInvoiceProfile(int carrierID, int invoiceProfileTypeID)
        {
            CarrierInvoiceProfile invoiceProfile = null;

            invoiceProfile = (from x in DbContextHelper.DbContext.CarrierInvoiceProfile
                              .Include("CarrierInvoiceProfileFeeItemized")
                              .Include("CarrierInvoiceProfileFeeProvision")
                              .Include("CarrierInvoiceProfileFeeSchedule")
                              where        x.CarrierID == carrierID &&
                              x.CarrierInvoiceProfileTypeID == invoiceProfileTypeID &&
                              x.IsActive == true
                              select x
                              ).FirstOrDefault();

            return(invoiceProfile);
        }
Example #8
0
        //chetu com
        public void CopyProfile(int profileID)
        {
            //int profileID = 0;
            CarrierInvoiceProfile profile    = null;
            CarrierInvoiceProfile profileold = null;

            profileold = CarrierInvoiceProfileManager.Get(profileID);
            profile    = new CarrierInvoiceProfile();

            profile.CarrierID = carrierID;

            profile.IsActive = true;
            if (profile != null)
            {
                profile.ProfileName = profileold.ProfileName;


                profile.CarrierInvoiceProfileTypeID = profileold.CarrierInvoiceProfileTypeID;
                profile.EffiectiveDate         = profileold.EffiectiveDate;
                profile.ExpirationDate         = profileold.ExpirationDate;
                profile.InvoiceType            = profileold.InvoiceType;
                profile.AccountingContact      = profileold.AccountingContact;
                profile.AccountingContactEmail = profileold.AccountingContactEmail;
                profile.FirmDiscountPercentage = profileold.FirmDiscountPercentage;
                profile.FlatCatFee             = profileold.FlatCatFee;
                profile.FlatCatPercent         = profileold.FlatCatPercent;
                try
                {
                    CarrierInvoiceProfileManager.Save(profile);

                    showInvoiceProfiles();

                    bindInvoiceProfiles();
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
        //chetu com
        public void CopyProfile(int profileID)
        {
            //int profileID = 0;
            CarrierInvoiceProfile profile = null;
            CarrierInvoiceProfile profileold = null;
            profileold = CarrierInvoiceProfileManager.Get(profileID);
              profile = new CarrierInvoiceProfile();

              profile.CarrierID = carrierID;

              profile.IsActive = true;
            if (profile != null)
            {
                profile.ProfileName = profileold.ProfileName;

               profile.CarrierInvoiceProfileTypeID = profileold.CarrierInvoiceProfileTypeID;
               profile.EffiectiveDate = profileold.EffiectiveDate;
               profile.ExpirationDate = profileold.ExpirationDate;
               profile.InvoiceType = profileold.InvoiceType;
               profile.AccountingContact = profileold.AccountingContact;
               profile.AccountingContactEmail = profileold.AccountingContactEmail;
               profile.FirmDiscountPercentage = profileold.FirmDiscountPercentage;
               profile.FlatCatFee = profileold.FlatCatFee;
               profile.FlatCatPercent = profileold.FlatCatPercent;
                try
                {
                    CarrierInvoiceProfileManager.Save(profile);

                    showInvoiceProfiles();

                    bindInvoiceProfiles();
                }
                catch (Exception ex)
                {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Example #10
0
        private decimal getClaimAmount(CarrierInvoiceProfile invoiceProfile)
        {
            decimal premiumAmount = 0;

            switch (invoiceProfile.InvoiceType ?? 0) {
                case (int)Globals.InvoiceType.NetClaimPayable:
                    premiumAmount = txtNetClaimPayable.ValueDecimal;
                    break;

                case (int)Globals.InvoiceType.GrossClaimPayable:
                    premiumAmount = txtGrossLossPayable.ValueDecimal;
                    break;

                default:
                    break;
            }

            return premiumAmount;
        }
        //EMAIL CLIENT CONTACT
        private void notifyClientContact(CarrierInvoiceProfile CarrierInvoice, ClaimService service, Claim myClaim, AdjusterMaster adjuster)
        {
            StringBuilder emailBody = new StringBuilder();
            string password = null;
            string[] recipients = null;
            string smtpHost = null;
            int smtpPort = 0;
            string siteUrl = ConfigurationManager.AppSettings["siteUrl"].ToString();
            string insuredName = Session["InsuredName"].ToString();
            string subject = "Claim # " + myClaim.InsurerClaimNumber + ", Please Read Claim Note, Claim Ruler Note for : " + insuredName;
            CRM.Data.Entities.SecUser user = null;

            string itsgHost = ConfigurationManager.AppSettings["smtpHost"].ToString();
            string itsgHostPort = ConfigurationManager.AppSettings["smtpPort"].ToString();
            string itsgEmail = ConfigurationManager.AppSettings["smtpEmail"].ToString();
            string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString();

            string EmailService = ddlInvoiceServiceType.SelectedItem.Text;
            string EmailActivity = ddlActivity.SelectedItem.Text;
            string EmailDescription = txtServiceDescription.Text;
            string EmailInternal = txtMyComments.Text;
            string EmailQuantity = txtServiceQty.Text;
            string EmailDate = txtServiceDate.Text;

            string userName = SessionHelper.getUserName();

            int.TryParse(itsgHostPort, out smtpPort);

            // get logged in user
            int userID = SessionHelper.getUserId();
            //Convert.ToInt32(itsgHostPort);
            // get current user email info
            user = SecUserManager.GetByUserId(userID);

            // load email credentials
            smtpHost = user.emailHost;
            int.TryParse(user.emailHostPort, out smtpPort);

            // recipients
            recipients = new string[] { CarrierInvoice.AccountingContactEmail };

            // build email body
            // .containerBox
            emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">");

            // .header
            //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>");
            //emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>");

            // .paneContentInner
            emailBody.Append("<div style=\"margin: 20px;\">");
            emailBody.Append("Hi " + CarrierInvoice.AccountingContact + ",<br><br>");
            emailBody.Append("The following activity was just logged on Claim # " + myClaim.InsurerClaimNumber + " for Insured: " + insuredName + "<br><br><br>");

            emailBody.Append("<table >");
            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Service:</b></td><td align=\"left\"> " + EmailService + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr>");
            emailBody.Append("<td align=\"left\"><b>Activity:</b></td><td align=\"left\"> " + EmailActivity + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Description:</b></td><td align=\"left\"> " + EmailDescription + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Internal Comments:</b></td><td align=\"left\"> " + EmailInternal + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr></tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Adjuster:</b></td><td align=\"left\"> " + adjuster.adjusterName + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>User Name:</b></td><td align=\"left\"> " + userName + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Service Date:</b></td><td align=\"left\"> " + EmailDate + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Timer Quantity:</b></td><td align=\"left\"> " + EmailQuantity + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("</table ><br><br>");

            emailBody.Append("</div>");	// inner containerBox
            emailBody.Append("</div>");	// paneContentInner
            emailBody.Append("</div>");	// containerBox

            //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true);
            password = Core.SecurityManager.Decrypt(user.emailPassword);

            //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true);
            Core.EmailHelper.sendEmail(itsgEmail, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword);
        }
        protected void btnProfileSave_Click(object sender, EventArgs e)
        {
            int profileID = 0;
            CarrierInvoiceProfile profile = null;

            Page.Validate("Profile");
            if (!Page.IsValid)
                return;

            int.TryParse(ViewState["CarrierInvoiceProfileID"].ToString(), out profileID);

            try {
                if (profileID == 0) {
                    // new profile
                    profile = new CarrierInvoiceProfile();

                    profile.CarrierID = carrierID;

                    profile.IsActive = true;
                }
                else
                    profile = CarrierInvoiceProfileManager.Get(profileID);
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }

            if (profile != null) {

                profile.CarrierID = carrierID;

                profile.ProfileName = txtProgramName.Text;

                if (ucProfileType.SelectedIndex > 0)
                    profile.CarrierInvoiceProfileTypeID = Convert.ToInt32(ucProfileType.SelectedValue);

                if (!string.IsNullOrEmpty(effetiveDate.Text))
                    profile.EffiectiveDate = effetiveDate.Date;
                else
                    profile.EffiectiveDate = null;

                if (!string.IsNullOrEmpty(expirationDate.Text))
                    profile.ExpirationDate = expirationDate.Date;
                else
                    profile.ExpirationDate = null;

                //profile.CoverageArea = CollectionManager.GetSelectedItemsID(cbxCoverageArea);

                profile.InvoiceType = Convert.ToInt32(ddlInvoiceType.SelectedValue);

                profile.AccountingContact = txtAccoutingContact.Text;

                profile.AccountingContactEmail = txtAccoutingContactEmail.Text;

                profile.FirmDiscountPercentage = txtFirmDiscountPercentage.ValueDecimal;

               // profile.FlatCatPercent = txtFlatCatPercent.ValueDecimal;//NEW OC

               // profile.FlatCatFee = txtFlatCatFee.ValueDecimal; // NEW OC

                try {
                    CarrierInvoiceProfileManager.Save(profile);

                    showInvoiceProfiles();

                    bindInvoiceProfiles();
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Example #13
0
        // generate invoices
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            Carrier carrier = null;
            CarrierInvoiceProfile profile = null;

            Invoice invoice       = null;
            int     carrierID     = Convert.ToInt32(ddlCarrier.SelectedValue);
            decimal invoiceAmount = 0;
            int     policyID      = 0;

            int profileID = Convert.ToInt32(this.ddlInvoiceProfile.SelectedValue);

            if (carrierID == 0 || profileID == 0)
            {
                return;
            }

            try {
                profile = CarrierInvoiceProfileManager.Get(profileID);

                carrier = CarrierManager.Get(carrierID);
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                showErrorMessage();

                return;
            }

            try {
                using (TransactionScope scope = new TransactionScope()) {
                    foreach (GridViewRow row in gvCarrierPolicy.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox cbxSelect = row.FindControl("cbxSelect") as CheckBox;

                            if (cbxSelect.Checked)
                            {
                                invoice = new Invoice();
                                //invoice.ClientID = clientID;
                                //invoice.CarrierID = carrierID;
                                invoice.InvoiceDate = DateTime.Now;

                                invoice.InvoiceTypeID = profile.InvoiceType;

                                invoice.CarrierInvoiceProfileID = profileID;

                                invoice.IsVoid = false;

                                invoice.BillToAddress1 = carrier.AddressLine1;
                                invoice.BillToAddress2 = carrier.AddressLine2;
                                invoice.BillToAddress3 = string.Empty;
                                invoice.BillToName     = carrier.CarrierName;

                                policyID = (int)gvCarrierPolicy.DataKeys[row.RowIndex].Values[0];

                                //invoice.PolicyID = policyID;

                                //invoice.LeadId = (int)gvCarrierPolicy.DataKeys[row.RowIndex].Values[1];

                                //invoice.PolicyTypeID = (int)gvCarrierPolicy.DataKeys[row.RowIndex].Values[2];

                                Label lblInvoiceAmount = row.FindControl("lblInvoiceAmount") as Label;

                                decimal.TryParse(lblInvoiceAmount.Text, out invoiceAmount);

                                invoice.TotalAmount = invoiceAmount;

                                invoice.InvoiceNumber = InvoiceManager.GetNextInvoiceNumber(clientID);

                                int invoiceID = InvoiceManager.Save(invoice);

                                InvoiceDetail invoiceDetail = new InvoiceDetail();
                                invoiceDetail.InvoiceID       = invoiceID;
                                invoiceDetail.isBillable      = true;
                                invoiceDetail.Qty             = 1;
                                invoiceDetail.Rate            = invoiceAmount;
                                invoiceDetail.LineAmount      = invoiceAmount;
                                invoiceDetail.LineDate        = DateTime.Now;
                                invoiceDetail.LineDescription = "As per contract";

                                InvoiceDetailManager.Save(invoiceDetail);

                                // flag policy as invoiced
                                CRM.Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(policyID);

                                if (policy != null)
                                {
                                    policy.IsInvoiced = true;

                                    LeadPolicyManager.Save(policy);
                                }
                            }
                        }
                    }                     // foreach

                    // complete transaction
                    scope.Complete();

                    lblMessage.Text     = "Invoice(s) have been generated.";
                    lblMessage.CssClass = "ok";
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                showErrorMessage();
            }
            finally {
                // refresh those policies to be invoiced
                bindPoliciesReadyForInvoice();
            }
        }
        protected void btnSaveExpense_Click(object sender, EventArgs e)
        {
            Claim                 claim          = null;
            Claim                 myClaim        = null;
            ClaimExpense          claimExpense   = null;
            AdjusterMaster        adjuster       = null;
            CarrierInvoiceProfile CarrierInvoice = null;

            int clientID      = SessionHelper.getClientId();
            int userID        = SessionHelper.getUserId();
            int claimID       = SessionHelper.getClaimID();
            int myAdjusterID  = 0;
            int profileID     = 0;
            int expenseTypeID = 0;
            int id            = 0;


            Page.Validate("expense");
            if (!Page.IsValid)
            {
                return;
            }

            id = Convert.ToInt32(ViewState["ClaimExpenseID"]);

            ClaimManager cm = new ClaimManager();

            myClaim = cm.Get(claimID);

            try
            {
                expenseTypeID = Convert.ToInt32(ddlExpenseType.SelectedValue);

                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimExpenseManager repository = new ClaimExpenseManager())
                    {
                        if (id == 0)
                        {
                            claimExpense         = new ClaimExpense();
                            claimExpense.ClaimID = claimID;
                        }
                        else
                        {
                            claimExpense = repository.Get(id);
                        }

                        // populate fields
                        if (txtExpenseAmount.Visible == false)
                        {
                            var x = Session["multiplier"].ToString();

                            double expenseAmount = Convert.ToDouble(x) * Convert.ToDouble(txtExpenseQty.ValueDecimal); //newOC 10/7/14
                            claimExpense.ExpenseAmount = Convert.ToDecimal(expenseAmount);

                            decimal d = Convert.ToDecimal(expenseAmount);
                            //Session["EmailAmount"] = "$" + Math.Round(d, 2);
                            Session["EmailAmount"] = String.Format("{0:0.00}", expenseAmount);
                            // Session["EmailAmount"] = expenseAmount;
                        }
                        else
                        {
                            claimExpense.ExpenseAmount = txtExpenseAmount.ValueDecimal;
                        }
                        claimExpense.ExpenseDate        = txtExpenseDate.Date;
                        claimExpense.ExpenseDescription = txtExpenseDescription.Text.Trim();
                        claimExpense.ExpenseTypeID      = expenseTypeID;
                        claimExpense.IsReimbursable     = cbxExpenseReimburse.Checked;
                        claimExpense.UserID             = userID;
                        claimExpense.AdjusterID         = Convert.ToInt32(hf_expenseAdjusterID.Value);
                        claimExpense.ExpenseQty         = txtExpenseQty.ValueDecimal;
                        claimExpense.InternalComments   = txtMyComments.Text.Trim();
                        claimExpense.Billed             = false;
                        // claimExpense.IsBillable = cbIsBillable.Checked;
                        // save expense
                        claimExpense = repository.Save(claimExpense);
                    }

                    // update diary entry
                    ClaimComment diary = new ClaimComment();
                    diary.ClaimID     = claimID;
                    diary.CommentDate = DateTime.Now;
                    diary.UserId      = userID;
                    diary.CommentText = string.Format("Expense: {0}, Description: {1}, Date: {2:MM/dd/yyyy}, Amount: {3:N2}, Adjuster: {4} Qty: {5:N2}",
                                                      ddlExpenseType.SelectedItem.Text,
                                                      claimExpense.ExpenseDescription,
                                                      claimExpense.ExpenseDate,
                                                      claimExpense.ExpenseAmount,
                                                      txtExpenseAdjuster.Text,
                                                      claimExpense.ExpenseQty
                                                      );
                    ClaimCommentManager.Save(diary);

                    // 2014-05-02 apply rule
                    using (SpecificExpenseTypePerCarrier ruleEngine = new SpecificExpenseTypePerCarrier())
                    {
                        claim         = new Claim();
                        claim.ClaimID = claimID;
                        RuleException ruleException = ruleEngine.TestRule(clientID, claim, expenseTypeID);

                        if (ruleException != null)
                        {
                            ruleException.UserID = Core.SessionHelper.getUserId();
                            ruleEngine.AddException(ruleException);
                            CheckSendMail(ruleException);
                        }
                    }
                    myAdjusterID = Convert.ToInt32(claimExpense.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID);
                    //EMAIL ADJUSTER OC 10/22/2014
                    if (myAdjusterID != 0 || myAdjusterID != null)
                    {
                        adjuster = AdjusterManager.GetAdjusterId(myAdjusterID);
                    }
                    if (cbEmailAdjuster.Checked == true)
                    {
                        try
                        {
                            notifyAdjuster(adjuster, claimExpense, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL CLIENT CONTACT OC 10/22/2014
                    if (cbEmailClient.Checked == true)              //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already
                    {
                        if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen
                        {
                            profileID = Convert.ToInt32(Session["CarrierInvoiceID"]);
                        }
                        else//coming from claim detail page
                        {
                            profileID = Convert.ToInt32(Session["InvoiceProfileID"]);
                        }
                        CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID);
                        try
                        {
                            notifyClientContact(CarrierInvoice, claimExpense, myClaim, adjuster);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to client contact";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL TO WHOMEVER OC 10/22/2014
                    if (txtEmailTo.Text != "")
                    {
                        try
                        {
                            notifySpecifiedUser(adjuster, claimExpense, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }

                    // complete transaction
                    scope.Complete();
                }

                lblMessage.Text     = "Expense saved successfully.";
                lblMessage.CssClass = "ok";

                // refresh grid
                gvExpense.DataSource = loadExpenses(claimID);
                gvExpense.DataBind();

                // keep edit form active
                lbtnNewExpense_Click(null, null);
                lblAmount.Text           = "";
                lblAmount.Visible        = false;
                txtExpenseAmount.Visible = true;
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);

                lblMessage.Text     = "Unable to save claim expense.";
                lblMessage.CssClass = "error";
            }
        }
Example #15
0
        protected void btnProfileSave_Click(object sender, EventArgs e)
        {
            int profileID = 0;
            CarrierInvoiceProfile profile = null;

            Page.Validate("Profile");
            if (!Page.IsValid)
            {
                return;
            }

            int.TryParse(ViewState["CarrierInvoiceProfileID"].ToString(), out profileID);

            try {
                if (profileID == 0)
                {
                    // new profile
                    profile = new CarrierInvoiceProfile();

                    profile.CarrierID = carrierID;

                    profile.IsActive = true;
                }
                else
                {
                    profile = CarrierInvoiceProfileManager.Get(profileID);
                }
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }

            if (profile != null)
            {
                profile.CarrierID = carrierID;

                profile.ProfileName = txtProgramName.Text;

                if (ucProfileType.SelectedIndex > 0)
                {
                    profile.CarrierInvoiceProfileTypeID = Convert.ToInt32(ucProfileType.SelectedValue);
                }

                if (!string.IsNullOrEmpty(effetiveDate.Text))
                {
                    profile.EffiectiveDate = effetiveDate.Date;
                }
                else
                {
                    profile.EffiectiveDate = null;
                }

                if (!string.IsNullOrEmpty(expirationDate.Text))
                {
                    profile.ExpirationDate = expirationDate.Date;
                }
                else
                {
                    profile.ExpirationDate = null;
                }

                //profile.CoverageArea = CollectionManager.GetSelectedItemsID(cbxCoverageArea);

                profile.InvoiceType = Convert.ToInt32(ddlInvoiceType.SelectedValue);

                profile.AccountingContact = txtAccoutingContact.Text;

                profile.AccountingContactEmail = txtAccoutingContactEmail.Text;

                profile.FirmDiscountPercentage = txtFirmDiscountPercentage.ValueDecimal;

                // profile.FlatCatPercent = txtFlatCatPercent.ValueDecimal;//NEW OC

                // profile.FlatCatFee = txtFlatCatFee.ValueDecimal; // NEW OC

                try {
                    CarrierInvoiceProfileManager.Save(profile);

                    showInvoiceProfiles();

                    bindInvoiceProfiles();
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
        }
Example #16
0
        protected void gvInvoiceProfile_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int profileID = Convert.ToInt32(e.CommandArgument);
            CarrierInvoiceProfile profile = null;

            if (e.CommandName == "DoEdit")
            {
                ViewState["CarrierInvoiceProfileID"] = profileID.ToString();

                profile = CarrierInvoiceProfileManager.Get(profileID);

                if (profile != null)
                {
                    // enable edit panel
                    showInvoiceProfilePanel();

                    bindInvoiceType();

                    txtProgramName.Text = profile.ProfileName;

                    effetiveDate.Text = profile.EffiectiveDate == null ? "" : profile.EffiectiveDate.ToString();

                    expirationDate.Text = profile.ExpirationDate == null ? "" : profile.ExpirationDate.ToString();

                    ddlInvoiceType.SelectedValue = string.Format("{0}", profile.InvoiceType ?? 1);

                    // 2014-04-21
                    //CollectionManager.SetSelectedItems(cbxCoverageArea, profile.CoverageArea);

                    txtAccoutingContact.Text = profile.AccountingContact;

                    txtAccoutingContactEmail.Text = profile.AccountingContactEmail;

                    txtFirmDiscountPercentage.Value = profile.FirmDiscountPercentage;

                    //txtFlatCatPercent.Value = profile.FlatCatPercent;//new oc
                    // txtFlatCatFee.Value = profile.FlatCatFee;//new oc
                    tabContainerFee.Visible = true;

                    if (profile.CarrierInvoiceProfileTypeID != null)
                    {
                        ucProfileType.SelectedValue = profile.CarrierInvoiceProfileTypeID.ToString();
                    }

                    ucFeeSchedule.bindFeeSchedule(profileID);

                    // 2014-04-21
                    //ucFeeProvision.bindProvisions(profileID);

                    ucFeeItemized.bindItems(profileID);
                }
            }

            if (e.CommandName == "DoDelete")
            {
                try {
                    profile = CarrierInvoiceProfileManager.Get(profileID);
                    if (profile != null)
                    {
                        profile.IsActive = false;

                        CarrierInvoiceProfileManager.Save(profile);

                        showInvoiceProfiles();

                        bindInvoiceProfiles();
                    }
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
            }
            if (e.CommandName == "DoCopy")
            {
                CopyProfile(profileID);
            }
        }
Example #17
0
        private void processClaimServices(int claimID, CarrierInvoiceProfile invoiceProfile, int invoiceID)
        {
            CarrierInvoiceProfileFeeItemized profileTEFee = null;
            List<ClaimService> claimServices = null;
            decimal lineTotal = 0;
            decimal quantity = 0;
            decimal rateAmount = 0;
            string serviceDescription = null;
            string serviceComments = null;
            string activity = null;
            string activityDescription = null;
            bool isBillable = true;
            bool billed = true;
            InvoiceServiceType invoiceServiceType = null;

            // get TE services for claim entered by adjuster
            using (ClaimServiceManager repositiory = new ClaimServiceManager())
            {
                claimServices = repositiory.GetAllForInvoice(claimID);
            }

            if (claimServices != null && claimServices.Count > 0)
            {

                foreach (ClaimService claimService in claimServices)
                {

                    profileTEFee = (from x in invoiceProfile.CarrierInvoiceProfileFeeItemized
                                 where x.ServiceTypeID == claimService.ServiceTypeID
                                 select x
                                 ).FirstOrDefault();
                    int claimServiceID = claimService.ClaimServiceID;
                    quantity = (claimService.ServiceQty ?? 0);
                    serviceDescription = claimService.InvoiceServiceType == null ? string.Empty : claimService.InvoiceServiceType.ServiceDescription;
                    invoiceServiceType = claimService.InvoiceServiceType;
                    activity = claimService.Activity == null ? string.Empty : claimService.Activity;
                    activityDescription = claimService.ServiceDescription;
                    isBillable = claimService.IsBillable.Value;
                    billed = claimService.Billed.Value;
                    if (profileTEFee != null)
                    {
                        // use override from invoice profile
                        if (profileTEFee.ItemRate > 0)
                        {
                            serviceComments = profileTEFee.ItemDescription;
                            rateAmount = profileTEFee.ItemRate;

                            lineTotal = rateAmount * quantity;
                            if (isBillable == true)
                            {
                                insertDetailLine(invoiceID, serviceDescription, activity, activityDescription, lineTotal, quantity, rateAmount, claimService.ServiceDate, serviceComments);
                                using (ClaimServiceManager myRepository = new ClaimServiceManager())
                                {
                                    ClaimService myClaimService = myRepository.Get(claimServiceID);
                                    myClaimService.Billed = true;
                                    myRepository.Save(myClaimService);
                                }

                            }
                        }
                        else if (profileTEFee.ItemPercentage > 0)
                        {
                        }
                    }
                    else
                    {
                        if ((invoiceServiceType.ServiceRate ?? 0) > 0)
                        {
                            rateAmount = invoiceServiceType.ServiceRate ?? 0;
                            quantity = claimService.ServiceQty ?? 0;
                            lineTotal = rateAmount * quantity;
                        }
                        else if ((invoiceServiceType.ServicePercentage ?? 0) > 0)
                        {
                        }
                        if (isBillable == true )
                        {
                            insertDetailLine(invoiceID, serviceDescription, activity, activityDescription, lineTotal, quantity, rateAmount, claimService.ServiceDate, serviceComments);
                            using (ClaimServiceManager myRepository = new ClaimServiceManager())
                            {
                                ClaimService myClaimService = myRepository.Get(claimServiceID);
                                myClaimService.Billed = true;
                                myRepository.Save(myClaimService);
                            }
                        }

                    }
                }
            }
        }
Example #18
0
        private void processFirmDiscount(CarrierInvoiceProfile invoiceProfile, int invoiceID)
        {
            decimal discountRate = 0;
            decimal discountAmount = 0;
            decimal invoiceTotalAmount = 0;
            string serviceDescription = null;
            decimal percentage = 0;
            string activity = null;
            string activityDescription = null;

            discountRate = invoiceProfile.FirmDiscountPercentage ?? 0;

            if (discountRate > 0) {

                invoiceTotalAmount = InvoiceManager.calculateInvoiceTotal(invoiceID);

                discountAmount = (invoiceTotalAmount * discountRate) * -1;
                percentage = discountRate * 100;
                serviceDescription = string.Format("Firm Discount Percentage", percentage);

                insertDetailLine(invoiceID, serviceDescription, activity,activityDescription, discountAmount, 1, percentage);
            }
        }
Example #19
0
        private void processCarrierInvoiceProfileTimeExpense(int claimID, CarrierInvoiceProfile invoiceProfile, int invoiceID, decimal premiumAmount)
        {
            if (invoiceProfile != null && invoiceProfile.CarrierInvoiceProfileFeeItemized != null && invoiceProfile.CarrierInvoiceProfileFeeItemized.Count > 0) {

                processClaimServices(claimID, invoiceProfile, invoiceID);

                processClaimExpenses(claimID, invoiceProfile, invoiceID);

                //foreach (CarrierInvoiceProfileFeeItemized itemizedFee in invoiceProfile.CarrierInvoiceProfileFeeItemizeds) {

                //	if (itemizedFee.ItemRate > 0) {
                //		feeAmount = itemizedFee.ItemRate;
                //		insertDetailLine(invoiceID, itemizedFee.ItemDescription, feeAmount, 1, itemizedFee.ItemRate);
                //	}
                //	else if (itemizedFee.ItemPercentage > 0) {
                //		feeAmount = premiumAmount * itemizedFee.ItemRate;
                //		insertDetailLine(invoiceID, itemizedFee.ItemDescription, feeAmount, premiumAmount, feeAmount);
                //	}
                //}
            }
        }
Example #20
0
        private void processClaimExpenses(int claimID, CarrierInvoiceProfile invoiceProfile, int invoiceID)
        {
            CarrierInvoiceProfileFeeItemized profileTEFee = null;
            List<ClaimExpense> claimExpenses = null;
            decimal lineTotal = 0;
            decimal quantity = 0;
            decimal operand = 0;
            decimal expenseAmount = 0;
            decimal rateAmount = 0;
            string serviceDescription = null;
            string serviceComments = null;
            bool billed = true;
            // get TE services for claim entered by adjuster
            using (ClaimExpenseManager repositiory = new ClaimExpenseManager())
            {
                claimExpenses = repositiory.GetExpenseForInvoice(claimID);
            }

            if (claimExpenses != null && claimExpenses.Count > 0)
            {
                foreach (ClaimExpense claimExpense in claimExpenses)
                {
                    rateAmount = 0;
                    int claimExpenseID = claimExpense.ClaimExpenseID;
                    profileTEFee = (from x in invoiceProfile.CarrierInvoiceProfileFeeItemized
                                 where x.ExpenseTypeID == claimExpense.ExpenseTypeID
                                 select x
                                 ).FirstOrDefault();

                    if (profileTEFee != null)
                    {
                        // use override from invoice profile
                        serviceDescription = claimExpense.ExpenseType.ExpenseName;// profileTEFee.ExpenseType == null ? string.Empty : profileTEFee.ExpenseType.ExpenseDescription;
                        serviceComments = claimExpense.ExpenseDescription; // profileTEFee.ItemDescription;
                        operand = profileTEFee.LogicalOperatorOperand ?? 0;
                        billed = claimExpense.Billed.Value;
                        rateAmount = profileTEFee.ItemRate; //claimExpense.ExpenseAmount;
                        quantity = Convert.ToDecimal(claimExpense.ExpenseQty);
                        Session["ExpAmount"] = claimExpense.ExpenseAmount;
                        if ((profileTEFee.LogicalOperator ?? 0) > 0 && operand > 0)
                        {
                            quantity = claimExpense.ExpenseQty ?? 0;
                            expenseAmount = claimExpense.ExpenseAmount;

                            switch (profileTEFee.LogicalOperator)
                            {
                                case 1:		// =
                                    //if (expenseAmount > 0 && expenseAmount == operand) {
                                    //	rateAmount = profileTEFee.ItemRate;
                                    //	expenseAmount = quantity * rateAmount;
                                    //}
                                    //else if (quantity > 0 && quantity == operand) {
                                    //	rateAmount = profileTEFee.ItemRate;
                                    //	expenseAmount = quantity * rateAmount;
                                    //}
                                    break;

                                case 2:		// <
                                case 3:		// <=
                                    if (expenseAmount > 0 && expenseAmount <= operand)
                                    {
                                        quantity = 1;
                                        rateAmount = profileTEFee.ItemRate;
                                    }
                                    else if (quantity > 0 && quantity <= operand) {
                                        rateAmount = profileTEFee.ItemRate; //;
                                    }
                                    break;

                                case 4:		// >
                                case 5:		// >=
                                    if (expenseAmount > 0 && expenseAmount >= operand)
                                    {
                                        quantity = 1;
                                        rateAmount = operand;
                                    }
                                    else if (quantity > 0 && quantity >= operand)
                                    {
                                        quantity = quantity - operand;
                                        rateAmount = profileTEFee.ItemRate;
                                    }
                                    break;

                                default:
                                    quantity = 1;
                                    rateAmount = profileTEFee.ItemRate; //claimExpense.ExpenseAmount;
                                    break;
                            }
                            if (billed == false)
                            {
                                insertDetailLine(invoiceID, serviceDescription, quantity, rateAmount, claimExpense.ExpenseDate, serviceComments);
                                using (ClaimExpenseManager myRepositiory = new ClaimExpenseManager())
                                {
                                    ClaimExpense myClaimExpense = myRepositiory.Get(claimExpenseID);
                                    myClaimExpense.Billed = true;
                                    myRepositiory.Save(myClaimExpense);
                                }
                            }

                        }
                        else if (profileTEFee.ItemRate > 0)
                        {
                            // no condition specified
                            quantity = claimExpense.ExpenseQty ?? 1;

                            rateAmount = profileTEFee.ItemRate;

                            lineTotal = expenseAmount;
                            if (billed == false)
                            {
                                insertDetailLine(invoiceID, serviceDescription, quantity, rateAmount, claimExpense.ExpenseDate, serviceComments);
                                using (ClaimExpenseManager myRepositiory = new ClaimExpenseManager())
                                {
                                    ClaimExpense myClaimExpense = myRepositiory.Get(claimExpenseID);
                                    myClaimExpense.Billed = true;
                                    myRepositiory.Save(myClaimExpense);
                                }
                            }

                        }
                        else if (profileTEFee.ItemPercentage > 0)
                        {
                        }
                    }
                    else
                    {
                        // no override found
                        serviceDescription = claimExpense.ExpenseType.ExpenseDescription;

                        serviceComments = claimExpense.ExpenseDescription;

                        quantity = claimExpense.ExpenseQty ?? 1;

                        rateAmount = claimExpense.ExpenseAmount;
                        if (billed == false)
                        {
                            insertDetailLine(invoiceID, serviceDescription, quantity, rateAmount,  claimExpense.ExpenseDate, serviceComments);
                            using (ClaimExpenseManager myRepositiory = new ClaimExpenseManager())
                            {
                                ClaimExpense myClaimExpense = myRepositiory.Get(claimExpenseID);
                                myClaimExpense.Billed = true;
                                myRepositiory.Save(myClaimExpense);
                            }
                        }

                    }
                }
            }
        }
Example #21
0
 private void processCarrierInvoiceProfileFeeProvisions(CarrierInvoiceProfile invoiceProfile, int invoiceID)
 {
     if (invoiceProfile != null && invoiceProfile.CarrierInvoiceProfileFeeProvision != null && invoiceProfile.CarrierInvoiceProfileFeeProvision.Count > 0) {
         foreach (CarrierInvoiceProfileFeeProvision feePrivision in invoiceProfile.CarrierInvoiceProfileFeeProvision) {
             //insertDetailLine(invoiceID, feePrivision.ProvisionText, feePrivision.ProvisionAmount, 1, feePrivision.ProvisionAmount);
         }
     }
 }
Example #22
0
        protected void btnSaveClaimService_Click(object sender, EventArgs e)
        {
            ClaimService          claimService   = null;
            ClaimComment          diary          = null;
            AdjusterMaster        adjuster       = null;
            Claim                 myClaim        = null;
            CarrierInvoiceProfile CarrierInvoice = null;

            int userID       = SessionHelper.getUserId();
            int claimID      = SessionHelper.getClaimID();
            int id           = 0;
            int myAdjusterID = 0;
            int profileID    = 0;

            Page.Validate("service");
            if (!Page.IsValid)
            {
                return;
            }

            id = Convert.ToInt32(ViewState["ClaimServiceID"]);

            //Get current claim info to pass through to emails
            ClaimManager cm = new ClaimManager();

            myClaim = cm.Get(claimID);


            //AdjusterManager

            try {
                using (TransactionScope scope = new TransactionScope())
                {
                    using (ClaimServiceManager repository = new ClaimServiceManager())
                    {
                        if (id == 0)
                        {
                            claimService         = new ClaimService();
                            claimService.ClaimID = claimID;
                        }
                        else
                        {
                            claimService = repository.Get(id);
                        }

                        claimService.ServiceQty         = this.txtServiceQty.Value == null ? 0 : Convert.ToDecimal(txtServiceQty.Value);
                        claimService.ServiceDate        = txtServiceDate.Date;
                        claimService.ServiceDescription = txtServiceDescription.Text.Trim();
                        claimService.ServiceTypeID      = Convert.ToInt32(this.ddlInvoiceServiceType.SelectedValue);
                        claimService.UserID             = userID;
                        claimService.AdjusterID         = Convert.ToInt32(hf_serviceAdjusterID.Value);
                        claimService.Activity           = ddlActivity.SelectedItem.Text;
                        claimService.InternalComments   = txtMyComments.Text.Trim();
                        claimService.IsBillable         = cbIsBillable.Checked;
                        claimService.Billed             = false;
                        //save to db
                        claimService = repository.Save(claimService);

                        //string EmailService = ddlInvoiceServiceType.SelectedItem.Text;
                        //string EmailActivity = ddlActivity.SelectedItem.Text;
                        //string EmailDescription = txtServiceDescription.Text;
                        //string EmailInternal = txtMyComments.Text;
                        //string EmailQuantity = txtServiceQty.Text;
                        //string EmailDate = txtServiceDate.Text;
                    }

                    // diary
                    diary                  = new ClaimComment();
                    diary.ClaimID          = claimID;
                    diary.CommentDate      = DateTime.Now;
                    diary.UserId           = userID;
                    diary.ActivityType     = ddlActivity.SelectedItem.Text;
                    diary.InternalComments = txtMyComments.Text.Trim();
                    diary.CommentText      = string.Format("Service: {0}, Description: {1}, Date {2:MM/dd/yyyy}, Qty: {3:N2}, Adjuster: {4}",
                                                           ddlInvoiceServiceType.SelectedItem.Text,
                                                           claimService.ServiceDescription,
                                                           claimService.ServiceDate,
                                                           claimService.ServiceQty,
                                                           txtServiceAdjuster.Text
                                                           );
                    ClaimCommentManager.Save(diary);

                    myAdjusterID = Convert.ToInt32(claimService.AdjusterID); //Convert.ToInt32(myClaim.AdjusterID);


                    //EMAIL ADJUSTER OC 10/21/2014
                    if (myAdjusterID != 0 || myAdjusterID != null)
                    {
                        adjuster = AdjusterManager.GetAdjusterId(myAdjusterID);
                    }
                    if (cbEmailAdjuster.Checked == true)
                    {
                        try
                        {
                            notifyAdjuster(adjuster, claimService, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL CLIENT CONTACT OC 10/22/2014
                    if (cbEmailClient.Checked == true)              //Dont need to check if invoice Pro ID is empty becuase to get to this point, one has to exist already
                    {
                        if (Session["ComingFromAllClaims"] != null) //if the user got here straight from the all claims screen
                        {
                            profileID = Convert.ToInt32(Session["CarrierInvoiceID"]);
                        }
                        else//coming from claim detail page
                        {
                            profileID = Convert.ToInt32(Session["InvoiceProfileID"]);
                        }
                        CarrierInvoice = CarrierInvoiceProfileManager.Get(profileID);
                        try
                        {
                            notifyClientContact(CarrierInvoice, claimService, myClaim, adjuster);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to client contact";
                            lblMessage.CssClass = "error";
                        }
                    }
                    //EMAIL TO WHOMEVER
                    if (txtEmailTo.Text != "")
                    {
                        try
                        {
                            notifySpecifiedUser(adjuster, claimService, myClaim);
                        }
                        catch (Exception ex)
                        {
                            lblMessage.Text     = "Unable to send email to adjuster";
                            lblMessage.CssClass = "error";
                        }
                    }

                    scope.Complete();
                }

                lblMessage.Text     = "Service was saved successfully.";
                lblMessage.CssClass = "ok";

                // keep edit form active
                lbtnNewClaimService_Click(null, null);

                // refresh grid
                gvClaimService.DataSource = loadClaimServices(claimID);
                gvClaimService.DataBind();
            }
            catch (Exception ex)
            {
                Core.EmailHelper.emailError(ex);

                lblMessage.Text     = "Unable to save claim service.";
                lblMessage.CssClass = "error";
            }
            //send email to adjuster
        }
Example #23
0
        private void calculateCommissionPerCarrierInvoiceProfile(CarrierInvoiceProfile invoiceProfile, out decimal rate, out decimal commissionAmount)
        {
            decimal claimAmount = 0;
            commissionAmount = 0;
            rate = 0;

            if (invoiceProfile != null && invoiceProfile.CarrierInvoiceProfileFeeSchedule != null && invoiceProfile.CarrierInvoiceProfileFeeSchedule.Count > 0) {

                claimAmount = getClaimAmount(invoiceProfile);

                foreach (CarrierInvoiceProfileFeeSchedule feeSchedule in invoiceProfile.CarrierInvoiceProfileFeeSchedule) {
                    if (claimAmount >= feeSchedule.RangeAmountFrom && claimAmount <= feeSchedule.RangeAmountTo) {
                        if (feeSchedule.FlatFee > 0) {
                            commissionAmount = feeSchedule.FlatFee;
                            rate = feeSchedule.FlatFee;
                        }
                        else if (feeSchedule.PercentFee > 0) {
                            commissionAmount = claimAmount * feeSchedule.PercentFee;
                            rate = feeSchedule.PercentFee * 100;
                        }
                        else if (feeSchedule.MinimumFee > 0) {
                            commissionAmount = feeSchedule.MinimumFee;
                            rate = feeSchedule.MinimumFee;
                        }
                    }
                }
            }
        }
        private void copyCarrierInvoiceProfiles(List<CarrierInvoiceProfile> profiles, int cloneCarrierID)
        {
            int carrierInvoiceProfileID = 0;

            foreach (CarrierInvoiceProfile profile in profiles) {

                CarrierInvoiceProfile copyProfile = new CarrierInvoiceProfile();

                copyProfile.CarrierID = cloneCarrierID;

                //copyProfile.CarrierInvoiceProfileID = profile.CarrierInvoiceProfileID;
                copyProfile.CarrierInvoiceProfileTypeID = profile.CarrierInvoiceProfileTypeID;
                copyProfile.CoverageArea = profile.CoverageArea;
                copyProfile.EffiectiveDate = profile.EffiectiveDate;
                copyProfile.ExpirationDate = profile.ExpirationDate;
                copyProfile.IsActive = true;
                copyProfile.ProfileName = profile.ProfileName;

                copyProfile = CarrierInvoiceProfileManager.Save(copyProfile);

                carrierInvoiceProfileID = copyProfile.CarrierInvoiceProfileID;

                copyProfileItemizedItems(profile.CarrierInvoiceProfileFeeItemized.ToList(), carrierInvoiceProfileID);

                copyProfileFeeProvision(profile.CarrierInvoiceProfileFeeProvision.ToList(), carrierInvoiceProfileID);

                copyProfileFeeSchedule(profile.CarrierInvoiceProfileFeeSchedule.ToList(), carrierInvoiceProfileID);
            }
        }
Example #25
0
        //EMAIL CLIENT CONTACT
        private void notifyClientContact(CarrierInvoiceProfile CarrierInvoice, ClaimService service, Claim myClaim, AdjusterMaster adjuster)
        {
            StringBuilder emailBody = new StringBuilder();
            string        password  = null;

            string[] recipients  = null;
            string   smtpHost    = null;
            int      smtpPort    = 0;
            string   siteUrl     = ConfigurationManager.AppSettings["siteUrl"].ToString();
            string   insuredName = Session["InsuredName"].ToString();
            string   subject     = "Claim # " + myClaim.InsurerClaimNumber + ", Please Read Claim Note, Claim Ruler Note for : " + insuredName;

            CRM.Data.Entities.SecUser user = null;

            string itsgHost          = ConfigurationManager.AppSettings["smtpHost"].ToString();
            string itsgHostPort      = ConfigurationManager.AppSettings["smtpPort"].ToString();
            string itsgEmail         = ConfigurationManager.AppSettings["smtpEmail"].ToString();
            string itsgEmailPassword = ConfigurationManager.AppSettings["smtpPassword"].ToString();

            string EmailService     = ddlInvoiceServiceType.SelectedItem.Text;
            string EmailActivity    = ddlActivity.SelectedItem.Text;
            string EmailDescription = txtServiceDescription.Text;
            string EmailInternal    = txtMyComments.Text;
            string EmailQuantity    = txtServiceQty.Text;
            string EmailDate        = txtServiceDate.Text;

            string userName = SessionHelper.getUserName();

            int.TryParse(itsgHostPort, out smtpPort);

            // get logged in user
            int userID = SessionHelper.getUserId();

            //Convert.ToInt32(itsgHostPort);
            // get current user email info
            user = SecUserManager.GetByUserId(userID);

            // load email credentials
            smtpHost = user.emailHost;
            int.TryParse(user.emailHostPort, out smtpPort);


            // recipients
            recipients = new string[] { CarrierInvoice.AccountingContactEmail };

            // build email body
            // .containerBox
            emailBody.Append("<div style=\"margin:auto;width:600px;border: 1px solid #DDDDE4; margin: auto;font-family: Tahoma, Arial,sans-serif;font-size: 12px;color: #808080;\">");

            // .header
            //emailBody.Append("<div style=\"background-image:url(https://appv3.claimruler.com/images/email_header_small.jpg);background-repeat: no-repeat;background-size: 100% 100%;height:70px;\"></div>");
            //emailBody.Append("<div><img src=\"http://app.claimruler.com/images/email_header_small.jpg\"></image></div>");

            // .paneContentInner
            emailBody.Append("<div style=\"margin: 20px;\">");
            emailBody.Append("Hi " + CarrierInvoice.AccountingContact + ",<br><br>");
            emailBody.Append("The following activity was just logged on Claim # " + myClaim.InsurerClaimNumber + " for Insured: " + insuredName + "<br><br><br>");

            emailBody.Append("<table >");
            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Service:</b></td><td align=\"left\"> " + EmailService + "</td>");
            emailBody.Append("</tr>");


            emailBody.Append("<tr>");
            emailBody.Append("<td align=\"left\"><b>Activity:</b></td><td align=\"left\"> " + EmailActivity + "</td>");
            emailBody.Append("</tr>");


            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Description:</b></td><td align=\"left\"> " + EmailDescription + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Internal Comments:</b></td><td align=\"left\"> " + EmailInternal + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr></tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Adjuster:</b></td><td align=\"left\"> " + adjuster.adjusterName + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>User Name:</b></td><td align=\"left\"> " + userName + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Service Date:</b></td><td align=\"left\"> " + EmailDate + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("<tr> ");
            emailBody.Append("<td align=\"left\"><b>Timer Quantity:</b></td><td align=\"left\"> " + EmailQuantity + "</td>");
            emailBody.Append("</tr>");

            emailBody.Append("</table ><br><br>");

            emailBody.Append("</div>"); // inner containerBox
            emailBody.Append("</div>"); // paneContentInner
            emailBody.Append("</div>"); // containerBox

            //Core.EmailHelper.sendEmail(user.Email, recipients, null, "Claim Assignment Notification", emailBody.ToString(), null, user.emailHost, smtpPort, smtpEmail, smtpPassword, true);
            password = Core.SecurityManager.Decrypt(user.emailPassword);

            //Core.EmailHelper.sendEmail(user.Email, recipients, null, subject, emailBody.ToString(), null, user.emailHost, smtpPort, user.Email, password, user.isSSL ?? true);
            Core.EmailHelper.sendEmail(itsgEmail, recipients, null, subject, emailBody.ToString(), null, itsgHost, Convert.ToInt32(itsgHostPort), itsgEmail, itsgEmailPassword);
        }