protected void gvContactType_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            LeadContactType contactType = null;

            int contactTypeID = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "DoEdit")
            {
                contactType = LeadContactTypeManager.Get(contactTypeID);

                if (contactType != null)
                {
                    txtContactType.Text = contactType.Description;

                    showContactTypePanel();
                }
            }
            else if (e.CommandName == "DoDelete")
            {
                contactType = LeadContactTypeManager.Get(contactTypeID);
                if (contactType != null)
                {
                    contactType.isActive = false;

                    LeadContactTypeManager.Save(contactType);

                    DoBind();
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("ContactType");
            if (!Page.IsValid)
                return;

            int contactTypeID = Convert.ToInt32(ViewState["ID"]);

            LeadContactType contactType = null;

            if (contactTypeID == 0) {
                contactType = new LeadContactType();

                contactType.isActive = true;

                contactType.ClientID = clientID;
            }
            else
                contactType = LeadContactTypeManager.Get(contactTypeID);

            if (contactType != null) {
                contactType.Description = txtContactType.Text;

                contactType = LeadContactTypeManager.Save(contactType);

                showContactTypeGrid();

                DoBind();
            }
        }
        public static LeadContactType Get(int id)
        {
            LeadContactType contactType = (from x in DbContextHelper.DbContext.LeadContactType
                                           where x.ID == id
                                           select x).FirstOrDefault <LeadContactType>();

            return(contactType);
        }
        public static LeadContactType Get(int clientID, string description)
        {
            LeadContactType contactType = (from x in DbContextHelper.DbContext.LeadContactType
                                           where x.ClientID == clientID &&
                                           x.Description.Contains(description)
                                           select x
                                           ).FirstOrDefault <LeadContactType>();

            return(contactType);
        }
示例#5
0
        private LeadContactType addNewContactType(int clientID, string typeDescription)
        {
            LeadContactType contactType = new LeadContactType();

            contactType.Description = typeDescription;
            contactType.ClientID    = clientID;

            contactType = LeadContactTypeManager.Save(contactType);

            return(contactType);
        }
        public static LeadContactType Save(LeadContactType contactType)
        {
            if (contactType.ID == 0)
            {
                DbContextHelper.DbContext.Add(contactType);
            }

            DbContextHelper.DbContext.SaveChanges();

            return(contactType);
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate("ContactType");
            if (!Page.IsValid)
            {
                return;
            }

            int contactTypeID = Convert.ToInt32(ViewState["ID"]);

            LeadContactType contactType = null;

            if (contactTypeID == 0)
            {
                contactType = new LeadContactType();

                contactType.isActive = true;

                contactType.ClientID = clientID;
            }
            else
            {
                contactType = LeadContactTypeManager.Get(contactTypeID);
            }

            if (contactType != null)
            {
                contactType.Description = txtContactType.Text;

                contactType = LeadContactTypeManager.Save(contactType);

                showContactTypeGrid();

                DoBind();
            }
        }
示例#8
0
        private Claim createClaim(int policyID, DataRow dataRow)
        {
            decimal            amount                 = 0;
            AdjusterMaster     adjuster               = null;
            string             adjusterName           = null;
            string             causeofLoss            = null;
            Claim              claim                  = null;
            string             claimstatus            = null;
            int                clientID               = SessionHelper.getClientId();
            Contact            contact                = null;
            DateTime           dateTime               = DateTime.MinValue;
            LeadContactType    contactType            = null;
            string             ownerManagerName       = null;
            string             ownerManagerEntityName = null;
            int                severity               = 0;
            string             supervisorName         = null;
            string             teamLead               = null;
            TypeOfDamageMaster damageType             = null;
            int                userID                 = SessionHelper.getUserId();
            string             userFieldName          = null;

            claim          = new Claim();
            claim.PolicyID = policyID;
            claim.IsActive = true;

            // Insurer Claim ID
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Insurer Claim ID");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claim.InsurerClaimNumber  = dataRow[userFieldName].ToString().Trim();
                claim.AdjusterClaimNumber = claim.InsurerClaimNumber;
            }

            // Adjuster Claim Number
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Claim Number");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claim.AdjusterClaimNumber = dataRow[userFieldName].ToString().Trim();
            }

            // Claim Status
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Status");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claimstatus = dataRow[userFieldName].ToString().Trim();
                if (!string.IsNullOrEmpty(claimstatus))
                {
                    StatusMaster statusMaster = StatusManager.GetByStatusName(clientID, claimstatus);
                    if (statusMaster.StatusId == 0)
                    {
                        statusMaster.StatusName = claimstatus;
                        statusMaster.clientID   = clientID;
                        statusMaster.Status     = true;
                        statusMaster            = StatusManager.Save(statusMaster);
                    }
                    claim.StatusID = statusMaster.StatusId;
                }
            }

            #region Dates
            // Date of Loss
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Loss");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.LossDate = dateTime;
                }
            }

            // Date Reported
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Reported");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateOpenedReported = dateTime;
                }
            }

            // Date First Closed
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Closed");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateFirstClosed = dateTime;
                }
            }

            // Date First Reopen
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Reopen");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateFirstReOpened = dateTime;
                }
            }
            // Date Assigned
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Assigned");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateAssigned = dateTime;
                }
            }
            // Date Acknowledged
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Acknowledged");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateAcknowledged = dateTime;
                }
            }
            // Date First Contact Attempted
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date First Contact Attempted");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateFirstContactAttempt = dateTime;
                }
            }
            //Date Contacted
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Contacted");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateContacted = dateTime;
                }
            }
            //Date Inspection Scheduled
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Scheduled");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateInspectionScheduled = dateTime;
                }
            }
            // Date Inspection Completed
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Inspection Completed");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateInspectionCompleted = dateTime;
                }
            }
            // Date Estimate Uploaded
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Estimate Uploaded");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateEstimateUploaded = dateTime;
                }
            }
            // Date of Initial Reserve Change
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date of Initial Reserve Change");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateInitialReserveChange = dateTime;
                }
            }
            // Date Indemnity Payment Requested
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Requested");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateIndemnityPaymentRequested = dateTime;
                }
            }
            // Date Indemnity Payment Approved
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Approved");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateIndemnityPaymentApproved = dateTime;
                }
            }
            // Date Indemnity Payment Issued
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Indemnity Payment Issued");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateIndemnityPaymentIssued = dateTime;
                }
            }
            // Date Completed
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Completed");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateCompleted = dateTime;
                }
            }
            // Date Closed
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateClosed = dateTime;
                }
            }
            // Date Closed
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Date Closed");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (DateTime.TryParse(dataRow[userFieldName].ToString(), out dateTime))
                {
                    claim.DateClosed = dateTime;
                }
            }

            #endregion

            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cycle Time");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount))
                {
                    claim.CycleTime = amount;
                }
            }
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "ReOpenCycle Time");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (decimal.TryParse(dataRow[userFieldName].ToString(), out amount))
                {
                    claim.ReopenCycleTime = amount;
                }
            }

            #region adjuster
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Adjuster Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                adjusterName = dataRow[userFieldName].ToString().Trim();
                adjuster     = AdjusterManager.GetByAdjusterName(clientID, adjusterName);
                if (adjuster.AdjusterId == 0)
                {
                    // add adjuster
                    adjuster                     = new AdjusterMaster();
                    adjuster.Status              = true;
                    adjuster.AdjusterName        = adjusterName.Trim();
                    adjuster.ClientId            = clientID;
                    adjuster.InsertBy            = userID;
                    adjuster.InsertDate          = DateTime.Now;
                    adjuster.isEmailNotification = true;
                    adjuster                     = AdjusterManager.Save(adjuster);
                }

                claim.AdjusterID = adjuster.AdjusterId;
            }
            #endregion

            #region supervisor
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Supervisor Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                supervisorName = dataRow[userFieldName].ToString().Trim();
                if (!string.IsNullOrEmpty(supervisorName))
                {
                    contactType = LeadContactTypeManager.Get(clientID, "Supervisor");
                    if (contactType == null)
                    {
                        contactType = addNewContactType(clientID, "Supervisor");
                    }

                    contact = ContactManager.Get(clientID, supervisorName);
                    if (contact == null)
                    {
                        contact = addNewContact(clientID, supervisorName, contactType.ID);
                    }

                    claim.SupervisorID = contact.ContactID;
                }
            }
            #endregion

            #region Team Lead
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Team Lead Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                teamLead = dataRow[userFieldName].ToString().Trim();
                if (!string.IsNullOrEmpty(teamLead))
                {
                    contactType = LeadContactTypeManager.Get(clientID, "Team Lead");
                    if (contactType == null)
                    {
                        contactType = addNewContactType(clientID, "Team Lead");
                    }

                    contact = ContactManager.Get(clientID, teamLead);
                    if (contact == null)
                    {
                        contact = addNewContact(clientID, teamLead, contactType.ID);
                    }

                    claim.TeamLeadID = contact.ContactID;
                }
            }
            #endregion

            #region Owner Manager Name
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                ownerManagerName = dataRow[userFieldName].ToString().Trim();
                if (!string.IsNullOrEmpty(ownerManagerName))
                {
                    contactType = LeadContactTypeManager.Get(clientID, "Owner Manager");
                    if (contactType == null)
                    {
                        contactType = addNewContactType(clientID, "Owner Manager");
                    }

                    contact = ContactManager.Get(clientID, ownerManagerName);
                    if (contact == null)
                    {
                        contact = addNewContact(clientID, ownerManagerName, contactType.ID);
                    }

                    claim.ManagerID = contact.ContactID;
                }
            }
            #endregion

            #region Owner Manager Entity Name
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Owner Manager Entity Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                ownerManagerEntityName = dataRow[userFieldName].ToString().Trim();
                if (!string.IsNullOrEmpty(ownerManagerEntityName))
                {
                    contactType = LeadContactTypeManager.Get(clientID, "Owner Manager Entity Name");
                    if (contactType == null)
                    {
                        contactType = addNewContactType(clientID, "Owner Manager Entity Name");
                    }

                    contact = ContactManager.Get(clientID, ownerManagerEntityName);
                    if (contact == null)
                    {
                        contact = addNewContact(clientID, ownerManagerEntityName, contactType.ID);
                    }
                    claim.ManagerEntityID = contact.ContactID;
                }
            }
            #endregion

            // severity
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Severity");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                if (int.TryParse(dataRow[userFieldName].ToString().Trim(), out severity))
                {
                    claim.SeverityNumber = severity;
                }
            }

            // event
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Type");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claim.EventType = dataRow[userFieldName].ToString().Trim();
            }

            // event name
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Event Name");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claim.EventName = dataRow[userFieldName].ToString().Trim();
            }

            // Cause of Loss Description
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Cause of Loss Description");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                causeofLoss = dataRow[userFieldName].ToString().Trim();

                damageType = TypeofDamageManager.GetTypeOfDamage(clientID, causeofLoss);
                if (damageType.TypeOfDamageId == 0)
                {
                    damageType.ClientId     = clientID;
                    damageType.Status       = true;
                    damageType.TypeOfDamage = causeofLoss;

                    damageType = TypeofDamageManager.Save(damageType);
                }

                claim.CauseOfLoss = damageType.TypeOfDamageId.ToString();
            }

            #region Amounts
            // Claim Workflow Type
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Claim Workflow Type");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                claim.ClaimWorkflowType = dataRow[userFieldName].ToString().Trim();
            }

            // Outstanding Indemnity Reserve
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding Indemnity Reserve");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.OutstandingIndemnityReserve = amount;
            }

            // Outstanding LAE Reserves
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Outstanding LAE Reserves");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.OutstandingLAEReserves = amount;
            }

            // Total Indemnity Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Indemnity Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.TotalIndemnityPaid = amount;
            }

            // Coverage A Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage A Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.CoverageAPaid = amount;
            }

            // Coverage B Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage B Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.CoverageBPaid = amount;
            }

            // Coverage C Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage C Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.CoverageCPaid = amount;
            }

            // Coverage D Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Coverage D Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.CoverageDPaid = amount;
            }

            // Total Expenses Paid
            userFieldName = Core.CSVHelper.getUserFieldName(this.mappedFields, "Total Expenses Paid");
            if (!string.IsNullOrEmpty(userFieldName) && dataRow[userFieldName] != null)
            {
                decimal.TryParse(dataRow[userFieldName].ToString().Trim(), out amount);
                claim.TotalExpensesPaid = amount;
            }
            #endregion

            claim = ClaimsManager.Save(claim);

            return(claim);
        }
示例#9
0
        private LeadContactType addNewContactType(int clientID, string typeDescription)
        {
            LeadContactType contactType = new LeadContactType();
            contactType.Description = typeDescription;
            contactType.ClientID = clientID;

            contactType = LeadContactTypeManager.Save(contactType);

            return contactType;
        }