Ejemplo n.º 1
0
 private void listView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         AdvertisingСompany advСompany = listView1.SelectedItems[0].Tag as AdvertisingСompany;
         textBox1.Text = advСompany.Consumption.ToString();
         textBox2.Text = advСompany.Budget.ToString();
         textBox3.Text = (advСompany.Consumption - advСompany.Budget).ToString();
     }
     else
     {
     }
 }
Ejemplo n.º 2
0
        public void AddItem(int i)
        {
            AdvertisingСompany advertisingСomp = new AdvertisingСompany();

            advertisingСomp.IdType      = Convert.ToInt32(comboBoxType.SelectedItem.ToString().Split('.')[0]);
            advertisingСomp.IdClients   = Personal.Id;
            advertisingСomp.IdStatus    = Convert.ToInt32(comboBoxStatus.SelectedItem.ToString().Split('.')[0]);
            advertisingСomp.IdStrategy  = Convert.ToInt32(comboBoxStrategy.SelectedItem.ToString().Split('.')[0]);
            advertisingСomp.IdPlace     = Convert.ToInt32(comboBoxPlace.SelectedItem.ToString().Split('.')[0]);
            advertisingСomp.Consumption = Convert.ToInt32(textBox1.Text);
            advertisingСomp.Budget      = 0;
            advertisingСomp.IdAdvComp   = i;
            Program.sinDB.AdvertisingСompany.Add(advertisingСomp);
            Program.sinDB.SaveChanges();
            ShowListView();
        }
Ejemplo n.º 3
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         if (textBox4.Text != "" & textBox5.Text != "")
         {
             AdvertisingСompany advComp = listView1.SelectedItems[0].Tag as AdvertisingСompany;
             advComp.Budget = (advComp.Budget + Convert.ToInt32(textBox4.Text));
             Program.sinDB.SaveChanges();
             ShowListView();
         }
         else
         {
             label9.Text = "Вы не ввели какие-то данные";
         }
     }
     else
     {
     }
 }
Ejemplo n.º 4
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (listView1.SelectedItems.Count == 1)
         {
             AdvertisingСompany advCamp = listView1.SelectedItems[0].Tag as AdvertisingСompany;
             Program.sinDB.AdvertisingСompany.Remove(advCamp);
             Program.sinDB.SaveChanges();
             ShowListView();
         }
         else
         {
             textBox1.Text = "";
         }
     }
     catch
     {
         MessageBox.Show("Невозможно удалить, эта запись используется!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }