コード例 #1
0
 public void ShowData2(clsC blockc)
 {
     txtName.Text       = blockc.Name;
     txtAddress.Text    = blockc.Address;
     txtId.Text         = blockc.Id.ToString();
     txtPriority.Text   = blockc.Priority.ToString();
     txtLiterature.Text = blockc.Markl.ToString();
     txtHistory.Text    = blockc.Markh.ToString();
     txtGeoraphy.Text   = blockc.Markg.ToString();
 }
コード例 #2
0
 void BtnDeleteClick(object sender, EventArgs e)
 {
     try
     {
         clsB current = (clsB)source[dgshow.CurrentRowIndex];
         source.RemoveAt(dgshow.CurrentRowIndex);
     }catch
     {
     }
     try
     {
         clsA current1 = (clsA)source1[dgshow.CurrentRowIndex];
         source1.RemoveAt(dgshow.CurrentRowIndex);
     }catch
     {
     }
     try
     {
         clsC current2 = (clsC)source2[dgshow.CurrentRowIndex];
         source2.RemoveAt(dgshow.CurrentRowIndex);
     }catch
     {
     }
 }
コード例 #3
0
        void BtnAddClick(object sender, EventArgs e)
        {
            for (int i = 0; i < A.Count; i++)
            {
                if (txtId.Text == A[i].Id.ToString())
                {
                    MessageBox.Show("This id has used! // Please input valid ID. Thanks");
                    ClearData();
                }
            }
            for (int i = 0; i < B.Count; i++)
            {
                if (txtId.Text == B[i].Id.ToString())
                {
                    MessageBox.Show("This id has used! // Please input valid ID. Thanks");
                    ClearData();
                }
            }
            for (int i = 0; i < C.Count; i++)
            {
                if (txtId.Text == C[i].Id.ToString())
                {
                    MessageBox.Show("This id has used! // Please input valid ID. Thanks");
                    ClearData();
                }
            }
            if (txtAddress.Text == "" || txtPriority.Text == "" || txtName.Text == "" || txtId.Text == "" || txtId.Text.Length != 5)
            {
                ClearData();
            }
            else
            {
                int scan = 0;

                if (rdbA.Checked == true)
                {
                    scan = 1;
                }
                if (rdbB.Checked == true)
                {
                    scan = 2;
                }
                if (rdbC.Checked == true)
                {
                    scan = 3;
                }

                if (scan == 1)
                {
                    if (txtMath.Text == "" || txtPhysicalA.Text == "" || txtPhysicalA.Text == "")
                    {
                        ClearData();
                    }
                    else
                    {
                        dgshow.DataSource = source1;
                        a.Name            = txtName.Text;
                        a.Id       = int.Parse(txtId.Text);
                        a.Address  = txtAddress.Text;
                        a.Priority = int.Parse(txtPriority.Text);
                        a.Markc    = double.Parse(txtChemistryA.Text);
                        a.Markm    = double.Parse(txtMath.Text);
                        a.Markp    = double.Parse(txtPhysicalA.Text);
                        source1.Add(a);
                        a = new clsA();
                        ClearData();
                        dgshow.Refresh();
                    }
                }
                if (scan == 2)
                {
                    if (txtBiology.Text == "" || txtPhysicalB.Text == "" || txtChemistryB.Text == "")
                    {
                        ClearData();
                    }
                    else
                    {
                        dgshow.DataSource = source;
                        b.Name            = txtName.Text;
                        b.Id       = int.Parse(txtId.Text);
                        b.Address  = txtAddress.Text;
                        b.Priority = int.Parse(txtPriority.Text);
                        b.Markb    = double.Parse(txtBiology.Text);
                        b.Markc    = double.Parse(txtChemistryB.Text);
                        b.Markp    = double.Parse(txtPhysicalB.Text);
                        source.Add(b);
                        b = new clsB();
                        ClearData();
                        dgshow.Refresh();
                    }
                }
                if (scan == 3)
                {
                    if (txtHistory.Text == "" || txtGeoraphy.Text == "" || txtLiterature.Text == "")
                    {
                        ClearData();
                    }
                    else
                    {
                        dgshow.DataSource = source1;
                        c.Name            = txtName.Text;
                        c.Id       = int.Parse(txtId.Text);
                        c.Address  = txtAddress.Text;
                        c.Priority = int.Parse(txtPriority.Text);
                        c.Markh    = double.Parse(txtHistory.Text);
                        c.Markg    = double.Parse(txtGeoraphy.Text);
                        c.Markl    = double.Parse(txtLiterature.Text);
                        source2.Add(c);
                        c = new clsC();
                        ClearData();
                        dgshow.Refresh();
                    }
                }
            }
        }