Exemple #1
0
        /// <summary>
        /// To fetch details by ID
        /// </summary>
        /// <param name="DwellingID"></param>
        /// <returns></returns>
        public DwellingBO GetDwellingById(int DwellingID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GETDWELLINGBYID";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("p_DWELLINGID", DwellingID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader dr            = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            DwellingBO       DwellingBOobj = null;
            DwellingList     Users         = new DwellingList();

            DwellingBOobj = new DwellingBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "dwellingtype") && !dr.IsDBNull(dr.GetOrdinal("dwellingtype")))
                {
                    DwellingBOobj.DwellingType = dr.GetString(dr.GetOrdinal("dwellingtype"));
                }
                if (ColumnExists(dr, "dwellingid") && !dr.IsDBNull(dr.GetOrdinal("dwellingid")))
                {
                    DwellingBOobj.DwellingID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("dwellingid")));
                }
            }
            dr.Close();


            return(DwellingBOobj);
        }
Exemple #2
0
        /// <summary>
        /// To fetch details
        /// </summary>
        /// <returns></returns>
        public DwellingList GetDwelling()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GETDWELLING";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();
            OracleDataReader dr      = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            DwellingBO       objUser = null;
            DwellingList     Users   = new DwellingList();

            while (dr.Read())
            {
                objUser              = new DwellingBO();
                objUser.DwellingID   = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("dwellingid")));
                objUser.DwellingType = dr.GetString(dr.GetOrdinal("dwellingtype"));

                Users.Add(objUser);
            }

            dr.Close();

            return(Users);
        }
Exemple #3
0
 /// <summary>
 /// to bind the data from the database to the dropdown ddlDwelling
 /// </summary>
 private void bindDDLDwelling()
 {
     objDwellingBLL             = new DwellingBLL();
     objDwellingList            = objDwellingBLL.GetDwelling();
     ddlDwelling.DataSource     = objDwellingList;
     ddlDwelling.DataTextField  = "dwellingtype";
     ddlDwelling.DataValueField = "dwellingid";
     ddlDwelling.DataBind();
 }