public HabitDescription(JournalTask.EntryMode _entryMode, int _id) { InitializeComponent(); id = _id; entryMode = _entryMode; db = new DBTools(Properties.Settings.Default.ConnectionString); if (entryMode == JournalTask.EntryMode.edit) { this.Text = "Edit Habit"; // Query the category name string command = "select description, " + "isvisible " + "from habit " + "where id = @id"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) { Value = id } }; DataTable dataTable = db.GenericQueryAction(command, parameters); DataRow dataRow = dataTable.AsEnumerable().ToList()[0]; // Set the textbox to the category name txt_currentTaskDescription.Text = dataRow.Field <string>("description"); chk_taskIsVisible.Checked = dataRow.Field <bool>("isvisible"); } }
public CurrentTaskDescription(JournalTask.EntryMode _entryMode, int _id, int _layer, JournalTask.EntryType _entryType = JournalTask.EntryType.none) { InitializeComponent(); // initialize db db = new DBTools(Properties.Settings.Default.ConnectionString); // store ids id = _id; layer = _layer; // store mode mode = _entryMode; entryType = _entryType; cmb_taskType.SelectedIndex = 0; // Edit Mode if (mode == JournalTask.EntryMode.edit) { this.Text = "Edit Daily Task"; // Query the category name string command = "select description, " + "taskisimportant," + "tasktype " + "from currenttasks " + "where id = @id"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) { Value = id } }; DataTable dataTable = db.GenericQueryAction(command, parameters); DataRow dataRow = dataTable.AsEnumerable().ToList()[0]; // Set the textbox to the category name txt_currentTaskDescription.Text = dataRow.Field <string>("description"); cmb_taskType.SelectedIndex = dataRow.Field <int>("tasktype"); chk_taskIsImportant.Checked = dataRow.Field <bool>("taskisimportant"); } }
public NotesDescription(JournalTask.EntryMode _entryMode, int _id, int _layer) { InitializeComponent(); // initialize db db = new DBTools(Properties.Settings.Default.ConnectionString); // store ids id = _id; layer = _layer; // store mode mode = _entryMode; // Edit Mode if (mode == JournalTask.EntryMode.edit) { this.Text = "Edit Notes"; // Query the category name string command = "select noteDescription " + "from notes " + "where id = @id"; SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) { Value = id } }; DataTable dataTable = db.GenericQueryAction(command, parameters); DataRow dataRow = dataTable.AsEnumerable().ToList()[0]; // Set the textbox to the category name txt_notes.Text = dataRow.Field <string>("notedescription"); } }