public IList <PPF> GetAll(int plannerId)
        {
            try
            {
                Logger.LogInfo("Get: PPF process start");
                IList <PPF> lstPPFOption = new List <PPF>();

                DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_ALL, plannerId));
                foreach (DataRow dr in dtAppConfig.Rows)
                {
                    PPF mf = convertToPPF(dr);
                    lstPPFOption.Add(mf);
                }
                Logger.LogInfo("Get: PPF fund process completed.");
                return(lstPPFOption);
            }
            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(PPF ppf)
        {
            try
            {
                string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ID, ppf.Id));

                DataBase.DBService.BeginTransaction();
                DataBase.DBService.ExecuteCommandString(string.Format(UPDATE_PPF,
                                                                      ppf.InvesterName,
                                                                      ppf.AccountNo,
                                                                      ppf.Bank,
                                                                      ppf.OpeningDate.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                      ppf.MaturityDate.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                      ppf.CurrentValue,
                                                                      (ppf.GoalId == null) ? null : ppf.GoalId.Value.ToString(),
                                                                      ppf.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"),
                                                                      ppf.UpdatedBy, ppf.InvestmentReturnRate,
                                                                      ppf.IsAccountExtended,
                                                                      ppf.Id), true);

                Activity.ActivitiesService.Add(ActivityType.UpdatePPF, EntryStatus.Success,
                                               Source.Server, ppf.UpdatedByUserName, ppf.AccountNo, ppf.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;
            }
        }
Ejemplo n.º 3
0
        void EditParametersbuttonClick(object sender, EventArgs e)
        {
            ProtocolParametersForm PPF;

            if (UserControlProtocolParameters == null)
            {
                PPF = new ProtocolParametersForm(this, UserControlProtocolType);
            }
            else
            {
                PPF = new ProtocolParametersForm(this, UserControlProtocolParameters);
            }
            PPF.ShowDialog();
        }
Ejemplo n.º 4
0
        public Result Delete(PPF PPF)
        {
            var result = new Result();

            try
            {
                PPFService PPFService = new PPFService();
                PPFService.Delete(PPF);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }
            return(result);
        }
 internal bool Update(PPF PPF)
 {
     try
     {
         FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
         string          apiurl          = Program.WebServiceUrl + "/" + UPDATE_PPF_API;
         RestAPIExecutor restApiExecutor = new RestAPIExecutor();
         var             restResult      = restApiExecutor.Execute <PPF>(apiurl, PPF, "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);
     }
 }
        private PPF convertToPPF(DataRow dr)
        {
            PPF PPF = new PPF();

            PPF.Id                   = dr.Field <int>("ID");
            PPF.Pid                  = dr.Field <int>("PID");
            PPF.InvesterName         = dr.Field <string>("InvesterName");
            PPF.AccountNo            = dr.Field <string>("AccountNo");
            PPF.Bank                 = dr.Field <string>("Bank");
            PPF.OpeningDate          = dr.Field <DateTime>("OpeningDate");
            PPF.CurrentValue         = Double.Parse(dr["CurrentValue"].ToString());
            PPF.MaturityDate         = dr.Field <DateTime>("MaturityDate");
            PPF.GoalId               = dr.Field <int>("GoalId");
            PPF.UpdatedBy            = dr.Field <int>("UpdatedBy");
            PPF.UpdatedOn            = dr.Field <DateTime>("UpdatedOn");
            PPF.UpdatedByUserName    = dr.Field <string>("UpdatedByUserName");
            PPF.UpdatedBy            = dr.Field <int>("UpdatedBy");
            PPF.UpdatedOn            = dr.Field <DateTime>("UpdatedOn");
            PPF.UpdatedByUserName    = dr.Field <string>("UpdatedByUserName");
            PPF.InvestmentReturnRate = float.Parse(dr["InvestmentReturnRate"].ToString());
            PPF.IsAccountExtended    = dr["AccountExtended"] == System.DBNull.Value   ? false : dr.Field <bool>("AccountExtended");
            return(PPF);
        }
        public void Delete(PPF ppf)
        {
            try
            {
                string clientName = DataBase.DBService.ExecuteCommandScalar(string.Format(SELECT_ID, ppf.Id));

                DataBase.DBService.BeginTransaction();
                DataBase.DBService.ExecuteCommandString(string.Format(DELETE_PPF,
                                                                      ppf.Id), true);

                Activity.ActivitiesService.Add(ActivityType.DeletePPF, EntryStatus.Success,
                                               Source.Server, ppf.UpdatedByUserName, ppf.AccountNo, ppf.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 PPF Get(int id)
        {
            try
            {
                Logger.LogInfo("Get: PPF by id process start");
                PPF PPF = new PPF();

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