public void Add(LumsumInvestmentRecomendation lumsumInvestmentRecomendation)
        {
            try
            {
                DataBase.DBService.ExecuteCommand(string.Format(INSERT_LUMSUM,
                                                                lumsumInvestmentRecomendation.Pid,
                                                                lumsumInvestmentRecomendation.SchemeId,
                                                                lumsumInvestmentRecomendation.Amount,
                                                                lumsumInvestmentRecomendation.ChequeInFavourOff,
                                                                lumsumInvestmentRecomendation.FirstHolder,
                                                                lumsumInvestmentRecomendation.SecondHolder,
                                                                lumsumInvestmentRecomendation.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                lumsumInvestmentRecomendation.CreatedBy,
                                                                lumsumInvestmentRecomendation.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                lumsumInvestmentRecomendation.UpdatedBy,
                                                                lumsumInvestmentRecomendation.ThirdHolder,
                                                                lumsumInvestmentRecomendation.Nominee));

                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;
            }
        }
        public Result Delete(LumsumInvestmentRecomendation lumsumInvestmentRecomendation)
        {
            var result = new Result();

            try
            {
                LumsumInvestmentRecomendationService lumsumInvestmentRecomendationService =
                    new LumsumInvestmentRecomendationService();
                lumsumInvestmentRecomendationService.Delete(lumsumInvestmentRecomendation);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
        private LumsumInvestmentRecomendation convertToLumsumInvestmentRecomendationObject(DataRow dr)
        {
            LumsumInvestmentRecomendation lumsumInvestmentRecomendation = new LumsumInvestmentRecomendation();

            lumsumInvestmentRecomendation.Pid               = dr.Field <int>("PId");
            lumsumInvestmentRecomendation.SchemeId          = dr.Field <int>("SchemeId");
            lumsumInvestmentRecomendation.SchemeName        = dr.Field <string>("SchemeName");
            lumsumInvestmentRecomendation.Amount            = double.Parse(dr["Amount"].ToString());
            lumsumInvestmentRecomendation.Category          = dr.Field <string>("Category");
            lumsumInvestmentRecomendation.ChequeInFavourOff = dr.Field <string>("ChequeInfavourOff");
            lumsumInvestmentRecomendation.FirstHolder       = dr.Field <string>("FirstHolder");
            lumsumInvestmentRecomendation.SecondHolder      = dr.Field <string>("SecondHolder");
            lumsumInvestmentRecomendation.ThirdHolder       = dr.Field <string>("ThirdHolder");
            lumsumInvestmentRecomendation.Type              = dr.Field <string>("Type");
            lumsumInvestmentRecomendation.AMC               = dr.Field <string>("AMC");
            lumsumInvestmentRecomendation.Nominee           = dr.Field <string>("Nominee");
            return(lumsumInvestmentRecomendation);
        }
        public void Delete(LumsumInvestmentRecomendation 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 <LumsumInvestmentRecomendation> GetAll(int plannerId)
        {
            IList <LumsumInvestmentRecomendation> lumsumInvestmentRecomendations = new List <LumsumInvestmentRecomendation>();

            try
            {
                Logger.LogInfo("Get: Lumsum investment process start");
                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, plannerId));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    LumsumInvestmentRecomendation lumsumInvestmentRecomendation = convertToLumsumInvestmentRecomendationObject(dr);
                    lumsumInvestmentRecomendations.Add(lumsumInvestmentRecomendation);
                }
                Logger.LogInfo("Get: Lumsum 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);
        }