Exemplo n.º 1
0
        ///<Summary>
        ///</Summary>
        ///<returns>
        ///Int32
        ///</returns>
        ///<parameters>
        ///DAODesignation daoDesignation
        ///</parameters>
        public static Int32 SelectAllBySearchFieldsCount(DAODesignation daoDesignation)
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprdesignation_SelectAllBySearchFieldsCount;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            try
            {
                command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoDesignation.Id ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 255, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoDesignation.Name ?? (object)DBNull.Value));

                staticConnection.Open();
                Int32 retCount = (Int32)command.ExecuteScalar();

                return(retCount);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 2
0
        ///<Summary>
        ///</Summary>
        ///<returns>
        ///IList-DAODesignation.
        ///</returns>
        ///<parameters>
        ///DAODesignation daoDesignation
        ///</parameters>
        public static IList <DAODesignation> SelectAllBySearchFields(DAODesignation daoDesignation)
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprdesignation_SelectAllBySearchFields;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("designation");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoDesignation.Id ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 255, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoDesignation.Name ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);

                List <DAODesignation> objList = new List <DAODesignation>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAODesignation retObj = new DAODesignation();
                        retObj._id   = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"];
                        retObj._name = Convert.IsDBNull(row["name"]) ? null : (string)row["name"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 3
0
        ///<Summary>
        ///Select all rows
        ///This method returns all data rows in the table designation
        ///</Summary>
        ///<returns>
        ///IList-DAODesignation.
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public static IList <DAODesignation> SelectAll()
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprdesignation_SelectAll;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("designation");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                staticConnection.Open();
                sqlAdapter.Fill(dt);

                List <DAODesignation> objList = new List <DAODesignation>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAODesignation retObj = new DAODesignation();
                        retObj._id   = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"];
                        retObj._name = Convert.IsDBNull(row["name"]) ? null : (string)row["name"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 4
0
        ///<Summary>
        ///Select one row by primary key(s)
        ///This method returns one row from the table designation based on the primary key(s)
        ///</Summary>
        ///<returns>
        ///DAODesignation
        ///</returns>
        ///<parameters>
        ///Int32? id
        ///</parameters>
        public static DAODesignation SelectOne(Int32?id)
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprdesignation_SelectOne;
            command.CommandType = CommandType.Text;
            SqlConnection staticConnection = StaticSqlConnection;

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("designation");
            SqlDataAdapter sqlAdapter = new SqlDataAdapter(command);

            try
            {
                command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)id ?? (object)DBNull.Value));

                staticConnection.Open();
                sqlAdapter.Fill(dt);

                DAODesignation retObj = null;
                if (dt.Rows.Count > 0)
                {
                    retObj       = new DAODesignation();
                    retObj._id   = Convert.IsDBNull(dt.Rows[0]["id"]) ? (Int32?)null : (Int32?)dt.Rows[0]["id"];
                    retObj._name = Convert.IsDBNull(dt.Rows[0]["name"]) ? null : (string)dt.Rows[0]["name"];
                }
                return(retObj);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }