Пример #1
0
        public void Add(InvestmentRecommendationRatio investmentRecommendationRatio)
        {
            try
            {
                DataBase.DBService.BeginTransaction();

                DataBase.DBService.ExecuteCommandString(string.Format(DELETE_INVESTMENTRECOMMENDATIONRATIO, investmentRecommendationRatio.Pid), true);

                DataBase.DBService.ExecuteCommandString(string.Format(INSERT_INVESTMENTRATIO,
                                                                      investmentRecommendationRatio.Pid, investmentRecommendationRatio.EquityRatio,
                                                                      investmentRecommendationRatio.DebtRatio,
                                                                      investmentRecommendationRatio.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                      investmentRecommendationRatio.CreatedBy,
                                                                      investmentRecommendationRatio.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                      investmentRecommendationRatio.UpdatedBy), true);
                DataBase.DBService.CommitTransaction();

                Activity.ActivitiesService.Add(ActivityType.CreateInvestmentRecommendation, EntryStatus.Success,
                                               Source.Server, investmentRecommendationRatio.UpdatedByUserName, "Investment Ratio", investmentRecommendationRatio.MachineName);
            }
            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;
            }
        }
Пример #2
0
        private InvestmentRecommendationRatio convertToInvestmentRecommendation(DataRow dr)
        {
            InvestmentRecommendationRatio InvestmentRecommendation = new InvestmentRecommendationRatio();

            InvestmentRecommendation.Id                = dr.Field <int>("ID");
            InvestmentRecommendation.Pid               = dr.Field <int>("PID");
            InvestmentRecommendation.EquityRatio       = double.Parse(dr["EquityRatio"].ToString());
            InvestmentRecommendation.DebtRatio         = double.Parse(dr["DebtRatio"].ToString());
            InvestmentRecommendation.UpdatedBy         = dr.Field <int>("UpdatedBy");
            InvestmentRecommendation.UpdatedOn         = dr.Field <DateTime>("UpdatedOn");
            InvestmentRecommendation.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");
            return(InvestmentRecommendation);
        }
Пример #3
0
        public Result Add(InvestmentRecommendationRatio investmentRecommendationRatio)
        {
            var result = new Result();

            try
            {
                InvestmentRecommendationService investmentRecommendationService = new InvestmentRecommendationService();
                investmentRecommendationService.Add(investmentRecommendationRatio);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
Пример #4
0
        public InvestmentRecommendationRatio Get(int pid)
        {
            try
            {
                Logger.LogInfo("Get: Investment recommendation ratio process start");
                InvestmentRecommendationRatio InvestmentRecommendation = new InvestmentRecommendationRatio();

                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ID, pid));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    InvestmentRecommendation = convertToInvestmentRecommendation(dr);
                }
                Logger.LogInfo("Get: Investment recommendation ratio process completed");
                return(InvestmentRecommendation);
            }
            catch (Exception ex)
            {
                StackTrace st = new StackTrace();
                StackFrame sf = st.GetFrame(0);
                MethodBase currentMethodName = sf.GetMethod();
                LogDebug(currentMethodName.Name, ex);
                return(null);
            }
        }