示例#1
0
        private void AddAgent()
        {
            // Show Modal Dialog
            var dlg = new AgentWindow();

            dlg.Title = "Add New Agent";
            Agent newAgent = new Agent();

            dlg.DataContext = newAgent;
            if (dlg.ShowDialog() == true)
            {
                Add(newAgent);
                CurrentSpecialityIndex = 0;
                CurrentAgent           = newAgent;
            }
        }
示例#2
0
        private void EditAgent()
        {
            // Show Modal Dialog
            var dlg = new AgentWindow();

            dlg.Title = "Edit Agent";
            // Need a temp agent in case of cancel
            Agent tempAgent = new Agent();

            tempAgent.ID         = CurrentAgent.ID;
            tempAgent.CodeName   = currentAgent.CodeName;
            tempAgent.Speciality = currentAgent.Speciality;
            tempAgent.Assignment = currentAgent.Assignment;
            dlg.DataContext      = tempAgent;
            if (dlg.ShowDialog() == true)
            {
                CurrentAgent.ID         = tempAgent.ID;
                currentAgent.CodeName   = tempAgent.CodeName;
                currentAgent.Speciality = tempAgent.Speciality;
                currentAgent.Assignment = tempAgent.Assignment;
            }
        }