public void btnConfirm_Click(object sender, EventArgs e)
    {
        k = Convert.ToInt32(txtTrackNum.Text);
        TrainArrange ta = new TrainArrange(k, p1, type);
        bool         result;

        result = ta.Railroad(p1, p1.Length, k);
        if (result == false)
        {
            if (txtAdd.Text != null)
            {
                k += Convert.ToInt32(txtAdd.Text);
                TrainArrange ta1 = new TrainArrange(k, p1, type);
                result      = ta1.Railroad(p1, p1.Length, k);
                terminal    = ta1.ShowMsg();
                txtMsg.Text = ta1.ShowMsg();
                generateXML(terminal);
            }
        }
        else
        {
            terminal    = ta.ShowMsg();
            txtMsg.Text = ta.ShowMsg();
            generateXML(terminal);
        }
    }
    protected void btnOK_Click(object sender, EventArgs e)
    {
        if (n == 9 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null && t5.Text != null && t6.Text != null && t7.Text != null && t8.Text != null && t9.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 8 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null && t5.Text != null && t6.Text != null && t7.Text != null && t8.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 7 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null && t5.Text != null && t6.Text != null && t7.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 6 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null && t5.Text != null && t6.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 5 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null && t5.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 4 && t1.Text != null && t2.Text != null && t3.Text != null && t4.Text != null)
        {
            getArrayEachTime(n);
        }
        if (n == 3 && t1.Text != null && t2.Text != null && t3.Text != null)
        {
            getArrayEachTime(n);
        }

        k = Convert.ToInt32(txtTrackNum.Text);
        TrainArrange ta     = new TrainArrange(k, p1, type);
        bool         result = ta.Railroad(p1, p1.Length, k);

        if (result == false)
        {
            lblAdd.Visible = true;
            txtAdd.Visible = true;
        }
        else
        {
            RegisterClientScriptBlock("", "<script>alert('Run successfully!')</script>");
        }
    }