Ejemplo n.º 1
0
        private void Submit_Click(object sender, EventArgs e)
        {
            bool fieldFilled = true;

            foreach (TextBox tb in GetControls(this).OfType <TextBox>())
            {
                if (string.IsNullOrEmpty(tb.Text))
                {
                    fieldFilled = false;
                }
            }

            if (fieldFilled && comboBox1.SelectedIndex > -1)
            {
                LIC_KIHD_MW.Manager manager = new LIC_KIHD_MW.Manager("", "", "", "", "", "");
                // LIC_KIHD_MW.Manager agentRegister = new LIC_KIHD_MW.Manager(IDBOX.Text, FNameBox.Text, LNameBox.Text, userType, comboBox1.Text, UserNameBox.Text, PasswordBox.Text);
                ID = manager.userRegister(UserNameBox.Text, FNameBox.Text, LNameBox.Text, PasswordBox.Text, userType, comboBox1.Text);
                MessageBox.Show("You have successfully registered the agent and ID is " + ID);
                this.Close();
            }

            else
            {
                MessageBox.Show(String.Format("You need to fill all the boxes"));
            }
        }
Ejemplo n.º 2
0
        private void agentSearchButton_Click(object sender, EventArgs e)
        {
            dataGridView1.Rows.Clear();
            string policyNumber    = string.IsNullOrEmpty(barForPolicyNumber.Text)?  "null" : barForPolicyNumber.Text;
            string clientFirstName = string.IsNullOrEmpty(barForClientFirstName.Text) ? "null" : barForClientFirstName.Text;
            string clientLastName  = string.IsNullOrEmpty(barForClientLastN.Text) ? "null" : barForClientLastN.Text;
            string agentFirstName  = string.IsNullOrEmpty(barForAgentFirstName.Text) ? "null" : barForAgentFirstName.Text;
            string agentLastName   = string.IsNullOrEmpty(BarForAgentLastName.Text) ? "null" : BarForAgentLastName.Text;

            if (string.IsNullOrEmpty(barForPolicyNumber.Text) && string.IsNullOrEmpty(barForAgentFirstName.Text) && string.IsNullOrEmpty(barForClientFirstName.Text) &&
                string.IsNullOrEmpty(barForClientLastN.Text) && string.IsNullOrEmpty(BarForAgentLastName.Text))
            {
                MessageBox.Show("Please enter policy number and client's name!");
            }
            else
            {
                LIC_KIHD_MW.Manager agent = new LIC_KIHD_MW.Manager(agentFirstName, agentLastName, "", "", "", agentID);

                List <string[]> search = agent.managerSearch(policyNumber, clientFirstName, clientLastName, agentFirstName, agentLastName);
                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; j++)
                        {
                            row[j] = search[i][j];
                        }
                        dataGridView1.Rows.Add(row);
                    }
                }
                else
                {
                    MessageBox.Show("No result is found.");
                }
            }
        }