示例#1
0
文件: ParishDAL.cs 项目: abigabaw/wis
        /// <summary>
        /// To Get Parish
        /// </summary>
        /// <param name="subcountyid"></param>
        /// <returns></returns>
        public Parish_List GetParish(string subcountyid)
        {
            OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_MST_GET_PARISH";

            cmd             = new OracleCommand(proc, con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("SUBCOUNTYID_", subcountyid);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr            = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            ParishBO         ParishBOobj   = null;
            Parish_List      ParishListobj = new Parish_List();

            while (dr.Read())
            {
                ParishBOobj            = new ParishBO();
                ParishBOobj.ParishId   = (Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PARISHID"))));
                ParishBOobj.ParishName = dr.GetValue(dr.GetOrdinal("PARISHNAME")).ToString();
                ParishListobj.Add(ParishBOobj);
            }

            dr.Close();
            return(ParishListobj);
        }
示例#2
0
文件: ParishDAL.cs 项目: abigabaw/wis
        /// <summary>
        /// To Get All Parish
        /// </summary>
        /// <param name="subcountyid"></param>
        /// <param name="countyid"></param>
        /// <param name="districtid"></param>
        /// <returns></returns>
        public Parish_List GetAllParish(int subcountyid, int countyid, int districtid)
        {
            Parish_List Parish_Listobj = null;

            using (cnn = new OracleConnection(connStr))
            {
                using (cmd = new OracleCommand("USP_MST_GET_PARISH_ALL", cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.Add("SUBCOUNTYID_", subcountyid);
                    cmd.Parameters.Add("countyid_", countyid);
                    cmd.Parameters.Add("districtid_", districtid);
                    cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
                    cmd.Connection.Open();

                    OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                    ParishBO ParishBOobj = null;
                    Parish_Listobj = new Parish_List();

                    while (dr.Read())
                    {
                        ParishBOobj = new ParishBO();
                        if (!dr.IsDBNull(dr.GetOrdinal("PARISHID")))
                        {
                            ParishBOobj.ParishId = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PARISHID")));
                        }
                        if (!dr.IsDBNull(dr.GetOrdinal("PARISHNAME")))
                        {
                            ParishBOobj.ParishName = dr.GetValue(dr.GetOrdinal("PARISHNAME")).ToString();
                        }
                        if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                        {
                            ParishBOobj.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED"));
                        }
                        if (!dr.IsDBNull(dr.GetOrdinal("districtname")))
                        {
                            ParishBOobj.DistrictName = dr.GetString(dr.GetOrdinal("districtname"));
                        }
                        if (!dr.IsDBNull(dr.GetOrdinal("countyname")))
                        {
                            ParishBOobj.countyName = dr.GetString(dr.GetOrdinal("countyname"));
                        }
                        if (!dr.IsDBNull(dr.GetOrdinal("subcountyname")))
                        {
                            ParishBOobj.subcountyName = dr.GetString(dr.GetOrdinal("subcountyname"));
                        }
                        // if (!dr.IsDBNull(dr.GetOrdinal("districtid"))) objCountyBO.DistrictID =Convert.ToInt32( dr.GetString(dr.GetOrdinal("districtid")));
                        Parish_Listobj.Add(ParishBOobj);
                    }

                    dr.Close();
                }
            }

            return(Parish_Listobj);
        }