Example #1
0
        private void Printers_Load(object sender, EventArgs e)
        {
            lblPrintBuffer.BorderStyle = BorderStyle.None;
            lblPrintBuffer.AutoSize    = true;
            MethodsPrinters mp = new MethodsPrinters();

            mp.RefreshPrinters(dgvPrinters);
        }
Example #2
0
 private void btnPrintAdd_Click(object sender, EventArgs e)
 {
     if (tbPrintName.Text == "")
     {
         MessageBox.Show("Что забыл?", "Атата...", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         UseDB.InsertDB("Printers", "Name", "NetName", "Location", "InvNumber", tbPrintName.Text, tbPrintNetName.Text, tbPrintLocation.Text, tbPrintInvNumber.Text);
         MethodsPrinters mp = new MethodsPrinters();
         mp.RefreshPrinters(dgvPrinters);
         mp.ClearPrintTB(tbPrintName, tbPrintNetName, tbPrintLocation, tbPrintInvNumber);
     }
 }
Example #3
0
        private void btnPrintRemove_Click(object sender, EventArgs e)
        {
            if (dgvPrinters.SelectedRows.Count <= 0)
            {
                MessageBox.Show("Кого кикаем?", "Упс", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
            else
            {
                string strId    = dgvPrinters.SelectedCells[0].Value.ToString();
                string strValue = dgvPrinters.SelectedCells[1].Value.ToString();

                DialogResult result = MessageBox.Show
                                          ("Удалить запись?\n\n" + strValue, "Ты уверен?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    UseDB.DeleteDB("Printers", "Id", strId);
                    dgvPrinters.Rows.RemoveAt(dgvPrinters.CurrentRow.Index); //удаляет строку из DataGridView
                    MethodsPrinters mp = new MethodsPrinters();
                    mp.ClearPrintTB(tbPrintName, tbPrintNetName, tbPrintLocation, tbPrintInvNumber);
                }
            }
        }