internal static int RemoveProjectPerson(ProjectPerson obj) { if (obj == null) { return(-1); } SqlCommand comm = new SqlCommand(); try { //comm.CommandText = //Insert Sproc Name Here; comm.Parameters.AddWithValue("@" + ProjectPerson.db_ID, obj.ID); return(UpdateObject(comm)); } catch (Exception ex) { } return(-1); }
/// <summary> /// Attempts to add a database entry corresponding to the given ProjectPerson /// </summary> /// <remarks></remarks> internal static int AddProjectPerson(ProjectPerson obj) { if (obj == null) { return(-1); } SqlCommand comm = new SqlCommand("sproc_ProjectPersonAdd"); try { comm.Parameters.AddWithValue("@" + ProjectPerson.db_Project, obj.ProjectID); comm.Parameters.AddWithValue("@" + ProjectPerson.db_Person, obj.Person); comm.Parameters.AddWithValue("@" + ProjectPerson.db_DateAssigned, obj.DateAssigned); return(AddObject(comm, "@" + ProjectPerson.db_ID)); } catch (Exception ex) { } return(-1); }
/// <summary> /// Gets the SQLCode.ProjectPersoncorresponding with the given ID /// </summary> /// <remarks></remarks> public static ProjectPerson GetProjectPerson(int id) { SqlCommand comm = new SqlCommand("sprocProjectPersonGet"); ProjectPerson retObj = null; try { comm.Parameters.AddWithValue("@" + ProjectPerson.db_ID, id); SqlDataReader dr = GetDataReader(comm); while (dr.Read()) { retObj = new ProjectPerson(dr); } comm.Connection.Close(); } catch (Exception ex) { comm.Connection.Close(); } return(retObj); }
/// <summary> /// Gets the SQLCode.ProjectPerson correposponding with the given ID /// </summary> /// <remarks></remarks> public static ProjectPerson GetProjectPerson(String idstring, Boolean retNewObject) { ProjectPerson retObject = null; int ID; if (int.TryParse(idstring, out ID)) { if (ID == -1 && retNewObject) { retObject = new ProjectPerson(); retObject.ID = -1; } else if (ID >= 0) { retObject = GetProjectPerson(ID); } } return(retObject); }
/// <summary> /// Gets a list of all SQLCode.ProjectPerson objects from the database for /// a given Person. /// </summary> /// <remarks></remarks> public static List <ProjectPerson> GetProjectPerson(Person p) { SqlCommand comm = new SqlCommand("sprocProjectPersonsGetForPerson"); List <ProjectPerson> retList = new List <ProjectPerson>(); try { comm.Parameters.AddWithValue("@" + ProjectPerson.db_Person, p.ID); comm.CommandType = System.Data.CommandType.StoredProcedure; SqlDataReader dr = GetDataReader(comm); while (dr.Read()) { ProjectPerson pp = new ProjectPerson(dr); pp.Project = new Project(dr); pp.Person = p; retList.Add(pp); } comm.Connection.Close(); } catch (Exception ex) { comm.Connection.Close(); } return(retList); }