public IList <CurrentStatusToGoal> Get(int id, int planId) { try { Logger.LogInfo("Get: Current status fund allocation process start"); IList <CurrentStatusToGoal> currentStatusToGoals = new List <CurrentStatusToGoal>(); CurrentStatusToGoal currentStatusToGoal = new CurrentStatusToGoal(); DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ID, id, planId)); foreach (DataRow dr in dtAppConfig.Rows) { currentStatusToGoal = convertToCurrentStatusToGoal(dr); currentStatusToGoals.Add(currentStatusToGoal); } Logger.LogInfo("Get: Current status fund allocation process completed"); return(currentStatusToGoals); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(null); } }
public void Update(CurrentStatusToGoal CurrentStatusToGoal) { try { // string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ID,CurrentStatusToGoal.PlannerId)); DataBase.DBService.BeginTransaction(); DataBase.DBService.ExecuteCommandString(string.Format(UPDATE_CurrentStatusToGoal, CurrentStatusToGoal.FundAllocation, CurrentStatusToGoal.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), CurrentStatusToGoal.UpdatedBy, CurrentStatusToGoal.OptionId, CurrentStatusToGoal.Id), true); Activity.ActivitiesService.Add(ActivityType.UpdateCurrentStatusToGoal, EntryStatus.Success, Source.Server, CurrentStatusToGoal.UpdatedByUserName, "CurrentStatusToGoal", CurrentStatusToGoal.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; } }
private CurrentStatusToGoal convertToCurrentStatusToGoal(DataRow dr) { CurrentStatusToGoal currentStatusToGoal = new CurrentStatusToGoal(); currentStatusToGoal.Id = dr.Field <int>("ID"); currentStatusToGoal.OptionId = dr.Field <int>("OId"); currentStatusToGoal.PlannerId = dr.Field <int>("PId"); currentStatusToGoal.GoalName = dr.Field <string>("GoalName"); currentStatusToGoal.FundAllocation = double.Parse(dr["FundAllocation"].ToString()); currentStatusToGoal.GoalId = dr.Field <int>("GoalId"); currentStatusToGoal.UpdatedBy = dr.Field <int>("UpdatedBy"); currentStatusToGoal.UpdatedOn = dr.Field <DateTime>("UpdatedOn"); currentStatusToGoal.UpdatedByUserName = dr.Field <string>("UpdatedByUserName"); return(currentStatusToGoal); }
public Result Update(CurrentStatusToGoal CurrentStatusToGoal) { var result = new Result(); try { CurrentStatusToGoalService CurrentStatusToGoalService = new CurrentStatusToGoalService(); CurrentStatusToGoalService.Update(CurrentStatusToGoal); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }