예제 #1
0
        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"] + "')");
                }
            }
        }
예제 #2
0
        public void getPosts(int id)
        {
            DBC getPost = new DBC();

            getPost.ExcecuteQuery("Select * from Posts where Qid='" + id + "'");
            Posts.Reset();
            Posts = getPost.DT;
        }
예제 #3
0
 public void login(object sender, EventArgs e)
 {
     check.ExcecuteQuery("Select * from UserTable where Pass='******'");
     if (check.DT.Rows.Count > 0)
     {
         Session["usr"] = check.DT.Rows[0]["UserID"].ToString();
         Response.Redirect("Home.aspx");
     }
     else
     {
     }
 }
예제 #4
0
        public int getQId()
        {
            int newId;
            DBC getid = new DBC();

            getid.ExcecuteQuery("Select max(id) from Questions");
            if (getid.DT.Rows.Count > 0 && getid.DT.Rows[0][0].ToString() != "")
            {
                newId = Convert.ToInt32(getid.DT.Rows[0][0].ToString()) + 1;
                return(newId);
            }
            return(00);
        }
예제 #5
0
        public bool check(string pp)
        {
            string data = Encrypt(pp);

            query.ExcecuteQuery("Select * from UserTable where Pass='******'");
            if (query.DT.Rows.Count > 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         chkLogin();
         if (!loggedin)
         {
             Response.Redirect("Home.aspx");
         }
         Question = new DataTable();
         Post     = new DataTable();
         if (Request.QueryString["id"] != null)
         {
             Session["qid"] = Request.QueryString["id"].ToString();
         }
         user = new DBC();
         user.ExcecuteQuery("Select * from UserTable where UserID='" + Session["usr"] + "'");
         if (user.DT.Rows.Count > 0)
         {
             userId = Session["usr"].ToString();
         }
         else
         {
             ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Login to access')", true);
             Response.Redirect("Login.aspx");
         }
         if (Session["qid"] != null)
         {
             posts = new DBC();
             qstn  = new DBC();
             if (Request.QueryString["id"] != null)
             {
                 Session["qid"] = Request.QueryString["id"].ToString();
             }
             qstn.ExcecuteQuery("Select * from Questions where id='" + Session["qid"] + "'");
             Question = qstn.DT;
             posts.ExcecuteQuery("Select * from posts where Qid='" + Session["qid"] + "'");
             Post = posts.DT;
         }
         else
         {
             Response.Redirect("Home.aspx");
         }
     }
 }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBC    chart  = new DBC();
            Random random = new Random();

            chart.ExcecuteQuery("select * from Chart t1 inner join Questions t2 on t1.Qid=t2.id");
            Chart1.Series[0].ChartType     = SeriesChartType.Bubble;
            Chart1.Series[0].MarkerStyle   = MarkerStyle.Circle;
            Chart1.Series[1].ChartType     = SeriesChartType.Bubble;
            Chart1.Series[1].MarkerStyle   = MarkerStyle.Circle;
            Chart1.Series[2].ChartType     = SeriesChartType.Bubble;
            Chart1.Series[2].MarkerStyle   = MarkerStyle.Circle;
            Chart1.DataSource              = chart.DT;
            Chart1.Series[0].XValueMember  = "nature";
            Chart1.Series[0].YValueMembers = "size";
            Chart1.Series[1].XValueMember  = "food";
            Chart1.Series[1].YValueMembers = "size";
            Chart1.Series[2].XValueMember  = "animal";
            Chart1.Series[2].YValueMembers = "size";
            Chart1.DataBind();
            int i = 0;

            foreach (DataPoint d in Chart1.Series[0].Points)
            {
                d.ToolTip = chart.DT.Rows[i]["Question"].ToString();
                i++;
            }
            int j = 0;

            foreach (DataPoint d in Chart1.Series[1].Points)
            {
                d.ToolTip = chart.DT.Rows[i]["Question"].ToString();
                j++;
            }
            int k = 0;

            foreach (DataPoint d in Chart1.Series[1].Points)
            {
                d.ToolTip = chart.DT.Rows[i]["Question"].ToString();
                k++;
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Questions = new DataTable();

            if (!IsPostBack)
            {
                chkLogin();
                if (loggedin)
                {
                    user.ExcecuteQuery("select * from UserTable where UserID='" + Session["usr"] + "'");
                }
                DBC load = new DBC();
                load.ExcecuteQuery("Select * from Questions");
                Questions = load.DT;

                DBC    chart  = new DBC();
                Random random = new Random();
                chart.ExcecuteQuery("select * from Chart t1 inner join Questions t2 on t1.Qid=t2.id");
                Chart1.Series[0].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[0].MarkerStyle = MarkerStyle.Circle;
                Chart1.Series[1].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[1].MarkerStyle = MarkerStyle.Circle;
                Chart1.Series[2].ChartType   = SeriesChartType.Bubble;
                Chart1.Series[2].MarkerStyle = MarkerStyle.Circle;
                Chart1.ChartAreas[0].AxisX.MinorGrid.Enabled     = false;
                Chart1.ChartAreas[0].AxisX.MajorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisX.Interval = 0;

                Chart1.ChartAreas[0].AxisX.LabelStyle.ForeColor = Color.White;
                Chart1.ChartAreas[0].AxisY.LabelStyle.Enabled   = false;

                Chart1.ChartAreas[0].AxisY.MajorTickMark.Enabled = false;
                Chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;

                Chart1.ChartAreas[0].AxisX.LineWidth = 0;
                Chart1.ChartAreas[0].AxisY.LineWidth = 0;
                Chart1.DataSource              = chart.DT;
                Chart1.Series[0].XValueMember  = "nature";
                Chart1.Series[0].YValueMembers = "size";
                Chart1.Series[1].XValueMember  = "food";
                Chart1.Series[1].YValueMembers = "size";
                Chart1.Series[2].XValueMember  = "animal";
                Chart1.Series[2].YValueMembers = "size";
                Chart1.DataBind();
                int i = 0;
                foreach (DataPoint d in Chart1.Series[0].Points)
                {
                    d.ToolTip = chart.DT.Rows[i]["Question"].ToString();
                    i++;
                }
                int j = 0;
                foreach (DataPoint d in Chart1.Series[1].Points)
                {
                    d.ToolTip = chart.DT.Rows[j]["Question"].ToString();
                    j++;
                }
                int k = 0;
                foreach (DataPoint d in Chart1.Series[2].Points)
                {
                    d.ToolTip = chart.DT.Rows[k]["Question"].ToString();
                    k++;
                }
            }
            Posts = new DataTable();
        }