示例#1
0
文件: Agents.cs 项目: kenderanden/RP
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listView.SelectedItems.Count == 1)
            {
                AgentsSet agentsSet = listView.SelectedItems[0].Tag as AgentsSet;

                agentsSet.FirstName  = textBoxName.Text;
                agentsSet.MiddleName = textBoxMiddleName.Text;
                agentsSet.LastName   = textBoxLastName.Text;
                agentsSet.DealShare  = textBoxDealShare.Text;

                Program.RPE.SaveChanges();
                ShowlistView();
            }
            else
            {
                textBoxName.Text       = "";
                textBoxMiddleName.Text = "";
                textBoxLastName.Text   = "";
                textBoxDealShare.Text  = "";
            }
        }
示例#2
0
文件: Agents.cs 项目: kenderanden/RP
        private void buttonDel_Click(object sender, EventArgs e)
        {
            try
            {
                if (listView.SelectedItems.Count == 1)
                {
                    AgentsSet agentsSet = listView.SelectedItems[0].Tag as AgentsSet;

                    Program.RPE.AgentsSet.Remove(agentsSet);

                    Program.RPE.SaveChanges();

                    ShowlistView();
                }
                textBoxDealShare.Text  = "";
                textBoxLastName.Text   = "";
                textBoxMiddleName.Text = "";
                textBoxName.Text       = "";
            }
            catch
            {
                MessageBox.Show("Невозможно удалить, эта запись используется.", "Ошибка!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }