예제 #1
0
        public void Delete(int idInstraction)
        {
            Instraction instraction = getItem(idInstraction);

            list.Remove(instraction);

            instraction.Delete();
        }
예제 #2
0
        public void Add(Instraction instraction)
        {
            if (list.Exists(item => item == instraction))
            {
                return;
            }

            list.Add(instraction);
        }
예제 #3
0
        protected override void LoadFromSql()
        {
            DataTable dt = Provider.Select("Instraction");

            foreach (DataRow row in dt.Rows)
            {
                Instraction instraction = new Instraction(row);
                Add(instraction);
            }
        }
예제 #4
0
        private void FillInstraction()
        {
            InstractionList instractionList = InstractionList.getInstance();
            Instraction     instraction     = instractionList.getItem(_driver);

            if (instraction != null)
            {
                instractionInfo.Text = instraction.ToString();
            }
        }
예제 #5
0
        private void LoadData()
        {
            dgvInstractions.DataSource         = instractionList.ToDataTable(_driver);
            dgvInstractions.Columns[0].Visible = false;

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

                Instraction instraction = instractionList.getItem(id);

                if (instraction.File != string.Empty)
                {
                    row.DefaultCellStyle.BackColor = BBColors.bbGreen3;
                }
            }
        }
예제 #6
0
        private void dgvInstractions_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (isCellNoHeader(e.RowIndex))
            {
                int         idInstraction = Convert.ToInt32(dgvInstractions.Rows[e.RowIndex].Cells[0].Value);
                Instraction instraction   = instractionList.getItem(idInstraction);

                if ((dgvInstractions.Columns[e.ColumnIndex].HeaderText == "Номер") && (instraction.File != string.Empty))
                {
                    WorkWithFiles.openFile(instraction.File);
                }
                else
                {
                    Instraction_AddEdit instAE = new Instraction_AddEdit(instraction);
                    if (instAE.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        LoadData();
                    }
                }
            }
        }
예제 #7
0
        public Instraction_AddEdit(Instraction instraction)
        {
            InitializeComponent();

            _instraction = instraction;
        }