Esempio n. 1
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            //Get agent from selection
            int agentId = Convert.ToInt32(dgvAgents.SelectedRows[0].Cells[0].Value);

            try
            {
                agent = AgentDB.GetAgent(agentId);

                frmAgentModify modifyAgentForm = new frmAgentModify();
                modifyAgentForm.addAgent = false;
                modifyAgentForm.agent    = agent;

                DialogResult result = modifyAgentForm.ShowDialog();
                if (result == DialogResult.OK)
                {
                    agent = modifyAgentForm.agent;
                    SearchFor();
                }
                else if (result == DialogResult.Retry)
                {
                    //this.GetAgent(agent.AgentId);
                    SearchFor();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
Esempio n. 2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            frmAgentModify addAgentForm = new frmAgentModify();

            addAgentForm.addAgent = true;
            DialogResult result = addAgentForm.ShowDialog();

            if (result == DialogResult.OK)
            {
                agent           = addAgentForm.agent;
                txtAgentId.Text = agent.AgentId.ToString();
            }
        }