Exemple #1
0
 agent addAgent(agent agentSet)
 {
     agentSet.FirstName  = textBoxFirstName.Text;
     agentSet.MiddleName = textBoxMiddleName.Text;
     agentSet.LastName   = textBoxLastName.Text;
     agentSet.DealShare  = Convert.ToInt32(numericUpDownDealShare.Text);
     return(agentSet);
 }
Exemple #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            agent agentSet = new agent();

            agentSet = addAgent(agentSet);

            Program.wftDb.agent.Add(agentSet);
            Program.wftDb.SaveChanges();
            ShowAgent();
        }
Exemple #3
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewAgent.SelectedItems.Count == 1)
            {
                agent agentSet = (agent)listViewAgent.SelectedItems[0].Tag;

                agentSet = addAgent(agentSet);

                Program.wftDb.SaveChanges();
                ShowAgent();
            }
        }
Exemple #4
0
        private void listViewAgent_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (listViewAgent.SelectedItems.Count == 1)
            {
                agent agentSet = (agent)listViewAgent.SelectedItems[0].Tag;

                textBoxFirstName.Text       = agentSet.FirstName;
                textBoxMiddleName.Text      = agentSet.MiddleName;
                textBoxLastName.Text        = agentSet.LastName;
                numericUpDownDealShare.Text = Convert.ToString(agentSet.DealShare);
            }
            else
            {
                textBoxFirstName.Text       = "";
                textBoxMiddleName.Text      = "";
                textBoxLastName.Text        = "";
                numericUpDownDealShare.Text = "";
            }
        }
Exemple #5
0
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (listViewAgent.SelectedItems.Count == 1)
                {
                    agent agentSet = (agent)listViewAgent.SelectedItems[0].Tag;

                    Program.wftDb.agent.Remove(agentSet);
                    Program.wftDb.SaveChanges();
                    ShowAgent();
                }

                textBoxFirstName.Text       = "";
                textBoxMiddleName.Text      = "";
                textBoxLastName.Text        = "";
                numericUpDownDealShare.Text = "";
            }
            catch
            {
                MessageBox.Show("Невозможно удалить", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }