Beispiel #1
0
        /// <summary>
        /// To fetch details
        /// </summary>
        /// <returns></returns>
        public CropAgeList GetCropAge()
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_SELECTCROPAGE";

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

            cmd.Connection.Open();
            OracleDataReader dr          = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            CropAgeBO        objCropAge  = null;
            CropAgeList      CropAgeList = new CropAgeList();

            while (dr.Read())
            {
                objCropAge           = new CropAgeBO();
                objCropAge.CROPAGEID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CROPAGEID")));
                objCropAge.CROPAGE   = dr.GetString(dr.GetOrdinal("CROPAGE"));
                objCropAge.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED"));

                CropAgeList.Add(objCropAge);
            }

            dr.Close();

            return(CropAgeList);
        }
Beispiel #2
0
        /// <summary>
        /// Get CropAge By Id
        /// </summary>
        /// <param name="CROPAGEID"></param>
        /// <returns></returns>
        public CropAgeBO GetCropAgeById(int CROPAGEID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;

            string proc = "USP_MST_GETSELECTCROPAGEBYID";

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

            cmd.Connection.Open();

            OracleDataReader dr          = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            CropAgeBO        CropAgeObj  = null;
            CropAgeList      CropAgeList = new CropAgeList();

            CropAgeObj = new CropAgeBO();
            while (dr.Read())
            {
                if (ColumnExists(dr, "CROPAGE") && !dr.IsDBNull(dr.GetOrdinal("CROPAGE")))
                {
                    CropAgeObj.CROPAGE = dr.GetString(dr.GetOrdinal("CROPAGE"));
                }
                if (ColumnExists(dr, "CROPAGEID") && !dr.IsDBNull(dr.GetOrdinal("CROPAGEID")))
                {
                    CropAgeObj.CROPAGEID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("CROPAGEID")));
                }
                if (ColumnExists(dr, "ISDELETED") && !dr.IsDBNull(dr.GetOrdinal("ISDELETED")))
                {
                    CropAgeObj.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED"));
                }
            }
            dr.Close();
            return(CropAgeObj);
        }