Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            SupplierSet supplierSet = new SupplierSet();

            supplierSet.SupplierName       = textBoxName.Text;
            supplierSet.SupplierAdress     = textBoxAdress.Text;
            supplierSet.SupplierPhone      = textBoxPhone.Text;
            supplierSet.SupplierEmail      = textBoxEmail.Text;
            supplierSet.SupplierRequisites = textBoxRequisits.Text;
            Program.dinamoDB.SupplierSet.Add(supplierSet);
            Program.dinamoDB.SaveChanges();
            ShowSupplier();
        }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewSupplier.SelectedItems.Count == 1)
     {
         SupplierSet supplierSet = listViewSupplier.SelectedItems[0].Tag as SupplierSet;
         supplierSet.SupplierName       = textBoxName.Text;
         supplierSet.SupplierAdress     = textBoxAdress.Text;
         supplierSet.SupplierPhone      = textBoxPhone.Text;
         supplierSet.SupplierEmail      = textBoxEmail.Text;
         supplierSet.SupplierRequisites = textBoxRequisits.Text;
         Program.dinamoDB.SaveChanges();
         ShowSupplier();
     }
 }
Esempio n. 3
0
 private void listViewSupplier_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSupplier.SelectedItems.Count == 1)
     {
         SupplierSet supplierSet = listViewSupplier.SelectedItems[0].Tag as SupplierSet;
         supplierSet.SupplierName       = textBoxName.Text;
         supplierSet.SupplierAdress     = textBoxAdress.Text;
         supplierSet.SupplierPhone      = textBoxPhone.Text;
         supplierSet.SupplierEmail      = textBoxEmail.Text;
         supplierSet.SupplierRequisites = textBoxRequisits.Text;
     }
     else
     {
         textBoxName.Text      = "";
         textBoxAdress.Text    = "";
         textBoxPhone.Text     = "";
         textBoxEmail.Text     = "";
         textBoxRequisits.Text = "";
     }
 }
Esempio n. 4
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewSupplier.SelectedItems.Count == 1)
         {
             SupplierSet supplierSet = listViewSupplier.SelectedItems[0].Tag as SupplierSet;
             Program.dinamoDB.SupplierSet.Remove(supplierSet);
             Program.dinamoDB.SaveChanges();
             ShowSupplier();
         }
         textBoxName.Text      = "";
         textBoxAdress.Text    = "";
         textBoxPhone.Text     = "";
         textBoxEmail.Text     = "";
         textBoxRequisits.Text = "";
     }
     catch
     {
         MessageBox.Show("невозможно удалить, эта запись используется", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }