Ejemplo n.º 1
0
        void BtnAcceptClick(object sender, EventArgs e)
        {
            int l = txtCost.Text.Length - 1;

            for (int i = 0; i < peolist.Count; i++)
            {
                if (txtID.Text == peolist[i].ID.ToString())
                {
                    ClearData();
                    MessageBox.Show("That ID has used.");
                }
            }
            if (txtAge.Text == "" || txtCost.Text == "" || txtDob.Text == "" || txtID.Text == "" || txtName.Text == "" || txtTime.Text == "" || txtID.Text.Length != 5)
            {
                ClearData();
            }
            else
            {
                people.Name = txtName.Text;
                people.ID   = int.Parse(txtID.Text);
                people.Age  = int.Parse(txtAge.Text);
                people.Stay = int.Parse(txtTime.Text);
                people.Date = int.Parse(txtDob.Text);
                people.Cost = int.Parse(txtCost.Text.Remove(l, 1));
                source.Add(people);
                people = new clsPeople();

                ClearData();
                dgshow.Refresh();
            }
        }
Ejemplo n.º 2
0
        void BtnEditClick(object sender, EventArgs e)
        {
            people.Name = txtName.Text;
            people.ID   = int.Parse(txtID.Text);
            //people.Age = int.Parse(txtAge.Text);
            people.Stay = int.Parse(txtTime.Text);
            people.Date = int.Parse(txtDob.Text);
            //people.Cost = int.Parse(txtCost.Text);
            source[dgshow.CurrentRowIndex] = people;

            people = new clsPeople();
            ClearData();
            dgshow.Refresh();
        }
Ejemplo n.º 3
0
 void ShowData(clsPeople peo)
 {
     txtID.Text   = peo.ID.ToString();
     txtDob.Text  = peo.Date.ToString();
     txtName.Text = peo.Name;
     txtCost.Text = peo.Cost.ToString() + "$";
     txtAge.Text  = peo.Age.ToString();
     txtTime.Text = peo.Stay.ToString();
     if (peo.Type == "Medium")
     {
         rdbM.Checked = true;
     }
     if (peo.Type == "Large")
     {
         rdbLarge.Checked = true;
     }
     if (peo.Type == "Small")
     {
         rdbS.Checked = true;
     }
 }