コード例 #1
0
        public void bindData(int claimID)
        {
            adsource.PageSize    = 10;
            adsource.AllowPaging = true;

            pos = Convert.ToInt32(ViewState["vs"]);

            Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(this.policyID);

            if (policy != null)
            {
                ViewState["policyTypeID"] = policy.PolicyType.ToString();

                ViewState["vs"] = ViewState["pageIndex"] == null ? "0" : ViewState["pageIndex"].ToString();

                pos = Convert.ToInt32(ViewState["vs"]);

                Session["pageIndex"] = null;

                FillImage(this.leadID);
            }
        }
コード例 #2
0
        protected void gvPolicyList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = 0;

            switch (e.CommandName)
            {
            case "DoEdit":
            case "DoView":
                Session["policyID"] = e.CommandArgument;

                Response.Redirect("~/Protected/LeadPolicyEdit.aspx");
                break;

            case "DoDelete":
                id = Convert.ToInt32(e.CommandArgument);
                try {
                    Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(id);
                    if (policy != null)
                    {
                        policy.IsActive = false;

                        LeadPolicyManager.Save(policy);

                        // refresh policy list
                        gvPolicyList.DataBind();
                    }
                }
                catch (Exception ex) {
                    Core.EmailHelper.emailError(ex);
                }
                break;


            default:
                break;
            }
        }
コード例 #3
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();
            }
        }
コード例 #4
0
        public void saveForm()
        {
            Page.Validate("Policy");
            //if (!Page.IsValid)
            //    return;

            CRM.Data.Entities.LeadPolicy policy = null;

            lblMessage.Text     = string.Empty;
            lblMessage.CssClass = string.Empty;

            //if (int.TryParse(hf_policyID.Value, out id) && id > 0) {
            if (policyID > 0)
            {
                policy = LeadPolicyManager.Get(policyID);
            }
            else
            {
                // new
                policy          = new CRM.Data.Entities.LeadPolicy();
                policy.LeadId   = Core.SessionHelper.getLeadId();
                policy.Id       = 0;
                policy.IsActive = true;
                policy.isAllDocumentUploaded = false;
            }
            if (ucPolicyType1.SelectedValue == "0" || ucPolicyType1.SelectedValue == "")
            {
                policy.PolicyType = null;
            }
            else
            {
                policy.PolicyType = Convert.ToInt32(ucPolicyType1.SelectedValue);
            }

            // carrier information
            if (ddlCarrier.SelectedIndex > 0)
            {
                policy.CarrierID = Convert.ToInt32(ddlCarrier.SelectedValue);
            }
            else
            {
                policy.CarrierID = null;
            }

            policy.PolicyNumber   = txtInsurancePolicyNumber.Text.Trim();
            policy.PolicyFormType = txtPolicyFormType.Text.Trim();

            policy.InsuranceCompanyName = txtInsuranceCompanyName.Text;

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

            if (!string.IsNullOrEmpty(txtExpirationDate.Text))
            {
                policy.EffectiveDate = txtEffectiveDate.Date;
            }
            else
            {
                policy.EffectiveDate = null;
            }

            if (!string.IsNullOrEmpty(txtInitialCoverageDate.Text))
            {
                policy.InitialCoverageDate = txtInitialCoverageDate.Date;
            }

            if (ddlAgent.SelectedIndex > 0)
            {
                policy.AgentID = Convert.ToInt32(ddlAgent.SelectedValue);
            }

            try {
                using (TransactionScope scope = new TransactionScope()) {
                    // save policy id
                    this.policyID = LeadPolicyManager.Save(policy);



                    if (HttpContext.Current.Session["Limit"] != null && HttpContext.Current.Session["PolicyLimit"] != null && HttpContext.Current.Session["tblCasulityPolicylimit"] != null && HttpContext.Current.Session["tblAllPolicylimit"] != null)
                    {
                        AddLimitPolicy(this.policyID);
                        CacheBlank();
                        ShowAddCoverage();
                        SetAddCoverage(this.policyID);
                        HideAddCoverageAdd();
                    }
                    else
                    {
                        propertyLimits.saveLimits(policyID);

                        //casualtyLimits.saveLimits(policyID);
                    }



                    propertySubLimits.saveLimits(policyID);

                    scope.Complete();
                }

                // save policy type in viewstate
                policyType = ucPolicyType1.SelectedValue;

                // save policy id
                hf_policyID.Value = policyID.ToString();

                // activate other tabs
                tabContainerPolicy.Visible = true;

                activateLinks();

                bindLimits();

                bindClaims();

                //bindData();


                lblMessage.Text     = "Policy Information saved successfully.";
                lblMessage.CssClass = "ok";
            }
            catch (Exception ex) {
                lblMessage.Text     = "Policy Information was not saved.";
                lblMessage.CssClass = "error";

                Core.EmailHelper.emailError(ex);
            }
        }
コード例 #5
0
        public void fillForm()
        {
            Contact primaryContact = null;
            string  zipCode        = null;

            if (policyID > 0)
            {
                CRM.Data.Entities.LeadPolicy policy = LeadPolicyManager.Get(policyID);

                if (policy == null)
                {
                    return;
                }

                ViewState["policyType"] = policy.PolicyType.ToString();

                hf_policyID.Value     = policy.Id.ToString();
                hf_lastStatusID.Value = (policy.LeadStatus ?? 0).ToString();

                //cbxAllDocumentUploaded.Checked = policy.isAllDocumentUploaded ?? false;

                if (policy.PolicyType != null)
                {
                    ucPolicyType1.SelectedValue = policy.PolicyType.ToString();
                }

                txtPolicyFormType.Text = policy.PolicyFormType;

                txtInsuranceCompanyName.Text  = policy.Carrier == null ? policy.InsuranceCompanyName : policy.Carrier.CarrierName;
                txtInsuranceAddress.Text      = policy.Carrier == null ? policy.InsuranceAddress : policy.Carrier.AddressLine1;
                txtInsuranceAddress2.Text     = policy.Carrier == null ? "" : policy.Carrier.AddressLine2;
                txtInsurancePolicyNumber.Text = policy.PolicyNumber;

                if (policy.Carrier != null)
                {
                    txtInsuranceState.Text   = policy.Carrier.StateName;
                    txtInsuranceCity.Text    = policy.Carrier.CityMaster != null ? policy.Carrier.CityMaster.CityName : string.Empty;
                    txtInsuranceZipCode.Text = policy.Carrier.ZipCode;

                    ddlCarrier.SelectedValue = policy.CarrierID.ToString();

                    // get primary carrier contact
                    primaryContact = CarrierContactManager.GetPrimaryContact((int)policy.CarrierID);
                    if (primaryContact != null)
                    {
                        txtPrimaryContactName.Text  = primaryContact.fullName;
                        txtPrimaryContactEmail.Text = primaryContact.Email;
                        txtPrimaryContactPhone.Text = primaryContact.Phone;
                    }
                }
                else
                {
                    zipCode = policy.InsuranceZipCode ?? "";
                }

                txtInsuranceFaxNumber.Text = policy.FaxNumber;

                txtInsurancePhoneNumber.Text = policy.PhoneNumber;

                txtEffectiveDate.Value = policy.EffectiveDate;

                txtExpirationDate.Value = policy.ExpirationDate;

                txtInitialCoverageDate.Value = policy.InitialCoverageDate;

                if (policy.AgentID != null)
                {
                    fillAgentDetails((int)policy.AgentID);
                }
            }
        }
コード例 #6
0
        protected void btnAgentNewSave_Click(object sender, EventArgs e)
        {
            CRM.Data.Entities.LeadPolicy policy = null;

            Contact contact = null;

            contact          = new Contact();
            contact.ClientID = SessionHelper.getClientId();
            contact.IsActive = true;
            contact.Address1 = txtAgentAddress1.Text;
            contact.Address2 = txtAgentAddress2.Text;

            contact.CategoryID  = (int)Globals.ContactType.Agent;
            contact.CompanyName = txtAgentEntityName.Text;
            contact.ContactName = txtAgentFirstName.Text + " " + txtAgentLastName.Text;

            contact.Email     = txtAgentEmail.Text;
            contact.Fax       = txtAgentFax.Text;
            contact.FirstName = txtAgentFirstName.Text;
            contact.LastName  = txtAgentLastName.Text;

            contact.Phone = txtAgentPhoneNumber.Text;

            if (ddlState.SelectedIndex > 0)
            {
                contact.StateID = Convert.ToInt32(ddlState.SelectedValue);
            }

            if (ddlCity.SelectedIndex > 0)
            {
                contact.CityID = Convert.ToInt32(ddlCity.SelectedValue);
            }

            if (ddlAgentZip.SelectedIndex > 0)
            {
                contact.ZipCodeID = Convert.ToInt32(ddlAgentZip.SelectedValue);
            }


            try {
                using (TransactionScope scope = new TransactionScope()) {
                    contact = ContactManager.Save(contact);

                    policy = LeadPolicyManager.Get(this.policyID);

                    policy.AgentID = contact.ContactID;

                    LeadPolicyManager.Save(policy);

                    scope.Complete();
                }

                showInputFields(false);

                showLabelField(true);

                bindAgents();

                ddlAgent.SelectedValue = contact.ContactID.ToString();

                fillAgentDetails(contact.ContactID);
            }
            catch (Exception ex) {
                Core.EmailHelper.emailError(ex);
            }
        }