Exemplo n.º 1
0
        public void Delete(int idDTPFile)
        {
            DTPFile dtpFile = getItem(idDTPFile);

            list.Remove(dtpFile);

            dtpFile.Delete();
        }
Exemplo n.º 2
0
        public void Add(DTPFile dtpFile)
        {
            if (list.Exists(item => item.ID == dtpFile.ID))
            {
                return;
            }

            list.Add(dtpFile);
        }
Exemplo n.º 3
0
        protected override void loadFromSql()
        {
            DataTable dt = _provider.Select("DTPFile");

            foreach (DataRow row in dt.Rows)
            {
                DTPFile dtpFile = new DTPFile(row);
                Add(dtpFile);
            }
        }
Exemplo n.º 4
0
        private void FillDgv()
        {
            _dgvFile.DataSource = _dtpFileList.ToDataTable(_dtp);

            _dgvFile.Columns[0].Visible = false;

            _dgvFile.Columns[1].Width = _dgvFile.Width / 2;
            _dgvFile.Columns[2].Width = _dgvFile.Width / 2;

            foreach (DataGridViewRow row in _dgvFile.Rows)
            {
                int id = 0;
                int.TryParse(row.Cells[0].Value.ToString(), out id);

                DTPFile dtpFile = _dtpFileList.getItem(id);

                if (dtpFile.File != string.Empty)
                {
                    row.DefaultCellStyle.BackColor = BBColors.bbGreen3;
                }
            }
        }
Exemplo n.º 5
0
        private void _dgvFile_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (isCellNoHeader(e.RowIndex))
            {
                int idDTPFile;
                int.TryParse(_dgvFile.Rows[e.RowIndex].Cells[0].Value.ToString(), out idDTPFile);

                DTPFile dtpFile = _dtpFileList.getItem(idDTPFile);

                if ((e.ColumnIndex == 2) && (dtpFile.File != string.Empty))
                {
                    WorkWithFiles.OpenFile(dtpFile.File);
                }
                else
                {
                    DTPFile_AddEdit dtpFAE = new DTPFile_AddEdit(dtpFile);
                    if (dtpFAE.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        FillDgv();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void btnAddFile_Click(object sender, EventArgs e)
        {
            if (tryCopyData())
            {
                _dtp.Save();

                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Multiselect = true;
                ofd.ShowDialog();

                foreach (string file in ofd.FileNames)
                {
                    DTPFile dtpFile = _dtp.createFile();

                    dtpFile.Name = Path.GetFileNameWithoutExtension(file);
                    dtpFile.File = file;
                    dtpFile.Save();

                    _dtpFileList.Add(dtpFile);
                }

                FillDgv();
            }
        }
Exemplo n.º 7
0
        public DTPFile_AddEdit(DTPFile dtpFile)
        {
            InitializeComponent();

            _dtpFile = dtpFile;
        }