public List <DonationByNgo> SearchAllDonation(String text) //GiveBYID { string query22 = "SELECT * from DonationNGOgivenByTable WHERE DonationId LIKE '%" + text + "%' OR DonationTitle LIKE '%" + text + "%' OR RecieverId LIKE '%" + text + "%' OR GivenTime LIKE '%" + text + "%' OR DonationItem LIKE '%" + text + "%' OR GiveBYID LIKE '%" + text + "%' OR RecieverPhone LIKE '%" + text + "%'"; List <DonationByNgo> bList = new List <DonationByNgo>(); DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); SqlDataReader sdr = dcc.GetData(query22); while (sdr.Read()) { DonationByNgo bd = new DonationByNgo(); bd.DonationId = Convert.ToString(sdr["DonationId"]); bd.DonationTitle = Convert.ToString(sdr["DonationTitle"]); bd.RecieverId = Convert.ToString(sdr["RecieverId"]); bd.GivenTime = Convert.ToString(sdr["GivenTime"]); bd.DonationItem = Convert.ToString(sdr["DonationItem"]); bd.RecieverPhone = Convert.ToString(sdr["RecieverPhone"]); bd.GiveBYID = Convert.ToString(sdr["GiveBYID"]); bList.Add(bd); } return(bList); }
bool Insert(DonationByNgo d) { try { string query = "INSERT into DonationNGOgivenByTable VALUES ('" + d.DonationId + "', '" + d.DonationTitle + "', '" + d.RecieverId + "', '" + d.GivenTime + "', '" + d.DonationItem + "')"; DatabaseConnectionClass dcc = new DatabaseConnectionClass(); dcc.ConnectWithDB(); int x = dcc.ExecuteSQL(query); return(true); } catch (Exception exa) { return(false); } }
bool InterDonationRepository.Insert(DonationByNgo d) { throw new NotImplementedException(); }