Exemplo n.º 1
0
        public static bool InsertUpdateEFT(Models.EFTInfoDto eftInfo)
        {
            try
            {
                bool success = false;

                if (VendorEFTExists(eftInfo.Vendorid, eftInfo.Adrscode))
                {
                    success = UpdateEFT(eftInfo);
                }
                else
                {
                    success = InsertEFT(eftInfo);
                }

                return(success);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public static bool UpdateEFT(Models.EFTInfoDto eftInfo)
        {
            string commandText = "UPDATE SY06000 SET ";

            commandText += "EFTUseMasterID = @EFTUseMasterID, EFTBankType = @EFTBankType, FRGNBANK = @FRGNBANK, ";
            commandText += "INACTIVE = @INACTIVE, BANKNAME = @BANKNAME, EFTBankAcct = @EFTBankAcct, EFTBankBranch = @EFTBankBranch, ";
            commandText += "GIROPostType = @GIROPostType, EFTBankCode = @EFTBankCode, EFTBankBranchCode = @EFTBankBranchCode, ";
            commandText += "EFTBankCheckDigit = @EFTBankCheckDigit, BSROLLNO = @BSROLLNO, IntlBankAcctNum = @IntlBankAcctNum, ";
            commandText += "SWIFTADDR = @SWIFTADDR, CustVendCountryCode = @CustVendCountryCode, DeliveryCountryCode = @DeliveryCountryCode, ";
            commandText += "BNKCTRCD = @BNKCTRCD, CBANKCD = @CBANKCD, ADDRESS1 = @ADDRESS1, ADDRESS2 = @ADDRESS2, ADDRESS3 = @ADDRESS3, ";
            commandText += "ADDRESS4 = @ADDRESS4, RegCode1 = @RegCode1, RegCode2 = @RegCode2, BankInfo7 = @BankInfo7, ";
            commandText += "EFTTransitRoutingNo = @EFTTransitRoutingNo, CURNCYID = @CURNCYID, EFTTransferMethod = @EFTTransferMethod, ";
            commandText += "EFTAccountType = @EFTAccountType ";             // EFTPrenoteDate = @EFTPrenoteDate, EFTTerminationDate = @EFTTerminationDate ";
            commandText += "WHERE SERIES = 4 AND VENDORID = @VENDORID AND ADRSCODE = @ADRSCODE";

            SqlParameter[] sqlParameters = new SqlParameter[31];

            sqlParameters[0]        = new SqlParameter("@VENDORID", SqlDbType.VarChar, 15);
            sqlParameters[0].Value  = eftInfo.Vendorid;
            sqlParameters[1]        = new SqlParameter("@ADRSCODE", SqlDbType.VarChar, 15);
            sqlParameters[1].Value  = eftInfo.Adrscode;
            sqlParameters[2]        = new SqlParameter("@EFTUseMasterID", SqlDbType.SmallInt);
            sqlParameters[2].Value  = eftInfo.EftuseMasterId;
            sqlParameters[3]        = new SqlParameter("@EFTBankType", SqlDbType.SmallInt);
            sqlParameters[3].Value  = eftInfo.EftbankType;
            sqlParameters[4]        = new SqlParameter("@FRGNBANK", SqlDbType.TinyInt);
            sqlParameters[4].Value  = eftInfo.Frgnbank;
            sqlParameters[5]        = new SqlParameter("@INACTIVE", SqlDbType.TinyInt);
            sqlParameters[5].Value  = eftInfo.Inactive;
            sqlParameters[6]        = new SqlParameter("@BANKNAME", SqlDbType.VarChar, 31);
            sqlParameters[6].Value  = eftInfo.Bankname;
            sqlParameters[7]        = new SqlParameter("@EFTBankAcct", SqlDbType.VarChar, 35);
            sqlParameters[7].Value  = eftInfo.EftbankAcct;
            sqlParameters[8]        = new SqlParameter("@EFTBankBranch", SqlDbType.VarChar, 15);
            sqlParameters[8].Value  = eftInfo.EftbankBranch;
            sqlParameters[9]        = new SqlParameter("@GIROPostType", SqlDbType.SmallInt);
            sqlParameters[9].Value  = eftInfo.GiropostType;
            sqlParameters[10]       = new SqlParameter("@EFTBankCode", SqlDbType.VarChar, 15);
            sqlParameters[10].Value = eftInfo.EftbankCode;
            sqlParameters[11]       = new SqlParameter("@EFTBankBranchCode", SqlDbType.VarChar, 5);
            sqlParameters[11].Value = eftInfo.EftbankBranchCode;
            sqlParameters[12]       = new SqlParameter("@EFTBankCheckDigit", SqlDbType.VarChar, 3);
            sqlParameters[12].Value = eftInfo.EftbankCheckDigit;
            sqlParameters[13]       = new SqlParameter("@BSROLLNO", SqlDbType.VarChar, 31);
            sqlParameters[13].Value = eftInfo.Bsrollno;
            sqlParameters[14]       = new SqlParameter("@IntlBankAcctNum", SqlDbType.VarChar, 35);
            sqlParameters[14].Value = eftInfo.IntlBankAcctNum;
            sqlParameters[15]       = new SqlParameter("@SWIFTADDR", SqlDbType.VarChar, 11);
            sqlParameters[15].Value = eftInfo.Swiftaddr;
            sqlParameters[16]       = new SqlParameter("@CustVendCountryCode", SqlDbType.VarChar, 3);
            sqlParameters[16].Value = eftInfo.CustVendCountryCode;
            sqlParameters[17]       = new SqlParameter("@DeliveryCountryCode", SqlDbType.VarChar, 3);
            sqlParameters[17].Value = eftInfo.DeliveryCountryCode;
            sqlParameters[18]       = new SqlParameter("@BNKCTRCD", SqlDbType.VarChar, 3);
            sqlParameters[18].Value = eftInfo.Bnkctrcd;
            sqlParameters[19]       = new SqlParameter("@CBANKCD", SqlDbType.VarChar, 9);
            sqlParameters[19].Value = eftInfo.Cbankcd;
            sqlParameters[20]       = new SqlParameter("@ADDRESS1", SqlDbType.VarChar, 61);
            sqlParameters[20].Value = eftInfo.Address1;
            sqlParameters[21]       = new SqlParameter("@ADDRESS2", SqlDbType.VarChar, 61);
            sqlParameters[21].Value = eftInfo.Address2;
            sqlParameters[22]       = new SqlParameter("@ADDRESS3", SqlDbType.VarChar, 61);
            sqlParameters[22].Value = eftInfo.Address3;
            sqlParameters[23]       = new SqlParameter("@ADDRESS4", SqlDbType.VarChar, 61);
            sqlParameters[23].Value = eftInfo.Address4;
            sqlParameters[24]       = new SqlParameter("@RegCode1", SqlDbType.VarChar, 31);
            sqlParameters[24].Value = eftInfo.RegCode1;
            sqlParameters[25]       = new SqlParameter("@RegCode2", SqlDbType.VarChar, 31);
            sqlParameters[25].Value = eftInfo.RegCode2;
            sqlParameters[26]       = new SqlParameter("@BankInfo7", SqlDbType.SmallInt);
            sqlParameters[26].Value = eftInfo.BankInfo7;
            sqlParameters[27]       = new SqlParameter("@EFTTransitRoutingNo", SqlDbType.VarChar, 11);
            sqlParameters[27].Value = eftInfo.EfttransitRoutingNo;
            sqlParameters[28]       = new SqlParameter("@CURNCYID", SqlDbType.VarChar, 15);
            sqlParameters[28].Value = eftInfo.Curncyid;
            sqlParameters[29]       = new SqlParameter("@EFTTransferMethod", SqlDbType.SmallInt);
            sqlParameters[29].Value = eftInfo.EfttransferMethod;
            sqlParameters[30]       = new SqlParameter("@EFTAccountType", SqlDbType.SmallInt);
            sqlParameters[30].Value = eftInfo.EftaccountType;
            //sqlParameters[31] = new SqlParameter("@EFTPrenoteDate", SqlDbType.DateTime);
            //sqlParameters[31].Value = eftInfo.EftprenoteDate;
            //sqlParameters[32] = new SqlParameter("@EFTTerminationDate", SqlDbType.DateTime);
            //sqlParameters[32].Value = eftInfo.EftterminationDate;

            int records = DataAccess.ExecuteNonQuery(APIController.Instance.APIModel.APIConfig.GPCompanyDB, CommandType.Text, commandText, sqlParameters);

            if (records == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        public static bool InsertEFT(Models.EFTInfoDto eftInfo)
        {
            string commandText = "zDP_SY06000SI";

            SqlParameter[] sqlParameters = new SqlParameter[37];

            sqlParameters[0]            = new SqlParameter("@SERIES", SqlDbType.SmallInt);
            sqlParameters[0].Value      = eftInfo.Series;
            sqlParameters[1]            = new SqlParameter("@CustomerVendor_ID", SqlDbType.VarChar, 15);
            sqlParameters[1].Value      = eftInfo.CustomerVendorId;
            sqlParameters[2]            = new SqlParameter("@ADRSCODE", SqlDbType.VarChar, 15);
            sqlParameters[2].Value      = eftInfo.Adrscode;
            sqlParameters[3]            = new SqlParameter("@VENDORID", SqlDbType.VarChar, 15);
            sqlParameters[3].Value      = eftInfo.Vendorid;
            sqlParameters[4]            = new SqlParameter("@CUSTNMBR", SqlDbType.VarChar, 15);
            sqlParameters[4].Value      = eftInfo.Custnmbr;
            sqlParameters[5]            = new SqlParameter("@EFTUseMasterID", SqlDbType.SmallInt);
            sqlParameters[5].Value      = eftInfo.EftuseMasterId;
            sqlParameters[6]            = new SqlParameter("@EFTBankType", SqlDbType.SmallInt);
            sqlParameters[6].Value      = eftInfo.EftbankType;
            sqlParameters[7]            = new SqlParameter("@FRGNBANK", SqlDbType.TinyInt);
            sqlParameters[7].Value      = eftInfo.Frgnbank;
            sqlParameters[8]            = new SqlParameter("@INACTIVE", SqlDbType.TinyInt);
            sqlParameters[8].Value      = eftInfo.Inactive;
            sqlParameters[9]            = new SqlParameter("@BANKNAME", SqlDbType.VarChar, 31);
            sqlParameters[9].Value      = eftInfo.Bankname;
            sqlParameters[10]           = new SqlParameter("@EFTBankAcct", SqlDbType.VarChar, 35);
            sqlParameters[10].Value     = eftInfo.EftbankAcct;
            sqlParameters[11]           = new SqlParameter("@EFTBankBranch", SqlDbType.VarChar, 15);
            sqlParameters[11].Value     = eftInfo.EftbankBranch;
            sqlParameters[12]           = new SqlParameter("@GIROPostType", SqlDbType.SmallInt);
            sqlParameters[12].Value     = eftInfo.GiropostType;
            sqlParameters[13]           = new SqlParameter("@EFTBankCode", SqlDbType.VarChar, 15);
            sqlParameters[13].Value     = eftInfo.EftbankCode;
            sqlParameters[14]           = new SqlParameter("@EFTBankBranchCode", SqlDbType.VarChar, 5);
            sqlParameters[14].Value     = eftInfo.EftbankBranchCode;
            sqlParameters[15]           = new SqlParameter("@EFTBankCheckDigit", SqlDbType.VarChar, 3);
            sqlParameters[15].Value     = eftInfo.EftbankCheckDigit;
            sqlParameters[16]           = new SqlParameter("@BSROLLNO", SqlDbType.VarChar, 31);
            sqlParameters[16].Value     = eftInfo.Bsrollno;
            sqlParameters[17]           = new SqlParameter("@IntlBankAcctNum", SqlDbType.VarChar, 35);
            sqlParameters[17].Value     = eftInfo.IntlBankAcctNum;
            sqlParameters[18]           = new SqlParameter("@SWIFTADDR", SqlDbType.VarChar, 11);
            sqlParameters[18].Value     = eftInfo.Swiftaddr;
            sqlParameters[19]           = new SqlParameter("@CustVendCountryCode", SqlDbType.VarChar, 3);
            sqlParameters[19].Value     = eftInfo.CustVendCountryCode;
            sqlParameters[20]           = new SqlParameter("@DeliveryCountryCode", SqlDbType.VarChar, 3);
            sqlParameters[20].Value     = eftInfo.DeliveryCountryCode;
            sqlParameters[21]           = new SqlParameter("@BNKCTRCD", SqlDbType.VarChar, 3);
            sqlParameters[21].Value     = eftInfo.Bnkctrcd;
            sqlParameters[22]           = new SqlParameter("@CBANKCD", SqlDbType.VarChar, 9);
            sqlParameters[22].Value     = eftInfo.Cbankcd;
            sqlParameters[23]           = new SqlParameter("@ADDRESS1", SqlDbType.VarChar, 61);
            sqlParameters[23].Value     = eftInfo.Address1;
            sqlParameters[24]           = new SqlParameter("@ADDRESS2", SqlDbType.VarChar, 61);
            sqlParameters[24].Value     = eftInfo.Address2;
            sqlParameters[25]           = new SqlParameter("@ADDRESS3", SqlDbType.VarChar, 61);
            sqlParameters[25].Value     = eftInfo.Address3;
            sqlParameters[26]           = new SqlParameter("@ADDRESS4", SqlDbType.VarChar, 61);
            sqlParameters[26].Value     = eftInfo.Address4;
            sqlParameters[27]           = new SqlParameter("@RegCode1", SqlDbType.VarChar, 31);
            sqlParameters[27].Value     = eftInfo.RegCode1;
            sqlParameters[28]           = new SqlParameter("@RegCode2", SqlDbType.VarChar, 31);
            sqlParameters[28].Value     = eftInfo.RegCode2;
            sqlParameters[29]           = new SqlParameter("@BankInfo7", SqlDbType.SmallInt);
            sqlParameters[29].Value     = eftInfo.BankInfo7;
            sqlParameters[30]           = new SqlParameter("@EFTTransitRoutingNo", SqlDbType.VarChar, 11);
            sqlParameters[30].Value     = eftInfo.EfttransitRoutingNo;
            sqlParameters[31]           = new SqlParameter("@CURNCYID", SqlDbType.VarChar, 15);
            sqlParameters[31].Value     = eftInfo.Curncyid;
            sqlParameters[32]           = new SqlParameter("@EFTTransferMethod", SqlDbType.SmallInt);
            sqlParameters[32].Value     = eftInfo.EfttransferMethod;
            sqlParameters[33]           = new SqlParameter("@EFTAccountType", SqlDbType.SmallInt);
            sqlParameters[33].Value     = eftInfo.EftaccountType;
            sqlParameters[34]           = new SqlParameter("@EFTPrenoteDate", SqlDbType.DateTime);
            sqlParameters[34].Value     = Convert.ToDateTime("1900-01-01");
            sqlParameters[35]           = new SqlParameter("@EFTTerminationDate", SqlDbType.DateTime);
            sqlParameters[35].Value     = Convert.ToDateTime("1900-01-01");
            sqlParameters[36]           = new SqlParameter("@DEX_ROW_ID", SqlDbType.Int);
            sqlParameters[36].Direction = ParameterDirection.InputOutput;
            sqlParameters[36].Value     = 0;          // eftInfo.DexRowId;

            var paramsToReturn = new List <int>();

            paramsToReturn.Add(36);

            List <string> returnParams = DataAccess.ExecuteProcWithOutput(APIController.Instance.APIModel.APIConfig.GPCompanyDB, CommandType.StoredProcedure, commandText, sqlParameters, paramsToReturn);

            if (Convert.ToInt32(returnParams[0]) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }