public static List <RFCOA> GetRFCOA()
        {
            var dbUtil = new DatabaseManager();
            var rfcoas = new List <RFCOA>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spDisGetPCFCOA";
                    cmd.CommandTimeout = 180;

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var rfcoa = new RFCOA
                            {
                                RFCOAID     = ReferenceEquals(reader["intCOAID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intCOAID"]),
                                Description = ReferenceEquals(reader["strDescription"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strDescription"]),
                                Code        = ReferenceEquals(reader["strCode"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strCode"]),
                                AccountSide = ReferenceEquals(reader["strAccountSide"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strAccountSide"])
                            };

                            rfcoas.Add(rfcoa);
                        }

                        return(rfcoas);
                    }
                }
            }
        }
        public static List <RFCOA> GetFormCOA(int branchID, string criteria)
        {
            var dbUtil = new DatabaseManager();
            var payees = new List <RFCOA>();

            using (var conn = new SqlConnection(dbUtil.getSQLConnectionString("MainDB")))
            {
                conn.Open();
                using (SqlCommand cmd = conn.CreateCommand())
                {
                    cmd.CommandType    = CommandType.StoredProcedure;
                    cmd.CommandText    = "spDisGetPCFFormCOA";
                    cmd.CommandTimeout = 180;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@intIDMasLocation", branchID);
                    cmd.Parameters.AddWithValue("@strCriteria", criteria);

                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            var payee = new RFCOA
                            {
                                RFCOAID          = ReferenceEquals(reader["intCOAID"], DBNull.Value) ? 0 : Convert.ToInt32(reader["intCOAID"]),
                                Description      = ReferenceEquals(reader["strDescription"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strDescription"]),
                                Code             = ReferenceEquals(reader["strCode"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strCode"]),
                                AccountSide      = ReferenceEquals(reader["strAccountSide"], DBNull.Value) ? string.Empty : Convert.ToString(reader["strAccountSide"]),
                                HasSupplementary = ReferenceEquals(reader["blnHasSupplementary"], DBNull.Value) ? 0 : Convert.ToInt32(reader["blnHasSupplementary"]),
                                HasSubsidiary    = ReferenceEquals(reader["blnHasSubsidiary"], DBNull.Value) ? 0 : Convert.ToInt32(reader["blnHasSubsidiary"])
                            };

                            payees.Add(payee);
                        }

                        return(payees);
                    }
                }
            }
        }