Пример #1
0
        /// <summary>
        /// To Get Active Branches from database
        /// </summary>
        /// <param name="bankID"></param>
        /// <returns></returns>
        public BankBranchList GetActiveBranches(int bankID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GET_BRANCHES";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("bankID_", Convert.ToInt32(bankID));

            cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();
            OracleDataReader dr            = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            BranchBO         objBranchBO   = null;
            BankBranchList   objBranchList = new BankBranchList();

            while (dr.Read())
            {
                objBranchBO = new BranchBO();

                if (!dr.IsDBNull(dr.GetOrdinal("BRANCHID")))
                {
                    objBranchBO.BankBranchId = dr.GetInt32(dr.GetOrdinal("BRANCHID"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("BRANCHNAME")))
                {
                    objBranchBO.BranchName = dr.GetString(dr.GetOrdinal("BRANCHNAME"));
                }

                objBranchList.Add(objBranchBO);
            }

            dr.Close();
            return(objBranchList);
        }
Пример #2
0
        /// <summary>
        /// To get all branches from database
        /// </summary>
        /// <param name="bankID"></param>
        /// <returns></returns>
        public BankBranchList GetAllBranches(int bankID)
        {
            proc = "USP_MST_GET_ALLBRANCHES";
            BranchBO       objBranchBO   = null;
            BankBranchList objBranchList = new BankBranchList();

            using (cnn = new OracleConnection(con))
            {
                using (cmd = new OracleCommand(proc, cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("bankID_", bankID);
                    cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

                    try
                    {
                        cmd.Connection.Open();
                        OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                        while (dr.Read())
                        {
                            objBranchBO = new BranchBO();

                            if (!dr.IsDBNull(dr.GetOrdinal("BANKID")))
                            {
                                objBranchBO.BankID = dr.GetInt32(dr.GetOrdinal("bankID"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("CITY")))
                            {
                                objBranchBO.City = dr.GetString(dr.GetOrdinal("City"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("BRANCHNAME")))
                            {
                                objBranchBO.BranchName = dr.GetString(dr.GetOrdinal("branchName"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("SWIFTCODE")))
                            {
                                objBranchBO.SwiftCode = dr.GetString(dr.GetOrdinal("swiftCode"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("BANKCODE")))
                            {
                                objBranchBO.BANKCODE = dr.GetString(dr.GetOrdinal("BANKCODE"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                            {
                                objBranchBO.IsDeleted = dr.GetString(dr.GetOrdinal("isDeleted"));
                            }
                            if (!dr.IsDBNull(dr.GetOrdinal("BranchID")))
                            {
                                objBranchBO.BankBranchId = dr.GetInt32(dr.GetOrdinal("BranchID"));
                            }
                            objBranchList.Add(objBranchBO);
                        }

                        dr.Close();
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }

            return(objBranchList);
        }