public KanbanController(IKanbanService kanbanService, IUserService userService,
                         IPolicyTypeService policyTypeService, INotificationService notificationService)
 {
     _kanbanService       = kanbanService;
     _userService         = userService;
     _policyTypeService   = policyTypeService;
     _notificationService = notificationService;
 }
Ejemplo n.º 2
0
 public PolicyController(IPolicyService ps, IPolicyTypeService pts, ICountryService cs, IFranchiseService fs,
                         IAdditionalChargesService acs, IUserService us, IInsuredsService iss, IPolicyInsuredService pis, IOkSetupService os)
 {
     _ps            = ps;
     _pts           = pts;
     _cs            = cs;
     _fs            = fs;
     _acs           = acs;
     _us            = us;
     _iss           = iss;
     _pis           = pis;
     _roleAuthorize = new RoleAuthorize();
     _os            = os;
 }
Ejemplo n.º 3
0
 public MobileApiController(IUserService us,
                            IPolicyInsuredService pis,
                            IAdditionalChargesService acs,
                            IPolicyService ps,
                            IFirstNoticeOfLossService fnls,
                            IHealthInsuranceService his,
                            ILuggageInsuranceService lis,
                            IOkSetupService oss,
                            IBankAccountService bas,
                            IInsuredsService iss,
                            IFirstNoticeOfLossService fis,
                            IPolicyTypeService pts,
                            IAdditionalInfoService ais,
                            ICountryService coun,
                            IExchangeRateService exch,
                            IFranchiseService fran,
                            ITravelNumberService tn,
                            IOkSetupService os)
 {
     _ps   = ps;
     _us   = us;
     _fnls = fnls;
     _lis  = lis;
     _oss  = oss;
     _his  = his;
     _bas  = bas;
     _iss  = iss;
     _fis  = fis;
     _pts  = pts;
     _ais  = ais;
     _pis  = pis;
     _acs  = acs;
     _coun = coun;
     _exch = exch;
     _fran = fran;
     _tn   = tn;
     _os   = os;
 }
 public FirstNoticeOfLossController(IUserService us,
                                    IPolicyService ps,
                                    IPolicyInsuredService pis,
                                    IInsuredsService iss,
                                    IFirstNoticeOfLossService fis,
                                    IBankAccountService bas,
                                    IPolicyTypeService pts,
                                    IAdditionalInfoService ais,
                                    IHealthInsuranceService his,
                                    ILuggageInsuranceService lis,
                                    IFirstNoticeOfLossArchiveService firstNoticeLossArchiveService)
 {
     _us  = us;
     _ps  = ps;
     _pis = pis;
     _iss = iss;
     _bas = bas;
     _pts = pts;
     _ais = ais;
     _fis = fis;
     _his = his;
     _lis = lis;
     _firstNoticeLossArchiveService = firstNoticeLossArchiveService;
 }
        public static int SaveFirstNoticeOfLoss(IInsuredsService _iss, IUserService _us, IFirstNoticeOfLossService _fis,
                                                IBankAccountService _bas, IPolicyTypeService _pts, IAdditionalInfoService _ais,
                                                FirstNoticeOfLossReportViewModel firstNoticeOfLossViewModel, IEnumerable <HttpPostedFileBase> invoices,
                                                IEnumerable <HttpPostedFileBase> documentsHealth, IEnumerable <HttpPostedFileBase> documentsLuggage)
        {
            var result         = -1;
            var additionalInfo = _ais.Create();

            if (firstNoticeOfLossViewModel.IsHealthInsurance)
            {
                additionalInfo.Accident_place = firstNoticeOfLossViewModel.AccidentPlaceHealth;
                if (firstNoticeOfLossViewModel.AccidentDateTimeHealth != null)
                {
                    var      dateTime = firstNoticeOfLossViewModel.AccidentDateTimeHealth.Value;
                    var      timeSpan = firstNoticeOfLossViewModel.AccidentTimeHealth.Value;
                    DateTime d        = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day);
                    d.Add(timeSpan);
                    additionalInfo.Datetime_accident = d;
                }
                var healthInsuranceInfo = new health_insurance_info
                {
                    Additional_infoId        = _ais.Add(additionalInfo),
                    additional_info          = additionalInfo,
                    Datetime_doctor_visit    = firstNoticeOfLossViewModel.DoctorVisitDateTime,
                    Doctor_info              = firstNoticeOfLossViewModel.DoctorInfo,
                    Medical_case_description = firstNoticeOfLossViewModel.MedicalCaseDescription,
                    Previous_medical_history = firstNoticeOfLossViewModel.PreviousMedicalHistory,
                    Responsible_institution  = firstNoticeOfLossViewModel.ResponsibleInstitution
                };

                try
                {
                    _ais.AddHealthInsuranceInfo(healthInsuranceInfo);
                }
                finally { }
            }
            else
            {
                additionalInfo.Accident_place = firstNoticeOfLossViewModel.AccidentPlaceLuggage;
                if (firstNoticeOfLossViewModel.AccidentDateTimeLuggage != null)
                {
                    var      dateTime = firstNoticeOfLossViewModel.AccidentDateTimeLuggage.Value;
                    var      timeSpan = firstNoticeOfLossViewModel.AccidentTimeLuggage.Value;
                    DateTime d        = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day);
                    additionalInfo.Datetime_accident = d + timeSpan;
                }
                var luggageInsuranceInfo = new luggage_insurance_info
                {
                    Additional_infoId     = _ais.Add(additionalInfo),
                    additional_info       = additionalInfo,
                    Place_description     = firstNoticeOfLossViewModel.PlaceDescription,
                    Detail_description    = firstNoticeOfLossViewModel.DetailDescription,
                    Report_place          = firstNoticeOfLossViewModel.ReportPlace,
                    Floaters              = firstNoticeOfLossViewModel.Floaters,
                    Floaters_value        = float.Parse(firstNoticeOfLossViewModel.FloatersValue),
                    Luggage_checking_Time = firstNoticeOfLossViewModel.LugaggeCheckingTime ?? new TimeSpan(0, 0, 0)
                };

                try
                {
                    _ais.AddLuggageInsuranceInfo(luggageInsuranceInfo);
                }
                finally { }
            }
            var firstNoticeOfLossEntity = _fis.Create();

            firstNoticeOfLossEntity.PolicyId   = firstNoticeOfLossViewModel.PolicyId;
            firstNoticeOfLossEntity.ClaimantId = firstNoticeOfLossViewModel.ClaimantId;
            firstNoticeOfLossEntity.Relation_claimant_policy_holder = firstNoticeOfLossViewModel.RelationClaimantPolicyHolder;
            firstNoticeOfLossEntity.Destination       = firstNoticeOfLossViewModel.Destination;
            firstNoticeOfLossEntity.Depart_Date_Time  = firstNoticeOfLossViewModel.DepartDateTime;
            firstNoticeOfLossEntity.Arrival_Date_Time = firstNoticeOfLossViewModel.ArrivalDateTime;
            firstNoticeOfLossEntity.Transport_means   = firstNoticeOfLossViewModel.TransportMeans;
            firstNoticeOfLossEntity.Total_cost        = firstNoticeOfLossViewModel.TotalCost;
            firstNoticeOfLossEntity.CreatedDateTime   = DateTime.Now;
            firstNoticeOfLossEntity.FNOL_Number       = _fis.CreateFNOLNumber();

            string username;

            if (firstNoticeOfLossViewModel.isMobile)
            {
                username = firstNoticeOfLossViewModel.username;
            }
            else
            {
                username = System.Web.HttpContext.Current.User.Identity.Name;
            }
            firstNoticeOfLossEntity.CreatedBy = _us.GetUserIdByUsername(username);
            //firstNoticeOfLossEntity.Message = "";
            firstNoticeOfLossEntity.Additional_infoID = additionalInfo.ID;
            firstNoticeOfLossEntity.PolicyId          = firstNoticeOfLossViewModel.PolicyId;
            firstNoticeOfLossEntity.ClaimantId        = firstNoticeOfLossEntity.ClaimantId;
            firstNoticeOfLossEntity.Relation_claimant_policy_holder = firstNoticeOfLossEntity.Relation_claimant_policy_holder;

            if (!firstNoticeOfLossViewModel.isMobile && firstNoticeOfLossViewModel.ClaimantExistentBankAccount)
            {
                firstNoticeOfLossEntity.Claimant_bank_accountID = firstNoticeOfLossViewModel.ClaimantForeignBankAccountId;
            }
            else
            {
                var bankAccountId = SaveBankAccountInfoHelper.SaveBankAccountInfo(_bas, firstNoticeOfLossViewModel.ClaimantId,
                                                                                  firstNoticeOfLossViewModel.ClaimantBankName,
                                                                                  firstNoticeOfLossViewModel.ClaimantBankAccountNumber);

                firstNoticeOfLossEntity.Claimant_bank_accountID = bankAccountId;
            }

            if (firstNoticeOfLossViewModel.PolicyHolderExistentBankAccount)
            {
                firstNoticeOfLossEntity.Policy_holder_bank_accountID = firstNoticeOfLossViewModel.PolicyHolderForeignBankAccountId;
            }
            else
            {
                var bankAccountId = SaveBankAccountInfoHelper.SaveBankAccountInfo(_bas, firstNoticeOfLossViewModel.PolicyHolderId,
                                                                                  firstNoticeOfLossViewModel.PolicyHolderBankName,
                                                                                  firstNoticeOfLossViewModel.PolicyHolderBankAccountNumber);

                firstNoticeOfLossEntity.Policy_holder_bank_accountID = bankAccountId;
            }

            int FirstNoticeOfLossID = 0;

            try
            {
                FirstNoticeOfLossID = _fis.Add(firstNoticeOfLossEntity);
            }

            finally { }
            var lastDocumentId = _fis.LastDocumentId();

            if (invoices != null)
            {
                foreach (var file in invoices)
                {
                    lastDocumentId++;
                    if (file != null && file.ContentLength > 0)
                    {
                        string fileName = file.FileName + "_" + FirstNoticeOfLossID + "_" + lastDocumentId;
                        var    path     = @"~/DocumentsFirstNoticeOfLoss/Invoices/" + fileName;
                        file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path));

                        var document = new document();
                        document.Name = fileName;
                        var documentID = _fis.AddDocument(document);
                        _fis.AddInvoice(documentID);
                        _fis.AddDocumentToFirstNoticeOfLoss(documentID, FirstNoticeOfLossID);
                    }
                }
            }

            if (documentsHealth != null)
            {
                foreach (var file in documentsHealth)
                {
                    lastDocumentId++;
                    if (file != null && file.ContentLength > 0)
                    {
                        string fileName = file.FileName + "_" + FirstNoticeOfLossID + "_" + lastDocumentId;
                        var    path     = @"~/DocumentsFirstNoticeOfLoss/HealthInsurance/" + fileName;
                        file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path));
                        var document = new document();
                        document.Name = fileName;
                        var documentID = _fis.AddDocument(document);
                        _fis.AddDocumentToFirstNoticeOfLoss(documentID, FirstNoticeOfLossID);
                    }
                }
            }

            if (documentsLuggage != null)
            {
                foreach (var file in documentsLuggage)
                {
                    if (file != null && file.ContentLength > 0)
                    {
                        var path = @"~/DocumentsFirstNoticeOfLoss/LuggageInsurance/" + file.FileName;
                        file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(path));
                        var document = new document();
                        document.Name = file.FileName;
                        var documentID = _fis.AddDocument(document);
                        _fis.AddDocumentToFirstNoticeOfLoss(documentID, FirstNoticeOfLossID);
                    }
                }
            }
            result = FirstNoticeOfLossID;
            return(result);
        }
 public MaturityDataService(IMaturityDataRepository repo, IPolicyTypeService policyTypeServ)
 {
     _repo           = repo;
     _policyTypeServ = policyTypeServ;
 }