예제 #1
0
        private PolicyWaiverRowViewModel GetPolicyWaiverRowModel()
        {
            var categoryMasterData = _catalogService.GetMasterDataListByTypeCode(
                true, MasterType.POLICY_WAIVER_CATEGORY);

            var statusMasterDataId = _catalogService.GetConvergenceMasterDataIdByCode(
                PolicyWaiverStatusCode.UNSENT, MasterType.POLICY_WAIVER_STATUS);

            var statusMasterData = _catalogService.GetMasterDataListByTypeCode(
                true, MasterType.POLICY_WAIVER_STATUS);

            var categoryList = categoryMasterData.IsValid && categoryMasterData.MasterDataCollection.HasAny()
                ? categoryMasterData.MasterDataCollection.Select(
                o =>
                new Tuple <string, string>(o.MasterId.ToString(),
                                           o.GetLocalizedName(Localization.CurrentLanguage))).ToList()
                : new List <Tuple <string, string> >();

            var statusList = statusMasterData.IsValid && statusMasterData.MasterDataCollection.HasAny()
               ? statusMasterData.MasterDataCollection.Select(
                o =>
                new Tuple <string, string>(o.MasterId.ToString(),
                                           o.GetLocalizedName(Localization.CurrentLanguage))).ToList()
               : new List <Tuple <string, string> >();

            var model = new PolicyWaiverRowViewModel
            {
                PolicyWaiverCategory = new FieldModel
                {
                    FieldName      = VerSecurityValues.POLICY_WAIVER_CATEGORY,
                    DropDownSource = categoryList
                },
                PolicyWaiver = new FieldModel
                {
                    FieldName   = VerSecurityValues.POLICY_WAIVER,
                    Placeholder = Localization.GetText("POLICY.WAIVER.PLACEHOLDER")
                },
                PolicyWaiverJustification = new FieldModel
                {
                    FieldName   = VerSecurityValues.POLICY_WAIVER_JUSTIFICATION,
                    Placeholder = Localization.GetText("POLICY.WAIVER.JUSTIFICATION.PLACEHOLDER")
                },
                PolicyWaiverStatus = new FieldModel
                {
                    FieldName      = VerSecurityValues.POLICY_WAIVER_STATUS,
                    IntValue       = statusMasterData.IsValid ? statusMasterDataId.Id : 0,
                    DropDownSource = statusList
                }
            };

            return(model);
        }
예제 #2
0
        private static void ProcessRegisterPolicyWaiver(
            PolicyWaiverRowViewModel register,
            IList <ClientFieldData> fieldList,
            bool isRequestPolicy,
            bool isSendPolicy)
        {
            var category = fieldList.FirstOrDefault(o =>
                                                    o.Name == VerSecurityValues.POLICY_WAIVER_CATEGORY);
            var policy = fieldList.FirstOrDefault(o =>
                                                  o.Name == VerSecurityValues.POLICY_WAIVER);
            var policyJustification = fieldList.FirstOrDefault(o =>
                                                               o.Name == VerSecurityValues.POLICY_WAIVER_JUSTIFICATION);
            var policyResponse = fieldList.FirstOrDefault(o =>
                                                          o.Name == VerSecurityValues.POLICY_WAIVER_RESPONSE);
            var policyStatus = fieldList.FirstOrDefault(o =>
                                                        o.Name == VerSecurityValues.POLICY_WAIVER_STATUS);

            if (register.PolicyWaiverCategory.IsReadOnly == false &&
                category != null &&
                register.PolicyWaiverCategory.IntValue != Convert.ToInt32(category.Value))
            {
                register.IsEdited = true;
                register.PolicyWaiverCategory.IsEdited = true;
                register.PolicyWaiverCategory.IntValue = Convert.ToInt32(category.Value);
            }

            if (register.PolicyWaiver.IsReadOnly == false &&
                policy != null &&
                register.PolicyWaiver.TextValue != policy.Value)
            {
                register.IsEdited = true;
                register.PolicyWaiver.IsEdited  = true;
                register.PolicyWaiver.TextValue = policy.Value;
            }

            if (register.PolicyWaiverJustification.IsReadOnly == false &&
                policyJustification != null &&
                register.PolicyWaiverJustification.TextValue != policyJustification.Value)
            {
                register.IsEdited = true;
                register.PolicyWaiverJustification.IsEdited  = true;
                register.PolicyWaiverJustification.TextValue = policyJustification.Value;
            }

            if (register.PolicyWaiverResponse.IsReadOnly == false &&
                policyResponse != null &&
                register.PolicyWaiverResponse.TextValue != policyResponse.Value)
            {
                register.IsEdited = true;
                register.PolicyWaiverResponse.IsEdited  = true;
                register.PolicyWaiverResponse.TextValue = policyResponse.Value;
            }

            if (register.PolicyWaiverStatus.IsReadOnly == false &&
                policyStatus != null &&
                register.PolicyWaiverStatus.IntValue != Convert.ToInt32(policyStatus.Value))
            {
                register.IsEdited = true;
                register.PolicyWaiverStatus.IsEdited = true;
                register.PolicyWaiverStatus.IntValue = Convert.ToInt32(policyStatus.Value);
            }

            if (register.IsRequested == false && isRequestPolicy)
            {
                register.IsRequested = true;
                register.IsEdited    = true;
            }

            if (register.IsResponded == false && isSendPolicy)
            {
                register.PolicyWaiverResponseDate = DateTime.Now;
                register.IsResponded = true;
                register.IsEdited    = true;
            }
        }
예제 #3
0
        private static void ProcessNewPolicyWaiver(
            PolicyWaiverViewModel viewModel,
            IList <ClientFieldData> fieldList,
            bool isRequestPolicy)
        {
            var category = fieldList.FirstOrDefault(o =>
                                                    o.Name == VerSecurityValues.POLICY_WAIVER_CATEGORY);
            var policy = fieldList.FirstOrDefault(o =>
                                                  o.Name == VerSecurityValues.POLICY_WAIVER);
            var policyJustification = fieldList.FirstOrDefault(o =>
                                                               o.Name == VerSecurityValues.POLICY_WAIVER_JUSTIFICATION);
            var status = fieldList.FirstOrDefault(o =>
                                                  o.Name == VerSecurityValues.POLICY_WAIVER_STATUS);

            var newRegister = new PolicyWaiverRowViewModel
            {
                IsAdded = true
            };

            if (category != null)
            {
                newRegister.PolicyWaiverCategory = new FieldModel
                {
                    IntValue = Convert.ToInt32(category.Value),
                    IsEdited = true
                };
            }

            if (policy != null)
            {
                newRegister.PolicyWaiver = new FieldModel
                {
                    TextValue = policy.Value,
                    IsEdited  = true
                };
            }

            if (policyJustification != null)
            {
                newRegister.PolicyWaiverJustification = new FieldModel
                {
                    TextValue = policyJustification.Value,
                    IsEdited  = true
                };
            }

            if (status != null)
            {
                newRegister.PolicyWaiverStatus = new FieldModel
                {
                    IntValue = Convert.ToInt32(status.Value),
                    IsEdited = true
                };
            }

            if (isRequestPolicy)
            {
                newRegister.IsRequested = true;
            }

            viewModel.PolicyWaiverList.Add(newRegister);
        }