Beispiel #1
0
        public bool addPayKapRecipientAccount(int ACCT_ID, string ACCT_NBR, string ExrlAcctNbr1, string ExrlAcctNbr2, string ExrlAcctNbr3,
                                              string rcptUserBusinessNM, string RCPT_TCD, string RCPT_USR_NBR,
                                              int?RCPT_BUS_NBR, string RCPT_USR_BUS_TCD, string USR_NBR)
        {
            int newInsertID = 0;

            try
            {
                int bn = getBNbyManagerUsrNbr(USR_NBR);
                if (bn == 0)
                {
                    return(false);
                }

                var obj = new RecipientUserBusiness();

                obj.ACCT_ID           = ACCT_ID;
                obj.ACCT_NBR          = ACCT_NBR;
                obj.RCPT_USR_BUS1_UIN = ExrlAcctNbr1;
                obj.RCPT_USR_BUS2_UIN = ExrlAcctNbr2;
                obj.RCPT_USR_BUS3_UIN = ExrlAcctNbr3;
                obj.RCPT_USR_BUS_NM   = rcptUserBusinessNM;
                obj.RCPT_TCD          = RCPT_TCD;
                obj.RCPT_USR_NBR      = RCPT_USR_NBR;
                obj.RCPT_BUS_NBR      = RCPT_BUS_NBR;
                obj.RCPT_USR_BUS_TCD  = RCPT_USR_BUS_TCD;
                obj.USR_NBR           = USR_NBR;
                db.TRCPT_USR_BUS.Add(obj);
                db.SaveChanges();

                newInsertID = obj.RCPT_USR_BUS_ID;

                var newObj = new RecipientExternalAccountForBusiness();
                newObj.EXRL_ACCT_ID    = null;
                newObj.RCPT_USR_BUS_ID = newInsertID;
                newObj.BN = bn;
                newObj.RCPT_EXRL_ACCT_FOR_BUS_TCD = "3";
                db.TRCPT_EXRL_ACCT_FOR_BUS.Add(newObj);
                db.SaveChanges();
                return(true);
            }
            catch
            {
                if (newInsertID != 0)
                {
                    var newObj = db.TRCPT_EXRL_ACCT_FOR_BUS.Find(newInsertID);
                    if (newObj != null)
                    {
                        db.TRCPT_EXRL_ACCT_FOR_BUS.Remove(newObj);
                        db.SaveChanges();
                    }
                }
                return(false);
            }
        }
Beispiel #2
0
        //public FinancialInstitutionExternalAccount getBankRecipientByRcptID(string usrNbr, int rcptID)
        //{
        //    try
        //    {
        //        int bn = getBNbyManagerUsrNbr(usrNbr);
        //        if (bn == 0)
        //        {
        //            return null;
        //        }

        //        var rcpt = db.TFI_EXRL_ACCT.Find(rcptID);
        //        if (rcpt == null)
        //        {
        //            return null;
        //        }

        //        var checkBusList = db.TRCPT_EXRL_ACCT_FOR_BUS.Where(x => x.BN == bn && x.EXRL_ACCT_ID == rcpt.EXRL_ACCT_ID).ToList();
        //        if (checkBusList.Count() == 0)
        //        {
        //            return null;
        //        }
        //        return rcpt;
        //    }
        //    catch
        //    {
        //        return null;
        //    }
        //}

        public bool createFinancialInstitutionExternalAccount(string AcctNm, string AcctTCD, string AcctNbr,
                                                              string part1, string part2, string part3, string part4, string part5,
                                                              int partNbr, string acctVldIND, int fiCtryID,
                                                              string ExrlAcctUsrNbr, int?ExrlAcctBusNbr, string UsrBusTCD,
                                                              string crcyCD, string usrNbr, string currentUserIND,
                                                              string RCPT_EXRL_ACCT_FOR_BUS_TCD)
        {
            int newInsertID = 0;

            try
            {
                int bn = getBNbyManagerUsrNbr(usrNbr);
                if (bn == 0)
                {
                    return(false);
                }

                var newObj = new FinancialInstitutionExternalAccount();
                //just to handle error
                newObj.RCPT_EXRL_ACCT_USR_NBR = "0000000000";

                newObj.EXRL_ACCT_NM               = AcctNm;
                newObj.EXRL_ACCT_TCD              = AcctTCD;
                newObj.EXRL_ACCT_NBR              = AcctNbr;
                newObj.EXRL_ACCT_PRT1_NBR         = part1;
                newObj.EXRL_ACCT_PRT2_NBR         = part2;
                newObj.EXRL_ACCT_PRT3_NBR         = part3;
                newObj.EXRL_ACCT_PRT4_NBR         = part4;
                newObj.EXRL_ACCT_PRT5_NBR         = part5;
                newObj.EXRL_ACCT_PRT_NBR          = partNbr;
                newObj.EXRL_ACCT_VLDT_IND         = acctVldIND;
                newObj.FI_CTRY_ID                 = fiCtryID;
                newObj.CRCY_CD                    = crcyCD;
                newObj.EXRL_ACCT_USR_NBR          = ExrlAcctUsrNbr;
                newObj.EXRL_ACCT_BUS_NBR          = ExrlAcctBusNbr;
                newObj.EXRL_ACCT_USR_BUS_TCD      = UsrBusTCD;
                newObj.USR_NBR                    = usrNbr;
                newObj.EXRL_ACCT_FOR_CURT_USR_IND = currentUserIND;
                db.TFI_EXRL_ACCT.Add(newObj);
                db.SaveChanges();

                newInsertID = newObj.EXRL_ACCT_ID;

                var newObj1 = new RecipientExternalAccountForBusiness();
                newObj1.EXRL_ACCT_ID    = newInsertID;
                newObj1.RCPT_USR_BUS_ID = null;
                newObj1.BN = bn;
                newObj1.RCPT_EXRL_ACCT_FOR_BUS_TCD = RCPT_EXRL_ACCT_FOR_BUS_TCD;
                db.TRCPT_EXRL_ACCT_FOR_BUS.Add(newObj1);
                db.SaveChanges();
                return(true);
            }
            catch
            {
                if (newInsertID != 0)
                {
                    var newObj = db.TRCPT_EXRL_ACCT_FOR_BUS.Find(newInsertID);
                    if (newObj != null)
                    {
                        db.TRCPT_EXRL_ACCT_FOR_BUS.Remove(newObj);
                        db.SaveChanges();
                    }
                }
                return(false);
            }
        }