Exemplo n.º 1
0
        ///<Summary>
        ///</Summary>
        ///<returns>
        ///IList-DAOIssue.
        ///</returns>
        ///<parameters>
        ///DAOIssue daoIssue
        ///</parameters>
        public static IList <DAOIssue> SelectAllBySearchFields(DAOIssue daoIssue)
        {
            SqlCommand command = new SqlCommand();

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

            command.Connection = staticConnection;

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

            try
            {
                command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Id ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@typeid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Typeid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@staffid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Staffid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@departmentid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Departmentid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@statusid", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Statusid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@details", SqlDbType.VarChar, 800, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoIssue.Details ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@technicianid", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Technicianid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@remarks", SqlDbType.VarChar, 200, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoIssue.Remarks ?? (object)DBNull.Value));

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

                List <DAOIssue> objList = new List <DAOIssue>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOIssue retObj = new DAOIssue();
                        retObj._id           = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"];
                        retObj._typeid       = Convert.IsDBNull(row["typeid"]) ? (Int32?)null : (Int32?)row["typeid"];
                        retObj._staffid      = Convert.IsDBNull(row["staffid"]) ? (Int32?)null : (Int32?)row["staffid"];
                        retObj._departmentid = Convert.IsDBNull(row["departmentid"]) ? (Int32?)null : (Int32?)row["departmentid"];
                        retObj._statusid     = Convert.IsDBNull(row["statusid"]) ? (Int32?)null : (Int32?)row["statusid"];
                        retObj._details      = Convert.IsDBNull(row["details"]) ? null : (string)row["details"];
                        retObj._technicianid = Convert.IsDBNull(row["technicianid"]) ? (Int32?)null : (Int32?)row["technicianid"];
                        retObj._remarks      = Convert.IsDBNull(row["remarks"]) ? null : (string)row["remarks"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 2
0
        ///<Summary>
        ///Select all rows
        ///This method returns all data rows in the table Issue
        ///</Summary>
        ///<returns>
        ///IList-DAOIssue.
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public static IList <DAOIssue> SelectAll()
        {
            SqlCommand command = new SqlCommand();

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

            command.Connection = staticConnection;

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

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

                List <DAOIssue> objList = new List <DAOIssue>();
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        DAOIssue retObj = new DAOIssue();
                        retObj._id           = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"];
                        retObj._typeid       = Convert.IsDBNull(row["typeid"]) ? (Int32?)null : (Int32?)row["typeid"];
                        retObj._staffid      = Convert.IsDBNull(row["staffid"]) ? (Int32?)null : (Int32?)row["staffid"];
                        retObj._departmentid = Convert.IsDBNull(row["departmentid"]) ? (Int32?)null : (Int32?)row["departmentid"];
                        retObj._statusid     = Convert.IsDBNull(row["statusid"]) ? (Int32?)null : (Int32?)row["statusid"];
                        retObj._details      = Convert.IsDBNull(row["details"]) ? null : (string)row["details"];
                        retObj._technicianid = Convert.IsDBNull(row["technicianid"]) ? (Int32?)null : (Int32?)row["technicianid"];
                        retObj._remarks      = Convert.IsDBNull(row["remarks"]) ? null : (string)row["remarks"];
                        objList.Add(retObj);
                    }
                }
                return(objList);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }
Exemplo n.º 3
0
        ///<Summary>
        ///</Summary>
        ///<returns>
        ///Int32
        ///</returns>
        ///<parameters>
        ///DAOIssue daoIssue
        ///</parameters>
        public static Int32 SelectAllBySearchFieldsCount(DAOIssue daoIssue)
        {
            SqlCommand command = new SqlCommand();

            command.CommandText = InlineProcs.ctprIssue_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)daoIssue.Id ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@typeid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Typeid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@staffid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Staffid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@departmentid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Departmentid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@statusid", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Statusid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@details", SqlDbType.VarChar, 800, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoIssue.Details ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@technicianid", SqlDbType.Int, 4, ParameterDirection.Input, true, 10, 0, "", DataRowVersion.Proposed, (object)daoIssue.Technicianid ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("@remarks", SqlDbType.VarChar, 200, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Proposed, (object)daoIssue.Remarks ?? (object)DBNull.Value));

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

                return(retCount);
            }
            catch
            {
                throw;
            }
            finally
            {
                staticConnection.Close();
                command.Dispose();
            }
        }