Ejemplo n.º 1
0
        ///<Summary>
        ///</Summary>
        ///<returns>
        ///Int32
        ///</returns>
        ///<parameters>
        ///DAOTechnician daoTechnician
        ///</parameters>
        public static Int32 SelectAllBySearchFieldsCount(DAOTechnician daoTechnician)
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprtechnician_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)daoTechnician.Id ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@name", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)daoTechnician.Name ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@designationid", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)daoTechnician.Designationid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@roleid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoTechnician.Roleid ?? (object)DBNull.Value));

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

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

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

            command.Connection = staticConnection;

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

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

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

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

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

            command.Connection = staticConnection;

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

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

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

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

            command.Connection = staticConnection;

            DataTable      dt         = new DataTable("technician");
            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);

                DAOTechnician retObj = null;
                if (dt.Rows.Count > 0)
                {
                    retObj                = new DAOTechnician();
                    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"];
                    retObj._designationid = Convert.IsDBNull(dt.Rows[0]["designationid"]) ? (Int32?)null : (Int32?)dt.Rows[0]["designationid"];
                    retObj._roleid        = Convert.IsDBNull(dt.Rows[0]["roleid"]) ? (Int32?)null : (Int32?)dt.Rows[0]["roleid"];
                }
                return(retObj);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }