コード例 #1
0
    public List <DataManagment.task> getTasks(int appID)
    {
        List <DataManagment.task> retVal = new List <DataManagment.task>();
        string        command            = "SELECT * FROM Task WHERE appID='" + appID + "'";
        SqlCommand    com = new SqlCommand(command, conn);
        SqlDataReader reader;

        conn.Open();
        reader = com.ExecuteReader();
        while (reader.Read())
        {
            DataManagment.task temp = new DataManagment.task();
            temp.appID = reader.GetInt32(1);
            temp.name  = reader.GetString(2);
            try
            {
                temp.description = reader.GetString(3);
            }
            catch (Exception) { temp.description = ""; }
            try
            {
                temp.status = reader.GetInt32(4);
            }
            catch (Exception) { temp.status = 0; }
            retVal.Add(temp);
        }
        reader.Close();
        conn.Close();
        return(retVal);
    }
コード例 #2
0
        protected void Button5_Click(object sender, EventArgs e)
        {
            //  Table m = (Table) Session["tb"];
            Table m = Table1;
            List <DataManagment.task> ta = new List <DataManagment.task>();

            for (int i = 1; i < m.Rows.Count; i++)
            {
                DataManagment.task temptask = new DataManagment.task();
                CheckBox           cb       = new CheckBox();
                cb = (CheckBox)m.Rows[i].Cells[0].Controls[0];
                if (cb.Checked)
                {
                    temptask.status = 1;
                }
                else
                {
                    temptask.status = 0;
                }
                temptask.appID = Int32.Parse(Label11.Text);
                temptask.name  = m.Rows[i].Cells[2].Text;

                TextBox tb = new TextBox();
                tb = (TextBox)m.Rows[i].Cells[3].Controls[0];
                temptask.description = tb.Text;
                ta.Add(temptask);
            }
            db.updateTask(ta);
        }