public void Add(STPTypeInvestmentRecomendation lumsumInvestmentRecomendation)
        {
            try
            {
                //string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, lumsumInvestmentRecomendation.Pid));

                DataBase.DBService.ExecuteCommand(string.Format(INSERT_QUERY,
                                                                lumsumInvestmentRecomendation.Pid,
                                                                lumsumInvestmentRecomendation.FromSchemeId,
                                                                lumsumInvestmentRecomendation.SchemeId,
                                                                lumsumInvestmentRecomendation.Amount,
                                                                lumsumInvestmentRecomendation.Duration,
                                                                lumsumInvestmentRecomendation.Frequency,
                                                                lumsumInvestmentRecomendation.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                lumsumInvestmentRecomendation.CreatedBy,
                                                                lumsumInvestmentRecomendation.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                lumsumInvestmentRecomendation.UpdatedBy));

                Activity.ActivitiesService.Add(ActivityType.CreateInvestmentRecommendation, EntryStatus.Success,
                                               Source.Server, lumsumInvestmentRecomendation.UpdatedByUserName, lumsumInvestmentRecomendation.SchemeName, lumsumInvestmentRecomendation.MachineName);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                throw ex;
            }
        }
        private STPTypeInvestmentRecomendation convertToSTPInvestmentRecomendationObject(DataRow dr)
        {
            STPTypeInvestmentRecomendation stpTypeInvestmentRecommendation = new STPTypeInvestmentRecomendation();

            stpTypeInvestmentRecommendation.Pid            = dr.Field <int>("PId");
            stpTypeInvestmentRecommendation.FromSchemeId   = dr.Field <int>("FromSchemeId");
            stpTypeInvestmentRecommendation.FromSchemeName = dr.Field <string>("FromSchemeName");
            stpTypeInvestmentRecommendation.SchemeId       = dr.Field <int>("ToSchemeId");
            stpTypeInvestmentRecommendation.SchemeName     = getSchemeName(stpTypeInvestmentRecommendation.SchemeId);
            stpTypeInvestmentRecommendation.Amount         = double.Parse(dr["Amount"].ToString());
            stpTypeInvestmentRecommendation.Duration       = dr.Field <int>("Duration");
            stpTypeInvestmentRecommendation.Frequency      = dr.Field <string>("Frequency");
            return(stpTypeInvestmentRecommendation);
        }
Пример #3
0
        public Result Delete(STPTypeInvestmentRecomendation lumsumInvestmentRecomendation)
        {
            var result = new Result();

            try
            {
                STPInvestmentRecomendationService sTPInvestmentRecomendationService =
                    new STPInvestmentRecomendationService();
                sTPInvestmentRecomendationService.Delete(lumsumInvestmentRecomendation);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
        public void Delete(STPTypeInvestmentRecomendation lumsumInvestmentRecomendation)
        {
            try
            {
                string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(GET_CLIENT_NAME_QUERY, lumsumInvestmentRecomendation.Pid));

                DataBase.DBService.ExecuteCommand(string.Format(DELETE_QUERY,
                                                                lumsumInvestmentRecomendation.Pid, lumsumInvestmentRecomendation.SchemeId, lumsumInvestmentRecomendation.Amount));

                Activity.ActivitiesService.Add(ActivityType.DeleteInvestmentRecommendation, EntryStatus.Success,
                                               Source.Server, lumsumInvestmentRecomendation.UpdatedByUserName, lumsumInvestmentRecomendation.SchemeName,
                                               lumsumInvestmentRecomendation.MachineName);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                throw ex;
            }
        }
        public IList <STPTypeInvestmentRecomendation> GetAll(int plannerId)
        {
            IList <STPTypeInvestmentRecomendation> lumsumInvestmentRecomendations = new List <STPTypeInvestmentRecomendation>();

            try
            {
                Logger.LogInfo("Get: STP investment process start");
                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, plannerId));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    STPTypeInvestmentRecomendation lumsumInvestmentRecomendation = convertToSTPInvestmentRecomendationObject(dr);
                    lumsumInvestmentRecomendations.Add(lumsumInvestmentRecomendation);
                }
                Logger.LogInfo("Get: STP investment process completed.");
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
            }
            return(lumsumInvestmentRecomendations);
        }