Esempio n. 1
0
        private void agentSearchButton_Click(object sender, EventArgs e)
        {
            this.View.UseColumnTextForButtonValue = true;
            this.View.Text = "View";
            dataGridView1.Rows.Clear();
            string policyNumber    = "null";
            string clientFirstName = "null";
            string clientLastName  = "null";

            LIC_KIHD_MW.Agent agent = new LIC_KIHD_MW.Agent("", "", "", agentId);
            if (string.IsNullOrEmpty(policyNumBox.Text) && string.IsNullOrEmpty(clientNameBox.Text) && string.IsNullOrEmpty(ClientLastN.Text))
            {
                MessageBox.Show("Please enter policy number and client's name!");
            }
            else
            {
                if (!string.IsNullOrEmpty(policyNumBox.Text))
                {
                    policyNumber = policyNumBox.Text;
                }
                if (!string.IsNullOrEmpty(clientNameBox.Text))
                {
                    clientFirstName = clientNameBox.Text;
                }
                if (!string.IsNullOrEmpty(ClientLastN.Text))
                {
                    clientLastName = ClientLastN.Text;
                }

                List <string[]> search = agent.search(policyNumber, clientFirstName, clientLastName, agentId);

                if (search != null && search.Count > 0)
                {
                    for (int i = 0; i < search.Count; i++)
                    {
                        string[] row = new string[search[i].Length];
                        for (int j = 0; j < search[i].Length - 1; j++)
                        {
                            row[j] = search[i][j];
                        }
                        dataGridView1.Rows.Add(row);
                    }
                }
                else
                {
                    MessageBox.Show("No result is found");
                }
            }
        }