public object search(string query) { try { return(CoverMdl.search_covers(query)); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
public object lov() { try { return(CoverMdl.get_lov_covers()); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
// GET: api/cover/ public dynamic Get(string code) { try { return(CoverMdl.get_cover(code)); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
public object Check(string code) { try { var result = CoverMdl.get_cover(code); return(result != null ? (object)new { state = true, name = result.CVR_NAME } : new { state = false }); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
public object save([FromBody] List <MS_UDW_COVERS> covers) { try { foreach (var cty in covers) { CoverMdl.save_cover(cty); } return(new { state = true, message = "Covers Successfully Created" }); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
public object getDeftCovers(MotorRisksCoversJSON defCoversJson) { /*--------------------------------------------------------------- * logic for cover premium calculation * 1. use product risk code to fetch default covers * 2. check if the cover for the product and risk is defaulted * 3. fetch premium calc details from the preium tarrif table for the cover * 4. calc the premium for the covers */ //var MotorRisks = MotorRisksCoversMdl.get_MotorRisks(tarrifJson.PRD_CODE, tarrifJson.RISK_SYS_ID); var riskCovers = MotorRisksCoversMdl.GetMotorRiskCovers(defCoversJson.PROD_RISK_SYS_ID); var rskCoverList = new List <INS_UWD_RISK_COVERS>(); // var motorRskCoverList = new List <motorRiskCoversJSON>(); foreach (var cover in riskCovers) { if (cover.MRC_DFT_YN == "Y") { //var tarrif = CoverPremiumCalculationMdl.GetCoverTarrifs(tarifJson.PRD_CODE, tarrifJson.RSK_CODE, cover.PCV_COV_CODE); var ExRate = defCoversJson.CUR_RATE; var annlPremium = cover.MRC_DFT_PREM; // var Premium = 0.00; switch (defCoversJson.PREM_BASIS) { case "PR": cover.MRC_DFT_PREM = cover.MRC_DFT_PREM * (decimal)(defCoversJson.POL_DAYS / 365.00); break; case "SP": //obtain the var db = new SibaModel(); var period = db.MS_UDW_SHORT_PERIOD.Where(p => p.SPD_NO_OF_DAYS == defCoversJson.POL_DAYS && p.SPD_PRD_CODE == defCoversJson.PRD_CODE).ToList().FirstOrDefault(); if (period != null) { cover.MRC_DFT_PREM = cover.MRC_DFT_PREM * (decimal)(period.SPD_RATE_PERC / (decimal)100.00); } break; //case "FP": // break; } if (ExRate.ToString() == "") { ExRate = 1; } if (cover != null) { var seq = MotorRisksCoversMdl.GetRiskCoverSeq(); rskCoverList.Add(new INS_UWD_RISK_COVERS { RCOV_CODE = cover.MRC_CVR_CODE, //return cover code and name MS_UDW_COVERS = new MS_UDW_COVERS { CVR_CODE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_CODE, CVR_NAME = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_NAME, CVR_TYPE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_TYPE, CVR_PREM_REFUND = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_PREM_REFUND, CVR_LEVELS = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_LEVELS, CVR_RATED = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RATED, CVR_RATE_CHANGE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RATE_CHANGE, CVR_RI_APPLICABLE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RI_APPLICABLE, CVR_SI_CHANGE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_SI_CHANGE, CVR_USER_PREMIUM = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_USER_PREMIUM, CVR_BASIC_COVER = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_BASIC_COVER }, RCOV_DISC_BC = 0, //todo: build logic to calculate base currency discounts for default covers RCOV_DISC_FC = 0, //todo: build logic to calculate foreign currency discounts for default covers RCOV_LOAD_BC = 0, //todo: build logic to calculate base currency loading for default covers RCOV_LOAD_FC = 0, //todo: build logic to calculate foreign currency loading for default covers RCOV_ANNL_PREM_BC = Math.Round((decimal)(annlPremium), 2), RCOV_ANNL_PREM_FC = Math.Round((decimal)(annlPremium / defCoversJson.CUR_RATE), 2), RCOV_GROSS_PREM_BC = Math.Round((decimal)(cover.MRC_DFT_PREM), 2), RCOV_GROSS_PREM_FC = Math.Round((decimal)(cover.MRC_DFT_PREM / defCoversJson.CUR_RATE), 2), RCOV_DISC_YN = "N", RCOV_LOAD_YN = "N", RCOV_NET_PREM_BC = Math.Round((decimal)((cover.MRC_DFT_PREM - 0 + 0) * 1), 2), RCOV_NET_PREM_FC = Math.Round((decimal)((cover.MRC_DFT_PREM / defCoversJson.CUR_RATE - 0 + 0) / 1), 2), RCOV_NO = 0, RCOV_RATE = cover.MRC_DFT_RATE, RCOV_RISK_NO = 0, RCOV_RISK_SYS_ID = 0, RCOV_POLH_DOC_NO = 0, RCOV_RI_PREM_YN = "", RCOV_RI_SI_YN = "", RCOV_SI_BC = cover.MRC_DFT_SI, RCOV_SI_FC = Math.Round((decimal)(cover.MRC_DFT_SI / defCoversJson.CUR_RATE), 2), RCOV_SYS_ID = (int)seq, RCOV_STATUS = "U", RCOV_TXN_STATE = "N", RCOV_TYPE = "", RPCOV_END_NO = 0, RCOV_CRTE_BY = "", RCOV_CRTE_DATE = DateTime.Now.Date, RCOV_MOD_BY = "", RCOV_MOD_DATE = null, }); } } } return(new { DEFAULT_COVERS = rskCoverList, SEAT_COVERS = riskCovers.Where(c => c.MRC_MIN_SEATS != null && c.MRC_SEAT_LOAD != null).ToList() }); }
public IEnumerable <INS_UWD_RISK_COVERS> AdditionalCovers(MotorRisksCoversJSON addCoversJson) { /*--------------------------------------------------------------- * logic for cover premium calculation * 1. use product risk code to fetch default covers * 2. check if the cover for the product and risk is defaulted * 3. fetch premium calc details from the preium tarrif table for the cover * 4. calc the premium for the covers */ var riskCovers = MotorRisksCoversMdl.GetAdditionalCovers(addCoversJson.PROD_RISK_SYS_ID, addCoversJson.RCOV_CODE); var rskCoverList = new List <INS_UWD_RISK_COVERS>(); foreach (var cover in riskCovers) { if (cover != null) { var seq = MotorRisksCoversMdl.GetRiskCoverSeq(); rskCoverList.Add(new INS_UWD_RISK_COVERS { RCOV_CODE = cover.MRC_CVR_CODE, MS_UDW_COVERS = new MS_UDW_COVERS { CVR_CODE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_CODE, CVR_NAME = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_NAME, CVR_TYPE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_TYPE, CVR_PREM_REFUND = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_PREM_REFUND, CVR_LEVELS = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_LEVELS, CVR_RATED = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RATED, CVR_RATE_CHANGE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RATE_CHANGE, CVR_RI_APPLICABLE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_RI_APPLICABLE, CVR_SI_CHANGE = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_SI_CHANGE, CVR_USER_PREMIUM = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_USER_PREMIUM, CVR_BASIC_COVER = CoverMdl.get_cover(cover.MRC_CVR_CODE).CVR_BASIC_COVER }, RCOV_DISC_BC = 0, //todo: build logic to calculate base currency discounts for default covers RCOV_DISC_FC = 0, //todo: build logic to calculate foreign currency discounts for default covers RCOV_LOAD_BC = 0, //todo: build logic to calculate base currency loading for default covers RCOV_LOAD_FC = 0, //todo: build logic to calculate foreign currency loading for default covers RCOV_GROSS_PREM_BC = Math.Round((decimal)(cover.MRC_DFT_PREM), 2), RCOV_GROSS_PREM_FC = Math.Round((decimal)(cover.MRC_DFT_PREM / addCoversJson.CUR_RATE), 2), RCOV_DISC_YN = "N", RCOV_LOAD_YN = "N", RCOV_NET_PREM_BC = Math.Round((decimal)((cover.MRC_DFT_PREM - 0 + 0) * 1), 2), RCOV_NET_PREM_FC = Math.Round((decimal)((cover.MRC_DFT_PREM / addCoversJson.CUR_RATE - 0 + 0) / 1), 2), RCOV_NO = 0, RCOV_RATE = cover.MRC_DFT_RATE, RCOV_RISK_NO = 0, RCOV_RISK_SYS_ID = 0, RCOV_POLH_DOC_NO = 0, RCOV_RI_PREM_YN = "", RCOV_RI_SI_YN = "", RCOV_SI_BC = cover.MRC_DFT_SI, RCOV_SI_FC = Math.Round((decimal)(cover.MRC_DFT_SI / addCoversJson.CUR_RATE), 2), RCOV_SYS_ID = (int)seq, RCOV_STATUS = "", RCOV_TXN_STATE = "U", RCOV_TYPE = "", RPCOV_END_NO = 0, RCOV_CRTE_BY = "", RCOV_CRTE_DATE = DateTime.Now.Date, RCOV_MOD_BY = "", RCOV_MOD_DATE = null }); } } return(rskCoverList); }
public object getHownrsDeftCovers([FromBody] RisksCoversJSON defCoversJson) { try { /*--------------------------------------------------------------- * logic for cover premium calculation * 1. use product risk code to fetch default covers * 2. check if the cover for the product and risk is defaulted * 3. fetch premium calc details from the preium tarrif table for the cover * 4. calc the premium for the covers */ //var MotorRisks = MotorRisksCoversMdl.get_MotorRisks(tarrifJson.PRD_CODE, tarrifJson.RISK_SYS_ID); var riskCovers = RisksCoversMdl.GetHomeOwnersCovers(defCoversJson.HOWNRS_CODE); var rskCoverList = new List <INS_UWD_RISK_COVERS>(); if (riskCovers != null) { foreach (var cover in riskCovers) { if (cover.HCV_DFT == "Y") { //var tarrif = CoverPremiumCalculationMdl.GetCoverTarrifs(tarrifJson.PRD_CODE, tarrifJson.RSK_CODE, cover.PCV_COV_CODE); // decimal ExRate = defCoversJson.CUR_RATE; //if (ExRate.ToString() == "") //{ // ExRate = 1; //} if (cover != null) { var seq = RisksCoversMdl.GetRiskCoverSeq(); rskCoverList.Add(new INS_UWD_RISK_COVERS { RCOV_CODE = cover.HCV_COV_CODE, //return cover code and name MS_UDW_COVERS = new MS_UDW_COVERS { CVR_CODE = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_CODE, CVR_NAME = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_NAME, CVR_TYPE = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_TYPE, CVR_PREM_REFUND = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_PREM_REFUND, CVR_LEVELS = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_LEVELS, CVR_RATED = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_RATED, CVR_RATE_CHANGE = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_RATE_CHANGE, CVR_RI_APPLICABLE = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_RI_APPLICABLE, CVR_SI_CHANGE = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_SI_CHANGE, CVR_USER_PREMIUM = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_USER_PREMIUM, CVR_BASIC_COVER = CoverMdl.get_cover(cover.HCV_COV_CODE).CVR_BASIC_COVER }, RCOV_DISC_BC = 0, //todo: build logic to calculate base currency discounts for default covers RCOV_DISC_FC = 0, //todo: build logic to calculate foreign currency discounts for default covers RCOV_LOAD_BC = 0, //todo: build logic to calculate base currency loading for default covers RCOV_LOAD_FC = 0, //todo: build logic to calculate foreign currency loading for default covers RCOV_GROSS_PREM_BC = Math.Round((decimal)(cover.HCV_DEF_PREM), 2), RCOV_GROSS_PREM_FC = Math.Round((decimal)(cover.HCV_DEF_PREM / defCoversJson.CUR_RATE), 2), RCOV_DISC_YN = "N", RCOV_LOAD_YN = "N", RCOV_NET_PREM_BC = Math.Round((decimal)((cover.HCV_DEF_PREM - 0 + 0) * 1), 2), RCOV_NET_PREM_FC = Math.Round((decimal)((cover.HCV_DEF_PREM / defCoversJson.CUR_RATE - 0 + 0) / 1), 2), RCOV_NO = 0, RCOV_RATE = cover.HCV_DEF_RATE, RCOV_RISK_NO = 0, RCOV_RISK_SYS_ID = 0, RCOV_POLH_DOC_NO = 0, RCOV_RI_PREM_YN = "", RCOV_RI_SI_YN = "", RCOV_SI_BC = cover.HCV_SI, RCOV_SI_FC = Math.Round((decimal)(cover.HCV_SI / defCoversJson.CUR_RATE), 2), RCOV_SYS_ID = Convert.ToInt32(Math.Round(seq)), RCOV_STATUS = "U", RCOV_TXN_STATE = "N", RCOV_TYPE = "", RPCOV_END_NO = 0, RCOV_CRTE_BY = "", RCOV_CRTE_DATE = DateTime.Now.Date, RCOV_MOD_BY = "", RCOV_MOD_DATE = null, }); } } } } return(rskCoverList); } catch (Exception e) { return(new { state = false, message = "Server Error", exception = e }); } }
public Object AdditionalCovers([FromBody] RisksCoversJSON addCoversJson) { try { /*--------------------------------------------------------------- * logic for cover premium calculation * 1. use product risk code to fetch default covers * 2. check if the cover for the product and risk is defaulted * 3. fetch premium calc details from the preium tarrif table for the cover * 4. calc the premium for the covers */ var riskCovers = RisksCoversMdl.GetAdditionalProductCovers(addCoversJson.PRD_CODE, addCoversJson.RCOV_CODE); var rskCoverList = new List <INS_UWD_RISK_COVERS>(); foreach (var cover in riskCovers) { if (cover != null) { var seq = RisksCoversMdl.GetRiskCoverSeq(); rskCoverList.Add(new INS_UWD_RISK_COVERS { RCOV_CODE = cover.PCV_COV_CODE, MS_UDW_COVERS = new MS_UDW_COVERS { CVR_CODE = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_CODE, CVR_NAME = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_NAME, CVR_TYPE = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_TYPE, CVR_PREM_REFUND = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_PREM_REFUND, CVR_LEVELS = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_LEVELS, CVR_RATED = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_RATED, CVR_RATE_CHANGE = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_RATE_CHANGE, CVR_RI_APPLICABLE = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_RI_APPLICABLE, CVR_SI_CHANGE = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_SI_CHANGE, CVR_USER_PREMIUM = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_USER_PREMIUM, CVR_BASIC_COVER = CoverMdl.get_cover(cover.PCV_COV_CODE).CVR_BASIC_COVER }, RCOV_DISC_BC = 0, //todo: build logic to calculate base currency discounts for default covers RCOV_DISC_FC = 0, //todo: build logic to calculate foreign currency discounts for default covers RCOV_LOAD_BC = 0, //todo: build logic to calculate base currency loading for default covers RCOV_LOAD_FC = 0, //todo: build logic to calculate foreign currency loading for default covers //RCOV_GROSS_PREM_BC = cover.PCV_DEF_PREM, //RCOV_GROSS_PREM_FC = cover.PCV_DEF_PREM, RCOV_GROSS_PREM_BC = Math.Round((decimal)(cover.PCV_DEF_PREM), 2), RCOV_GROSS_PREM_FC = Math.Round((decimal)(cover.PCV_DEF_PREM / addCoversJson.CUR_RATE), 2), RCOV_DISC_YN = "N", RCOV_LOAD_YN = "N", RCOV_NET_PREM_BC = Math.Round((decimal)((cover.PCV_DEF_PREM - 0 + 0) * 1), 2), RCOV_NET_PREM_FC = Math.Round((decimal)((cover.PCV_DEF_PREM / addCoversJson.CUR_RATE - 0 + 0) / 1), 2), //RCOV_NET_PREM_BC = cover.PCV_DEF_PREM, //RCOV_NET_PREM_FC = cover.PCV_DEF_PREM, RCOV_NO = 0, RCOV_RATE = cover.PCV_DEF_RATE, RCOV_RISK_NO = 0, RCOV_RISK_SYS_ID = 0, RCOV_POLH_DOC_NO = 0, RCOV_RI_PREM_YN = "", RCOV_RI_SI_YN = "", RCOV_SI_BC = cover.PCV_SI, //RCOV_SI_FC = cover.PCV_SI, RCOV_SI_FC = Math.Round((decimal)(cover.PCV_SI / addCoversJson.CUR_RATE), 2), RCOV_SYS_ID = Convert.ToInt32(Math.Round(seq)), RCOV_STATUS = "U", RCOV_TXN_STATE = "N", RCOV_TYPE = "", RPCOV_END_NO = 0, RCOV_CRTE_BY = "", RCOV_CRTE_DATE = DateTime.Now.Date, RCOV_MOD_BY = "", RCOV_MOD_DATE = null, }); } } return(rskCoverList); } catch (Exception e) { return(new { state = false, message = "Server Error", Exception = e }); } }