public void Add(NPS NPS) { try { string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ID, NPS.Id)); DataBase.DBService.BeginTransaction(); DataBase.DBService.ExecuteCommandString(string.Format(INSERT_NPS, NPS.Pid, NPS.InvesterName, NPS.SchemeName, NPS.FolioNo, NPS.Nav, NPS.Units, NPS.EquityRatio, NPS.GoldRatio, NPS.DebtRatio, NPS.SIP, NPS.GoalID, NPS.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), NPS.CreatedBy, NPS.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), NPS.UpdatedBy, NPS.InvestmentReturnRate), true); Activity.ActivitiesService.Add(ActivityType.CreateNPS, EntryStatus.Success, Source.Server, NPS.UpdatedByUserName, "NPS", NPS.MachineName); DataBase.DBService.CommitTransaction(); } catch (Exception ex) { DataBase.DBService.RollbackTransaction(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); throw ex; } }
public IList <NPS> GetAll(int plannerId) { try { Logger.LogInfo("Get: NPS process start"); IList <NPS> lstNPSOption = new List <NPS>(); DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, plannerId)); foreach (DataRow dr in dtAppConfig.Rows) { NPS mf = convertToNPS(dr); lstNPSOption.Add(mf); } Logger.LogInfo("Get: NPS fund process completed."); return(lstNPSOption); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
private NPS convertToNPS(DataRow dr) { NPS NPS = new NPS(); NPS.Id = dr.Field <int>("ID"); NPS.Pid = dr.Field <int>("PID"); NPS.InvesterName = dr.Field <string>("InvesterName"); NPS.SchemeName = dr.Field <string>("SchemeName"); NPS.FolioNo = dr.Field <string>("FolioNo"); NPS.Nav = float.Parse(dr["NAV"].ToString()); NPS.Units = dr.Field <int>("units"); NPS.EquityRatio = float.Parse(dr["EquityRatio"].ToString()); NPS.GoldRatio = float.Parse(dr["GoldRatio"].ToString()); NPS.DebtRatio = float.Parse(dr["DebtRatio"].ToString()); NPS.SIP = double.Parse(dr["SIP"].ToString()); NPS.GoalID = dr.Field <int>("GoalId"); NPS.UpdatedBy = dr.Field <int>("UpdatedBy"); NPS.UpdatedOn = dr.Field <DateTime>("UpdatedOn"); NPS.UpdatedByUserName = dr.Field <string>("UpdatedByUserName"); NPS.GoalID = dr.Field <int>("GoalId"); NPS.UpdatedBy = dr.Field <int>("UpdatedBy"); NPS.UpdatedOn = dr.Field <DateTime>("UpdatedOn"); NPS.UpdatedByUserName = dr.Field <string>("UpdatedByUserName"); NPS.InvestmentReturnRate = float.Parse(dr["InvestmentReturnRate"].ToString()); return(NPS); }
public Result Delete(NPS mf) { var result = new Result(); try { NPSService NPSService = new NPSService(); NPSService.Delete(mf); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }
internal bool Update(NPS NPS) { try { FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization(); string apiurl = Program.WebServiceUrl + "/" + UPDATE_NPS_API; RestAPIExecutor restApiExecutor = new RestAPIExecutor(); var restResult = restApiExecutor.Execute <NPS>(apiurl, NPS, "POST"); return(true); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(false); } }
public NPS Get(int id) { try { Logger.LogInfo("Get: NPS by id process start"); NPS NPS = new NPS(); DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ID, id)); foreach (DataRow dr in dtAppConfig.Rows) { NPS = convertToNPS(dr); } Logger.LogInfo("Get: NPS by id process completed"); return(NPS); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
public void Delete(NPS NPS) { try { string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ID, NPS.Id)); DataBase.DBService.BeginTransaction(); DataBase.DBService.ExecuteCommandString(string.Format(DELETE_NPS, NPS.Id), true); Activity.ActivitiesService.Add(ActivityType.DeleteNPS, EntryStatus.Success, Source.Server, NPS.UpdatedByUserName, "NPS", NPS.MachineName); DataBase.DBService.CommitTransaction(); } catch (Exception ex) { DataBase.DBService.RollbackTransaction(); StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); throw ex; } }