public void Updatedata(ExistingInsurance existingInsurance) { try { Logger.LogInfo("Update: Existing insurance process start"); string result = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_COUNT, existingInsurance.PID)); if (result.Equals("0")) { //Insert record DataBase.DBService.ExecuteCommand(string.Format(ADD_QUERY, existingInsurance.PID, existingInsurance.ExistingSumAssuredAmount)); } else //Update record { DataBase.DBService.ExecuteCommand(string.Format(UPDATE_QUERY, existingInsurance.ExistingSumAssuredAmount, existingInsurance.PID)); } Logger.LogInfo("Update: Existing insurance process completed."); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); } }
public ExistingInsurance GetExistingSumAssured(int plannerId) { try { Logger.LogInfo("Get: Existing insurance process start"); ExistingInsurance existingInsurance = new ExistingInsurance(); string result = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ALL, plannerId)); if (!string.IsNullOrEmpty(result)) { existingInsurance.PID = plannerId; existingInsurance.ExistingSumAssuredAmount = double.Parse(result); } Logger.LogInfo("Get: Existing insurance process completed."); return(existingInsurance); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
public Result <ExistingInsurance> GetByPlannerId(int id) { var result = new Result <ExistingInsurance>(); ExistingInsuranceService existingInsuranceService = new ExistingInsuranceService(); //result = existingInsuranceService.GetExistingSumAssured(id); ExistingInsurance insuranceResult = existingInsuranceService.GetExistingSumAssured(id); result.Value = insuranceResult; result.IsSuccess = true; return(result); }
public Result Update(ExistingInsurance existingInsurance) { var result = new Result(); try { ExistingInsuranceService existingInsuranceService = new ExistingInsuranceService(); existingInsuranceService.Updatedata(existingInsurance); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }