示例#1
0
        private void signinProcess()
        {
            lblWarning.Visible = false;

            if (string.IsNullOrEmpty(usernameTbx.Text))
            {
                lblWarning.Text = "Username field is empty."; usernameTbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(passCodeTbx.Text))
            {
                lblWarning.Text = "Password field is empty."; passCodeTbx.Focus(); return;
            }


            string User_name = usernameTbx.Text;
            string Pass_code = z.Encrypt(Convert.ToString(passCodeTbx.Text));

            bool log = z.login(User_name, Pass_code);

            if (log == true)
            {
                SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
                SplashScreenManager.Default.SetWaitFormCaption("Signing in..");
                for (int i = 0; i < 100; i++)
                {
                    Thread.Sleep(50);
                }
                SplashScreenManager.CloseForm();
                UserSubClass.Username = User_name;
                UserSubClass.Passcode = Pass_code;
                this.Hide();
                if (string.Compare(UserSubClass.Member, "INSTRUCTOR") == 0)
                {
                    XInstrProfForm i = new XInstrProfForm();
                    i.Show();
                }
                else
                {
                    XStudProfForm s = new XStudProfForm();
                    s.Show();
                }
            }
            else if (log == false)
            {
                lblWarning.Text    = "INVALID USERNAME/PASSWORD";
                lblWarning.Visible = true;
                usernameTbx.Text   = "";
                passCodeTbx.Text   = "";
            }
        }
示例#2
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(firstNametbx.Text))
            {
                lblWarning.Text = "First Name field is empty."; firstNametbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(lastNametbx.Text))
            {
                lblWarning.Text = "Last Name field is empty."; lastNametbx.Focus(); return;
            }
            //if (string.IsNullOrEmpty(miTbx.Text)) { lblWarning.Text = "Middle Initial field is empty."; miTbx.Focus(); return; }
            if (string.IsNullOrEmpty(sexTbx.Text))
            {
                lblWarning.Text = "Sex field is empty."; sexTbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(userNameTbx.Text))
            {
                lblWarning.Text = "Username field is empty."; userNameTbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(passwrdTbx.Text))
            {
                lblWarning.Text = "Password field is empty."; passwrdTbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(courseCbx.Text))
            {
                lblWarning.Text = "Course field is empty."; courseCbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(idTbx.Text))
            {
                lblWarning.Text = "ID field is empty."; idTbx.Focus(); return;
            }
            if (studRbtn.Checked == true && string.IsNullOrEmpty(yrsecCbx.Text))
            {
                lblWarning.Text = "Year and Section field is empty."; yrsecCbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(schoolyeartbx.Text))
            {
                lblWarning.Text = "School year field is empty."; schoolyeartbx.Focus(); return;
            }
            if (string.IsNullOrEmpty(semestertbx.Text))
            {
                lblWarning.Text = "Semester field is empty."; semestertbx.Focus(); return;
            }

            //  if ((instructRbtn || studRbtn) == 1)
            //  {
            //     lblWarning.Text = "Specify your account .";
            //    return;
            // }
            if (!string.IsNullOrEmpty(miTbx.Text))
            {
                UserSubClass.Fullname = string.Copy(string.Concat(firstNametbx.Text, " ", miTbx.Text, ". ", lastNametbx.Text));
            }
            else if (string.IsNullOrEmpty(miTbx.Text))
            {
                UserSubClass.Fullname = string.Copy(string.Concat(firstNametbx.Text, " ", lastNametbx.Text));
            }

            UserSubClass.Gender     = sexTbx.Text;
            UserSubClass.Username   = userNameTbx.Text;
            UserSubClass.Passcode   = z.Encrypt(Convert.ToString(passwrdTbx.Text));
            UserSubClass.Course     = courseCbx.Text;
            UserSubClass.Id         = idTbx.Text;
            UserSubClass.Schoolyear = schoolyeartbx.Text;
            UserSubClass.Semester   = semestertbx.Text;
            if (studRbtn.Checked == true)
            {
                UserSubClass.Member = string.Copy("STUDENT");
                UserSubClass.Course = string.Concat(courseCbx.Text, " ", yrsecCbx.Text);
            }
            else
            {
                UserSubClass.Member   = string.Copy("INSTRUCTOR");
                UserSubClass.year_sec = string.Copy("None");
            }
            SplashScreenManager.ShowForm(this, typeof(WaitForm1), true, true, false);
            SplashScreenManager.Default.SetWaitFormCaption("Creating Account..");
            for (int i = 0; i < 100; i++)
            {
                Thread.Sleep(50);
            }
            SplashScreenManager.CloseForm();
            bool isDuplicate = z.Add(UserSubClass.Fullname, UserSubClass.Gender, UserSubClass.Username, UserSubClass.Passcode, UserSubClass.Course, UserSubClass.Member, UserSubClass.Id, UserSubClass.Schoolyear, UserSubClass.Semester);

            if (isDuplicate)
            {
                lblWarning.Text = "Account already exist";
            }
            else
            {
                XtraMessageBox.Show("Account created!");
            }
        }