Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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");
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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"));
        }
Exemplo n.º 5
0
        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");
            }
        }
Exemplo n.º 6
0
        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"));
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
 private void OnConnectionChange()
 {
     db = new DBTools(Properties.Settings.Default.ConnectionString);
     RefreshGrid();
 }
Exemplo n.º 9
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            db = new DBTools(Properties.Settings.Default.ConnectionString);

            RefreshGrid();
        }