Ejemplo n.º 1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewYuridicheskoyeLitso.SelectedItems.Count == 1)
            {
                YuridicheskoyeLitsoSet yuridicheskoyeLitsoSet = listViewYuridicheskoyeLitso.SelectedItems[0].Tag as YuridicheskoyeLitsoSet;
                yuridicheskoyeLitsoSet.SokrashchennoyeNaimenovaniye = textBoxSokrashchennoyeNaimenovaniye.Text;

                yuridicheskoyeLitsoSet.Addres = textBoxAddres.Text;
                yuridicheskoyeLitsoSet.INN    = textBoxINN.Text;
                yuridicheskoyeLitsoSet.KPP    = textBoxKPP.Text;



                Program.kontragenty.SaveChanges();
                Showt();
            }
        }
Ejemplo n.º 2
0
 private void listViewYuridicheskoyeLitso_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewYuridicheskoyeLitso.SelectedItems.Count == 1)
     {
         YuridicheskoyeLitsoSet yuridicheskoyeLitsoSet = listViewYuridicheskoyeLitso.SelectedItems[0].Tag as YuridicheskoyeLitsoSet;
         textBoxSokrashchennoyeNaimenovaniye.Text = yuridicheskoyeLitsoSet.SokrashchennoyeNaimenovaniye;
         textBoxAddres.Text = yuridicheskoyeLitsoSet.Addres;
         textBoxINN.Text    = yuridicheskoyeLitsoSet.INN;
         textBoxKPP.Text    = yuridicheskoyeLitsoSet.KPP;
     }
     else
     {
         textBoxSokrashchennoyeNaimenovaniye.Text = "";
         textBoxAddres.Text = "";
         textBoxINN.Text    = "";
         textBoxKPP.Text    = "";
     }
 }
Ejemplo n.º 3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (comboBoxMen.SelectedItem != null)
            {
                YuridicheskoyeLitsoSet yuridicheskoyeLitsoSet = new YuridicheskoyeLitsoSet();
                yuridicheskoyeLitsoSet.SokrashchennoyeNaimenovaniye = textBoxSokrashchennoyeNaimenovaniye.Text;
                yuridicheskoyeLitsoSet.Addres = textBoxAddres.Text;
                yuridicheskoyeLitsoSet.INN    = textBoxINN.Text;
                yuridicheskoyeLitsoSet.KPP    = textBoxKPP.Text;



                yuridicheskoyeLitsoSet.Id_men = Convert.ToInt32(comboBoxMen.SelectedItem.ToString().Split('.')[0]);


                Program.kontragenty.YuridicheskoyeLitsoSet.Add(yuridicheskoyeLitsoSet);
                Program.kontragenty.SaveChanges();
                Showt();
            }
        }
Ejemplo n.º 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewYuridicheskoyeLitso.SelectedItems.Count == 1)
         {
             YuridicheskoyeLitsoSet yuridicheskoyeLitsoSet = listViewYuridicheskoyeLitso.SelectedItems[0].Tag as YuridicheskoyeLitsoSet;
             Program.kontragenty.YuridicheskoyeLitsoSet.Remove(yuridicheskoyeLitsoSet);
             Program.kontragenty.SaveChanges();
             Showt();
         }
         textBoxSokrashchennoyeNaimenovaniye.Text = "";
         textBoxAddres.Text = "";
         textBoxINN.Text    = "";
         textBoxKPP.Text    = "";
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }