public List <DataManager.request> getRequests() { List <DataManager.request> retVal = new List <DataManager.request>(); string command = "SELECT * FROM Req"; SqlCommand com = new SqlCommand(command, con); SqlDataReader reader; con.Open(); reader = com.ExecuteReader(); while (reader.Read()) { DataManager.request temp = new DataManager.request(); temp.id = reader.GetInt32(0); temp.company_name = reader.GetString(1); temp.name = reader.GetString(2); temp.type = reader.GetString(3); temp.text = reader.GetString(4); try { temp.response = reader.GetString(5); } catch (Exception) { } temp.user = reader.GetString(6); retVal.Add(temp); } reader.Close(); con.Close(); return(retVal); }
public void addRequest(DataManager.request req) { string command = "INSERT INTO Req (company_name,Name,Type,Text,User_name) VALUES('" + req.company_name + "','" + req.name + "','" + req.type + "','" + req.text + "','" + req.user + "')"; con.Open(); SqlCommand com2 = new SqlCommand(command, con); com2.ExecuteNonQuery(); con.Close(); }
protected void CreateUser_Click(object sender, EventArgs e) { DataManager.request req = new DataManager.request(); req.company_name = company; req.name = name; req.text = TEXT.Text; req.user = Session["USER"].ToString().Trim(); if (RadioButton1.Checked) { req.type = "REQUEST"; } else { req.type = "FEEDBACK"; } TaskManager ts = new TaskManager(); ts.addRequest(req); Response.Redirect("Products_C.aspx"); }