//} public List <UpcomingEvent> searchUpcomingEvent(string text) { string query = "SELECT * from UpcomingEventTable WHERE Projectname LIKE '%" + text + "%' OR Projectarea LIKE '%" + text + "%' OR ProposedDate LIKE '%" + text + "%' OR ProjectId LIKE '%" + text + "%'"; List <UpcomingEvent> asList = new List <UpcomingEvent>(); DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query); while (sdr.Read()) { UpcomingEvent a = new UpcomingEvent(); // a.ProjectId = sdr["ProjectId"].ToString(); a.Projectname = sdr["Projectname"].ToString(); a.Projectarea = sdr["Projectarea"].ToString(); a.ProjectID = sdr["ProjectId"].ToString(); a.ProposedDate = Convert.ToDateTime(sdr["ProposedDate"]); asList.Add(a); } return(asList); }
public List <UpcomingEvent> GetAllUpcomingList() { string query22 = "SELECT * from UpcomingEventTable"; List <UpcomingEvent> bList = new List <UpcomingEvent>(); DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query22); while (sdr.Read()) { UpcomingEvent a = new UpcomingEvent(); // a.ProjectId = sdr["ProjectId"].ToString(); a.Projectname = sdr["Projectname"].ToString(); a.Projectarea = sdr["Projectarea"].ToString(); a.ProjectID = sdr["ProjectId"].ToString(); a.ProposedDate = Convert.ToDateTime(sdr["ProposedDate"]); bList.Add(a); } return(bList); }
public bool Updatex(UpcomingEvent xaxxc) { try { string query2 = "UPDATE UpcomingEventTable SET Projectname = '" + xaxxc.Projectname + "', Projectarea = '" + xaxxc.Projectarea + "',ProposedDate = '" + xaxxc.ProposedDate + "' WHERE ProjectID = '" + xaxxc.ProjectID + "'"; // string query2 = "UPDATE UpcomingEvent SET Projectname = '" + tas.Projectname + "', Projectarea = "' + tas.Projectarea "' WHERE ProposedDate = '" + tas.ProposedDate + "'; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query2); return(true); } catch (Exception exasz) { return(false); } }
public bool Insert(UpcomingEvent dpa) { try { //String combo1 = Convert.ToString(this.DonationTitleCombobox.SelectedItem); RecieverPhone string query = "INSERT into UpcomingEventTable VALUES ('" + dpa.ProjectID + "', '" + dpa.Projectname + "', '" + dpa.Projectarea + "', '" + dpa.ProposedDate + "')"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); return(true); } catch (Exception exfa) { return(false); } }