public int InsertPreMaturityApproval(PreMaturityApproval thePreMaturityApprovals)
        {
            int ReturnValue = 0;

            using (SqlCommand InsertCommand = new SqlCommand())
            {
                InsertCommand.CommandType = CommandType.StoredProcedure;
                InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output;
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApplicationID", SqlDbType.Int, thePreMaturityApprovals.PreMaturityApplicationID));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApprovalDate", SqlDbType.VarChar, thePreMaturityApprovals.PreMaturityApprovalDate));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityPrincipalPayable", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityPrincipalPayable));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityPrincipalApproved", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityPrincipalApproved));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityInterestPayable", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityInterestPayable));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityInterestApproved", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityInterestApproved));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityBonusPayable", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityBonusPayable));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityBonusApproved", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityBonusApproved));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityTotalPayable", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityTotalPayable));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityTotalPaid", SqlDbType.Decimal, thePreMaturityApprovals.PreMaturityTotalPaid));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApprovalRemark", SqlDbType.VarChar, thePreMaturityApprovals.PreMaturityApprovalRemark));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApprovedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApprovalLetterDate", SqlDbType.VarChar, thePreMaturityApprovals.PreMaturityApprovalLetterDate));
                InsertCommand.Parameters.Add(GetParameter("@PreMaturityApprovalLetterReference", SqlDbType.VarChar, thePreMaturityApprovals.PreMaturityApprovalLetterReference));
                InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID));
                InsertCommand.CommandText = "pCRM_PreMaturityApprovals_Insert";
                ExecuteStoredProcedure(InsertCommand);
                ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString());
                return(ReturnValue);
            }
        }
        public static PreMaturityApproval DataRowToObject(DataRow dr)
        {
            PreMaturityApproval ThePreMaturityApprovals = new PreMaturityApproval();

            ThePreMaturityApprovals.PreMaturityApprovalID              = int.Parse(dr["PreMaturityApprovalID"].ToString());
            ThePreMaturityApprovals.PreMaturityApplicationID           = int.Parse(dr["PreMaturityApplicationID"].ToString());
            ThePreMaturityApprovals.CustomerAccountID                  = int.Parse(dr["CustomerAccountID"].ToString());
            ThePreMaturityApprovals.CustomerAccountCode                = dr["CustomerAccountCode"].ToString();
            ThePreMaturityApprovals.CustomerName                       = dr["CustomerName"].ToString();
            ThePreMaturityApprovals.PreMaturityApprovalDate            = DateTime.Parse(dr["PreMaturityApprovalDate"].ToString()).ToString(MicroConstants.DateFormat);
            ThePreMaturityApprovals.PreMaturityPrincipalPayable        = decimal.Parse(dr["PreMaturityPrincipalPayable"].ToString());
            ThePreMaturityApprovals.PreMaturityPrincipalApproved       = decimal.Parse(dr["PreMaturityPrincipalApproved"].ToString());
            ThePreMaturityApprovals.PreMaturityInterestPayable         = decimal.Parse(dr["PreMaturityInterestPayable"].ToString());
            ThePreMaturityApprovals.PreMaturityInterestApproved        = decimal.Parse(dr["PreMaturityInterestApproved"].ToString());
            ThePreMaturityApprovals.PreMaturityBonusPayable            = decimal.Parse(dr["PreMaturityBonusPayable"].ToString());
            ThePreMaturityApprovals.PreMaturityBonusApproved           = decimal.Parse(dr["PreMaturityBonusApproved"].ToString());
            ThePreMaturityApprovals.PreMaturityTotalPayable            = decimal.Parse(dr["PreMaturityTotalPayable"].ToString());
            ThePreMaturityApprovals.PreMaturityTotalPaid               = decimal.Parse(dr["PreMaturityTotalPaid"].ToString());
            ThePreMaturityApprovals.PreMaturityApprovalRemark          = dr["PreMaturityApprovalRemark"].ToString();
            ThePreMaturityApprovals.PreMaturityApprovedBy              = int.Parse(dr["PreMaturityApprovedBy"].ToString());
            ThePreMaturityApprovals.PreMaturityApprovalLetterDate      = DateTime.Parse(dr["PreMaturityApprovalLetterDate"].ToString()).ToString(MicroConstants.DateFormat);
            ThePreMaturityApprovals.PreMaturityApprovalLetterReference = dr["PreMaturityApprovalLetterReference"].ToString();

            return(ThePreMaturityApprovals);
        }
        public static PreMaturityApproval GetPrematurityApprovalDetailsById(int PreMaturityApprovalID)
        {
            DataRow PreMaturityApprovalsRow = PreMaturityApprovalDataAccess.GetInstance.GetPrematurityApprovalDetailsById(PreMaturityApprovalID);

            PreMaturityApproval ThePreMaturityApprovals = DataRowToObject(PreMaturityApprovalsRow);

            return(ThePreMaturityApprovals);
        }
        public static List <PreMaturityApproval> GetPrematurityApprovalUnpaidList(bool allOffices = false)
        {
            List <PreMaturityApproval> ApprovalUnpaidList = new List <PreMaturityApproval>();

            DataTable GetApprovalUnpaidTable = PreMaturityApprovalDataAccess.GetInstance.GetPrematurityApprovalUnpaidList(allOffices);

            foreach (DataRow dr in GetApprovalUnpaidTable.Rows)
            {
                PreMaturityApproval TheApprovalUnpaid = DataRowToObject(dr);

                ApprovalUnpaidList.Add(TheApprovalUnpaid);
            }
            return(ApprovalUnpaidList);
        }
 public static int InsertPreMaturityApproval(PreMaturityApproval thePreMaturityApprovals)
 {
     return(PreMaturityApprovalDataAccess.GetInstance.InsertPreMaturityApproval(thePreMaturityApprovals));
 }
 public int InsertPreMaturityApproval(PreMaturityApproval thePreMaturityApprovals)
 {
     return(PreMaturityApprovalIntegration.InsertPreMaturityApproval(thePreMaturityApprovals));
 }