///<Summary> ///</Summary> ///<returns> ///Int32 ///</returns> ///<parameters> ///DAOLogin daoLogin ///</parameters> public static Int32 SelectAllBySearchFieldsCount(DAOLogin daoLogin) { SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprlogin_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)daoLogin.Id ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@username", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)daoLogin.Username ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@password", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)daoLogin.Password ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@technicianid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoLogin.Technicianid ?? (object)DBNull.Value)); staticConnection.Open(); Int32 retCount = (Int32)command.ExecuteScalar(); return(retCount); } catch { throw; } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///</Summary> ///<returns> ///IList-DAOLogin. ///</returns> ///<parameters> ///DAOLogin daoLogin ///</parameters> public static IList <DAOLogin> SelectAllBySearchFields(DAOLogin daoLogin) { SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprlogin_SelectAllBySearchFields; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("login"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { command.Parameters.Add(new SqlParameter("@id", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoLogin.Id ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@username", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)daoLogin.Username ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@password", SqlDbType.VarChar, 255, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, (object)daoLogin.Password ?? (object)DBNull.Value)); command.Parameters.Add(new SqlParameter("@technicianid", SqlDbType.Int, 4, ParameterDirection.Input, false, 10, 0, "", DataRowVersion.Proposed, (object)daoLogin.Technicianid ?? (object)DBNull.Value)); staticConnection.Open(); sqlAdapter.Fill(dt); List <DAOLogin> objList = new List <DAOLogin>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOLogin retObj = new DAOLogin(); retObj._id = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"]; retObj._username = Convert.IsDBNull(row["username"]) ? null : (string)row["username"]; retObj._password = Convert.IsDBNull(row["password"]) ? null : (string)row["password"]; retObj._technicianid = Convert.IsDBNull(row["technicianid"]) ? (Int32?)null : (Int32?)row["technicianid"]; objList.Add(retObj); } } return(objList); } catch { throw; } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select all rows ///This method returns all data rows in the table login ///</Summary> ///<returns> ///IList-DAOLogin. ///</returns> ///<parameters> /// ///</parameters> public static IList <DAOLogin> SelectAll() { SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprlogin_SelectAll; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("login"); SqlDataAdapter sqlAdapter = new SqlDataAdapter(command); try { staticConnection.Open(); sqlAdapter.Fill(dt); List <DAOLogin> objList = new List <DAOLogin>(); if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { DAOLogin retObj = new DAOLogin(); retObj._id = Convert.IsDBNull(row["id"]) ? (Int32?)null : (Int32?)row["id"]; retObj._username = Convert.IsDBNull(row["username"]) ? null : (string)row["username"]; retObj._password = Convert.IsDBNull(row["password"]) ? null : (string)row["password"]; retObj._technicianid = Convert.IsDBNull(row["technicianid"]) ? (Int32?)null : (Int32?)row["technicianid"]; objList.Add(retObj); } } return(objList); } catch { throw; } finally { staticConnection.Close(); command.Dispose(); } }
///<Summary> ///Select one row by primary key(s) ///This method returns one row from the table login based on the primary key(s) ///</Summary> ///<returns> ///DAOLogin ///</returns> ///<parameters> ///Int32? id ///</parameters> public static DAOLogin SelectOne(Int32?id) { SqlCommand command = new SqlCommand(); command.CommandText = InlineProcs.ctprlogin_SelectOne; command.CommandType = CommandType.Text; SqlConnection staticConnection = StaticSqlConnection; command.Connection = staticConnection; DataTable dt = new DataTable("login"); 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); DAOLogin retObj = null; if (dt.Rows.Count > 0) { retObj = new DAOLogin(); retObj._id = Convert.IsDBNull(dt.Rows[0]["id"]) ? (Int32?)null : (Int32?)dt.Rows[0]["id"]; retObj._username = Convert.IsDBNull(dt.Rows[0]["username"]) ? null : (string)dt.Rows[0]["username"]; retObj._password = Convert.IsDBNull(dt.Rows[0]["password"]) ? null : (string)dt.Rows[0]["password"]; retObj._technicianid = Convert.IsDBNull(dt.Rows[0]["technicianid"]) ? (Int32?)null : (Int32?)dt.Rows[0]["technicianid"]; } return(retObj); } catch { throw; } finally { staticConnection.Close(); command.Dispose(); } }