コード例 #1
0
ファイル: frmMain.cs プロジェクト: AenBleidd/FreelanceManager
        private void menuReferenceSources_Click(object sender, EventArgs e)
        {
            if (db == null)
            {
                throw new Exception("fmDB is not assigned!");
            }
            SQLiteDataAdapter adapter = null;
            DataTable         table   = db.ExecuteReferenceSources(ref adapter);
            frmReference      frm     = new frmReference("Источники", table, false, false);
            DataGridView      tblData = null;

            frm.gettblData(ref tblData);

            foreach (DataGridViewColumn c in tblData.Columns)
            {
                if (c.Name == "SourceName")
                {
                    c.HeaderText   = "Наименование";
                    c.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
                else if (c.Name == "email")
                {
                    c.HeaderText   = "EMail";
                    c.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
                else
                {
                    c.Visible = false;
                }
            }

            DataGridViewButtonColumn btnColor = new DataGridViewButtonColumn();

            btnColor.HeaderText   = "Цвет";
            btnColor.Name         = "btnColor";
            btnColor.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
            tblData.Columns.Add(btnColor);
            tempTable             = tblData;
            tblData.CellClick    += new System.Windows.Forms.DataGridViewCellEventHandler(tblData_drawColorButtonSources_CellClick);
            tblData.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(tblData_drawColorButtonSources_CellPainting);

            DataGridViewCheckBoxColumn cbIsVisible = new DataGridViewCheckBoxColumn();

            cbIsVisible.HeaderText       = "Включено";
            cbIsVisible.Name             = "cbIsVisible";
            cbIsVisible.DataPropertyName = "isVisible";
            cbIsVisible.AutoSizeMode     = DataGridViewAutoSizeColumnMode.AllCells;
            tblData.Columns.Add(cbIsVisible);

            if (frm.ShowDialog() == DialogResult.OK)
            {
                adapter.Update(table);
                if (tableTasks != null && adapterTasks != null)
                {
                    tableTasks.Clear();
                    adapterTasks.Fill(tableTasks);
                }
            }
            frm.Dispose();
        }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: AenBleidd/FreelanceManager
        private void menuReferenceLanguages_Click(object sender, EventArgs e)
        {
            if (db == null)
            {
                throw new Exception("fmDB is not assigned!");
            }
            SQLiteDataAdapter adapter = null;
            DataTable         table   = db.ExecuteReferenceLanguages(ref adapter);
            frmReference      frm     = new frmReference("Языки", table, false, false);
            DataGridView      tblData = null;

            frm.gettblData(ref tblData);

            foreach (DataGridViewColumn c in tblData.Columns)
            {
                if (c.Name == "LanguageName")
                {
                    c.HeaderText   = "Наименование";
                    c.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                }
                else
                {
                    c.Visible = false;
                }
            }

            if (frm.ShowDialog() == DialogResult.OK)
            {
                adapter.Update(table);
                ShowTasks();
            }
            frm.Dispose();
        }