public bool ValidateRegNo()
        {
            if (RegNo.Length != 9)
            {
                return(false);
            }

            string course = RegNo.Substring(2, 3);

            foreach (char c in course)
            {
                if (!char.IsLetter(c))
                {
                    return(false);
                }
            }

            string nums = RegNo.Substring(0, 2) + RegNo.Substring(5, 4);
            int    temp;

            if (int.TryParse(nums, out temp) == false)
            {
                return(false);
            }

            return(true);
        }
Esempio n. 2
0
 private void Clear_Click(object sender, EventArgs e)
 {
     RegNo.Clear();
     cmbColor.Text = "";
     cmbModel.Text = "";
     Price.Clear();
     cmbMake.Text = "";
     Speed.Clear();
     Vehicleid.Text = "";
 }
Esempio n. 3
0
 /// <summary>
 /// 数字移出
 /// </summary>
 private void RemoveText(bool IsAll)
 {
     if (RegNoEnable && RegNo.Length > 0)
     {
         if (IsAll)
         {
             RegNo = "";
         }
         else
         {
             RegNo = RegNo.Remove(RegNo.Length - 1);
         };
     }
 }
Esempio n. 4
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            RegNo r = new RegNo()
            {
                Program = "BCS",
                RollNo  = this.txtRegNo.Text,
                Session = Session.Spring,
                Year    = 11
            };

            this.list.Items.Add(new Student()
            {
                FirstName      = this.txtName.Text,
                RegistrationNo = r
            });
        }
Esempio n. 5
0
        private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            RegNo rObj = new RegNo(Batch.SP, 2015, ProgramCIIT.BCS, 34);

            if (rObj.Program == ProgramCIIT.BCS)
            {
                MessageBox.Show("Welcome to BCS-6A", "Welcome", MessageBoxButton.YesNoCancel, MessageBoxImage.Information, MessageBoxResult.Yes, MessageBoxOptions.DefaultDesktopOnly);
            }
            else
            {
                MessageBox.Show("Why are you here?");
            }
            // Create a student object
            Student sObj = new Student()
            {
                FirstName = this.txtFirstName.Text,
                LastName  = this.txtLastName.Text,
                //RegNo = this.txtRegNo.Text,
                Age = byte.Parse(this.comboAge.SelectedItem.ToString())
            };

            MessageBox.Show(sObj.ToString());
        }
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            bool regVal = false, passVal = false;

            if (ValidateRegNo() == false)
            {
                RegNoInputStatus = "Invalid registration number";
            }
            else
            {
                RegNoInputStatus = "";
                regVal           = true;
            }
            var roundInfo = Manager.GetRoundInfo(Password);

            if (roundInfo == null)
            {
                PasswordInputStatus = "Invalid password";
            }
            else
            {
                passVal             = true;
                PasswordInputStatus = "";
            }

            if (regVal != true || passVal != true)
            {
                return;
            }

            Player player = new Player(RegNo.ToUpper());

            GameSession.Initialize(player, roundInfo);
            Manager.PushToLog(LogEvents.Login, player.RegNo);
            (new MainWindow()).Show();
            this.Close();
        }