Пример #1
0
        // Display All Plans
        private void Button2_Click(object sender, EventArgs e)
        {
            List <Plans> show;

            show = Plans.showExistingPlans();
            dataGridView1.DataSource = show;
        }
Пример #2
0
        public CustomerPortal()
        {
            InitializeComponent();
            label1.Text = " Welcome " + Form1.username + " !";
            dataGridView1.DataSource = Plans.showExistingPlans();
            comboBox1.Text           = "All Available";

            if (Form1.username == "Chairman")
            {
                button2.Visible = true;
            }
            else
            {
                button2.Visible = false;
            }
        }
Пример #3
0
        //Show results button clicked
        private void Button4_Click(object sender, EventArgs e)
        {
            //do
            //{
            //    foreach (DataGridViewRow row in dataGridView1.Rows)
            //    {
            //        try
            //        {
            //            dataGridView1.Rows.Remove(row);
            //        }
            //        catch (Exception) { }
            //    }
            //} while (dataGridView1.Rows.Count > 1);

            //dataGridView1.Rows.Clear();
            //dataGridView1.Refresh();

            if (comboBox1.Text == "All available")
            {
                List <Plans> show;


                dataGridView1.DataSource = null;
                show = Plans.showExistingPlans();

                if (show != null)
                {
                    dataGridView1.DataSource = show;
                    //dataGridView1.DataSource = null;
                    //dataGridView1.AllowUserToOrderColumns = true;
                    //dataGridView1.ColumnCount = 6;

                    //dataGridView1.Columns[0].Name = "Plan Id";
                    //dataGridView1.Columns[1].Name = "Plan Name";
                    //dataGridView1.Columns[2].Name = "Plan Type";
                    //dataGridView1.Columns[3].Name = "Plan Description";
                    //dataGridView1.Columns[4].Name = "Minimum Policy Term";
                    //dataGridView1.Columns[5].Name = "Minimum Policy Amount";

                    //string[] rows;
                    //for (int i = 0; i < show.Count; i++)
                    //{
                    //    DataGridViewRow r = new DataGridViewRow();
                    //    rows = new string[] {
                    //                            show[i].planId.ToString() ,
                    //                            show[i].planName ,
                    //                            show[i].planCategory,
                    //                            show[i].planDescription,
                    //                            show[i].minimumTermSpan.ToString(),
                    //                            show[i].minimumAmount.ToString()
                    //                        };
                    //    r.SetValues(rows);
                    //    dataGridView1.Rows.Add(r);
                    //}
                    //show.Clear();
                }
            }
            else if (comboBox1.Text == "My Ongoing")
            {
                List <PolicyHolders> ongoing = null;
                ongoing = PolicyHolders.showOngoingPolicies();

                if (ongoing != null)
                {
                    var l = (from obj in ongoing select new { obj.policyNo, obj.planId.planId, obj.planId.planName,
                                                              obj.planId.planCategory, obj.policyTerm, obj.frequency, obj.optedAmount }).ToList();
                    dataGridView1.DataSource = l;

                    //dataGridView1.AllowUserToOrderColumns = true;
                    //dataGridView1.ColumnCount = 7;

                    //dataGridView1.Columns[0].Name = "Client Policy No";
                    //dataGridView1.Columns[1].Name = "Plan Id";
                    //dataGridView1.Columns[2].Name = "Plan Name";
                    //dataGridView1.Columns[3].Name = "Plan Type";
                    //dataGridView1.Columns[4].Name = "Policy Term";
                    //dataGridView1.Columns[5].Name = "Premium Payment Freq.";
                    //dataGridView1.Columns[6].Name = "Total Policy Amount";
                    //string[] rows;
                    //for(int i=0; i<ongoing.Count; i++)
                    //{
                    //    DataGridViewRow r = new DataGridViewRow();
                    //    rows = new string[] {   ongoing[i].policyNo.ToString() ,
                    //                            ongoing[i].planId.planId.ToString() ,
                    //                            ongoing[i].planId.planName,
                    //                            ongoing[i].planId.planCategory,
                    //                            ongoing[i].policyTerm.ToString(),
                    //                            ongoing[i].frequency,
                    //                            ongoing[i].optedAmount.ToString()
                    //                        };
                    //    r.SetValues(rows);
                    //    dataGridView1.Rows.Add(r);
                    //}
                    //ongoing.Clear();
                }
                else
                {
                    MessageBox.Show(" You do not have any ongoing policies! ");
                }
            }
        }
Пример #4
0
 public ManagePlans()
 {
     InitializeComponent();
     dataGridView1.DataSource = Plans.showExistingPlans();
 }