public void insert() { if (Request.QueryString["id"] != null) { Session["qid"] = Request.QueryString["id"].ToString(); } DBC check = new DBC(); check.ExcecuteQuery("Select * from Chart where Qid='" + Session["qid"] + "'"); DBC q = new DBC(); q.ExcecuteQuery("select * from Questions where id='" + Session["qid"] + "'"); if (check.DT.Rows.Count == 0) { double score = getADW(q.DT.Rows[0]["Question"].ToString(), txtPost.Value); double animal = getADW(q.DT.Rows[0]["Question"].ToString() + " " + txtPost.Value, "Animal#n Wild#n"); double nature = getADW(q.DT.Rows[0]["Question"].ToString() + " " + txtPost.Value, "Nature#n"); double food = getADW(q.DT.Rows[0]["Question"].ToString() + " " + txtPost.Value, "Food#n"); if (animal > nature && animal > food) { check.ExcecuteNonQuery("insert into Chart values('','" + animal + "','','" + score + "','" + Session["qid"] + "')"); } else if (nature > animal && nature > food) { check.ExcecuteNonQuery("insert into Chart values('" + nature + "','','','" + score + "','" + Session["qid"] + "')"); } else { check.ExcecuteNonQuery("insert into Chart values('','','" + food + "','" + score + "','" + Session["qid"] + "')"); } } }
public void Register(object sender, EventArgs e) { string pp = txtPassphrase.Value; //if (!chkAgree.Checked) //{ // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Please agree to the terms and policy to continue')", true); // return; //} if (pp.Length > 10) { if (check(pp)) { RandomGenerator obj = new RandomGenerator(); string UserId = obj.RandomUserId(); string pass = Encrypt(pp); register.ExcecuteNonQuery("Insert into UserTable values('" + UserId + "','" + pass + "','" + txtEmail.Value + "','" + txtName.Value + "')"); if (register.error != null) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('" + register.error + "')", true); return; } Response.Redirect("Login.aspx"); } } }
protected void btnPost_Click(object sender, EventArgs e) { if (txtPost.Value != "") { int id = getPId(); action = new DBC(); action.ExcecuteNonQuery("insert into Posts values('" + Session["usr"] + "','" + id + "','" + Session["qid"] + "','" + txtPost.Value + "','" + DateTime.Now + "')"); insert(); Response.Redirect("Home.aspx"); } }
protected void btnSubmitQtn_Click(object sender, EventArgs e) { chkLogin(); if (loggedin) { if (txtQtn.Text != "") { int id = getQId(); qstn = new DBC(); qstn.ExcecuteNonQuery("Insert into Questions values('" + Session["usr"] + "','" + txtQtn.Text + "','" + id + "','" + DateTime.Now + "')"); Response.Redirect("Home.aspx"); } } else { Response.Redirect("Login.aspx"); } }