Exemplo n.º 1
0
        private void SearchButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (SearchTextBox.Text == "")
                {
                    MessageBox.Show("Please enter the NRIC/FIN");
                }
                else
                {
                    SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
                    Member M = context.Members.Where(x => x.NRIC == SearchTextBox.Text.Trim()).First();

                    //NRICTextBox.Text = M.NRIC;
                    //MemberNameTextBox.Text=M.MemberName;
                    //GenderComboBox.Text=M.Gender;
                    //AgeTextBox.Text=M.Age.ToString();
                    //PhoneNumberTextBox.Text=M.Phone;
                    Show(M);
                    List <Member> SortList = context.Members.ToList();
                    for (int i = 0; i < SortList.Count(); i++)
                    {
                        M = SortList[i];
                        if (M.NRIC == SearchTextBox.Text)
                        {
                            posn = i;
                        }
                    }
                }
            }
            catch
            {
                MessageBox.Show("Please Enter a correct NRIC/FIN");
            }
        }
Exemplo n.º 2
0
        private void LastButton_Click(object sender, EventArgs e)
        {
            SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
            Member M = new Member();

            List <Member> cLst = context.Members.ToList();

            posn = cLst.Count() - 1;
            M    = cLst[posn];
            Show(M);
        }
Exemplo n.º 3
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            try
            {
                SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
                Member M = context.Members.Where(x => x.NRIC == NRICTextBox.Text).First();

                context.Members.Remove(M);
                context.SaveChanges();
            }
            catch
            {
                MessageBox.Show("Error!\nPlease try again.");
            }
        }
Exemplo n.º 4
0
 private void UpdateButton_Click(object sender, EventArgs e)
 {
     try
     {
         SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
         Member M = context.Members.Where(X => X.NRIC == NRICTextBox.Text).First();
         M.MemberName = MemberNameTextBox.Text;
         M.Gender     = GenderComboBox.Text;
         M.Age        = Convert.ToInt32(AgeTextBox.Text);
         M.Phone      = PhoneNumberTextBox.Text;
         context.SaveChanges();
     }
     catch
     {
         MessageBox.Show("Error!\nPlease try again.");
     }
 }
Exemplo n.º 5
0
        private void PreviousButton_Click_1(object sender, EventArgs e)
        {
            if (posn > 0)
            {
                posn--;
            }

            SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
            Member M = new Member();

            List <Member> cLst = context.Members.ToList();

            if (posn >= 0)
            {
                M = cLst[posn];
                Show(M);
            }
        }
Exemplo n.º 6
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            SA46Team05BESNETProjectEntities context = new SA46Team05BESNETProjectEntities();
            List <Member> cLst = context.Members.ToList();

            if (posn < cLst.Count() - 1)
            {
                posn++;
            }


            Member M = new Member();


            if (posn < cLst.Count())
            {
                M = cLst[posn];
                Show(M);
            }
        }