public MonthlyTasksContent(int _id, int _layer, string _title) { InitializeComponent(); db = new DBTools(Properties.Settings.Default.ConnectionString); lbl_title.Text = _title; id = _id; layer = _layer; Populate_Contents(id, layer); }
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 History(JournalTask.EntryType _entryType, string _title, int _layer = 0, int _currentId = 0) { InitializeComponent(); db = new DBTools(Properties.Settings.Default.ConnectionString); entryType = _entryType; layer = _layer; currentId = _currentId; lbl_title.Text = _title; DataGridViewButtonColumn button = new DataGridViewButtonColumn(); button.Name = "btn_undo"; button.HeaderText = "Action"; button.Text = "Undo"; button.UseColumnTextForButtonValue = true; dataGrid_content.Columns.Add(button); GridController(entryType); }
public static int GetFutureLayer(int _id) { DBTools db = new DBTools(Properties.Settings.Default.ConnectionString); string queryCommand = "select layerid " + "from futuretasks " + "where id = @id"; SqlParameter[] queryParameter = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int) { Value = _id } }; DataTable dataTable = db.GenericQueryAction(queryCommand, queryParameter); DataRow dataRow = dataTable.AsEnumerable().ToList()[0]; return(dataRow.Field <int>("layerid")); }
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"); } }
public static int GetPreviousLayerId(int _id, JournalTask.EntryType _entryType) { DBTools db = new DBTools(Properties.Settings.Default.ConnectionString); string command = ""; if (_entryType == JournalTask.EntryType.daily) { command = "select previouslayerid from currenttasks " + "where id = @id"; } if (_entryType == JournalTask.EntryType.monthly) { command = "select previouslayerid from monthlytasks " + "where id = @id"; } if (_entryType == JournalTask.EntryType.future) { command = "select previouslayerid from futuretaks " + "where id = @id"; } SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("id", SqlDbType.Int) { Value = _id } }; DataTable dataTable = db.GenericQueryAction(command, parameter); DataRow row = dataTable.AsEnumerable().ToList()[0]; return(row.Field <int>("previouslayerid")); }
public Migration ( JournalTask.EntryType _entryTypeFr, JournalTask.EntryType _entryTypeTo, int _sourceId, string _title, int _layer, int _currentId = 0 ) { InitializeComponent(); db = new DBTools(Properties.Settings.Default.ConnectionString); entryTypeFr = _entryTypeFr; entryTypeTo = _entryTypeTo; sourceId = _sourceId; layer = _layer; currentId = _currentId; lbl_title.Text = _title; GridController(entryTypeTo); }
private void OnConnectionChange() { db = new DBTools(Properties.Settings.Default.ConnectionString); RefreshGrid(); }
private void MainForm_Load(object sender, EventArgs e) { db = new DBTools(Properties.Settings.Default.ConnectionString); RefreshGrid(); }