Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            AgentSet agentsSet = new AgentSet();

            agentsSet.Name        = textBoxName.Text;
            agentsSet.mesto       = textBoxmesto.Text;
            agentsSet.Napravlenie = textBoxNapravlenie.Text;
            agentsSet.time        = textBoxtime.Text;
            Program.BD.AgentSet.Add(agentsSet);
            Program.BD.SaveChanges();
            ShowAgent();
        }
Esempio n. 2
0
 private void buttonEdit_Click(object sender, EventArgs e)
 {
     if (listViewAgent.SelectedItems.Count == 1)
     {
         AgentSet agentSet = listViewAgent.SelectedItems[0].Tag as AgentSet;
         agentSet.Name        = textBoxName.Text;
         agentSet.mesto       = textBoxmesto.Text;
         agentSet.Napravlenie = textBoxNapravlenie.Text;
         agentSet.time        = textBoxtime.Text;
         Program.BD.SaveChanges();
         ShowAgent();
     }
 }
Esempio n. 3
0
 private void listViewAgent_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewAgent.SelectedItems.Count == 1)
     {
         AgentSet agentSet = listViewAgent.SelectedItems[0].Tag as AgentSet;
         textBoxName.Text        = agentSet.Name;
         textBoxmesto.Text       = agentSet.mesto;
         textBoxNapravlenie.Text = agentSet.Napravlenie;
         textBoxtime.Text        = agentSet.time;
     }
     else
     {
         textBoxName.Text        = "";
         textBoxNapravlenie.Text = "";
         textBoxmesto.Text       = "";
         textBoxtime.Text        = "";
     }
 }
Esempio n. 4
0
 private void buttonDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (listViewAgent.SelectedItems.Count == 1)
         {
             AgentSet agentSet = listViewAgent.SelectedItems[0].Tag as AgentSet;
             Program.BD.AgentSet.Remove(agentSet);
             Program.BD.SaveChanges();
             ShowAgent();
         }
         textBoxName.Text        = "";
         textBoxNapravlenie.Text = "";
         textBoxmesto.Text       = "";
         textBoxtime.Text        = "";
     }
     catch
     {
         MessageBox.Show("не возможно удалить эту запись, эта запись используется!", "ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }