public Project GetProjectEntity(int id) { SqlCommand sql = new SqlCommand(); sql.CommandText = "SELECT * FROM ProjectT WHERE Id = @id"; DataSet d = new DataSet(); sql.Parameters.AddWithValue("id", id); DBCommunication.FillDataSet(d, sql); DataRow row = d.Tables[0].Rows[0]; return(new Project(row)); }
public List <int> GetProjectIdOfParticipantList(string username) { List <int> list = new List <int>(); SqlCommand sql = new SqlCommand(); sql.CommandText = "Select Project_Id from Project_Members where Username = @username"; sql.Parameters.AddWithValue("username", username); DataSet d = new DataSet(); DBCommunication.FillDataSet(d, sql); foreach (DataRow row in d.Tables[0].Rows) { list.Add(int.Parse(row["Project_Id"].ToString())); } return(list); }
public List <string> GetProjectParticipants(int code) { List <string> list = new List <string>(); SqlCommand sql = new SqlCommand(); sql.CommandText = "select Username From Project_Members where Project_Id = @code"; sql.Parameters.AddWithValue("code", code); DataSet d = new DataSet(); DBCommunication.FillDataSet(d, sql); foreach (DataRow row in d.Tables[0].Rows) { list.Add(row["Username"].ToString().Trim()); } return(list); }
public List <Project> GetAllProjectsManagedBy(string username) { List <Project> list = new List <Project>(); SqlCommand sql = new SqlCommand(); sql.CommandText = "Select * From ProjectT where Manager_Id = @username"; sql.Parameters.AddWithValue("username", username); DataSet d = new DataSet(); DBCommunication.FillDataSet(d, sql); foreach (DataRow row in d.Tables[0].Rows) { list.Add(new Project() { Code = int.Parse(row["Id"].ToString()), Name = row["Name"].ToString(), Description = row["Description"].ToString(), StartDate = DateTime.Parse(row["Start_Date"].ToString()), EndDate = row["End_Date"] == DBNull.Value ? new DateTime() : DateTime.Parse(row["End_Date"].ToString()), Manager = row["Manager_Id"].ToString(), }); } return(list); }
public UserOperations() { DBcontext = new DBCommunication(); }