Esempio n. 1
0
        //logout link
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure?", "Logout", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                LoginForm l = LoginForm.GetInstance();
                MainContainer.LoadForm(l);
            }
        }
Esempio n. 2
0
 public static void LoadForm(Form form)
 {
     form.TopLevel = false;
     _instance     = MainContainer.GetInstance();
     MainContainer._instance.mainPanel.Controls.Add(form);
     form.FormBorderStyle = FormBorderStyle.None;
     form.Dock            = DockStyle.Fill;
     if (!form.Visible)
     {
         form.Show();
         form.BringToFront();
     }
     else
     {
         form.BringToFront();
     }
 }
Esempio n. 3
0
        //sign up link
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            StudentSignUp s = StudentSignUp.GetInstnce();

            MainContainer.LoadForm(s);
        }
Esempio n. 4
0
        //sign up button
        private void button2_Click(object sender, EventArgs e)
        {
            foreach (Control c in Controls)
            {
                if (c is TextBox)
                {
                    if (c.Text.Length == 0)
                    {
                        MessageBox.Show("All feilds are mandatory");
                        return;
                    }
                }
            }
            foreach (PictureBox c in Controls.OfType <PictureBox>())
            {
                if (c is PictureBox)
                {
                    if (c.ImageLocation == defaultImage)
                    {
                        MessageBox.Show("all images are mandatory");
                        return;
                    }
                }
            }

            student.Name     = textBox2.Text;
            student.Type     = "student";
            student.MobileNo = textBox3.Text;

            if (textBox4.Text != textBox5.Text)
            {
                MessageBox.Show("Password not mathcing!");
                return;
            }
            if (textBox4.Text.Length < 8)
            {
                MessageBox.Show("Password length must be of 8 or more!");
                return;
            }
            if (loginCredential.Find(n => n.UserName == textBox1.Text).CountDocuments() != 0)
            {
                MessageBox.Show("Username already exists!");
                return;
            }
            student.Gender = Controls.OfType <RadioButton>().First().Text;

            picture.UserName = user.UserName = student.UserName = textBox1.Text;
            user.Password    = textBox4.Text.GetHashCode();
            Directory.CreateDirectory(String.Format(@"C:\ProxyKiller\ProxyKiller\ProxyKiller\userPictures\{0}", user.UserName));
            for (int i = 0; i < 4; i++)
            {
                string filename = String.Format(@"C:\ProxyKiller\ProxyKiller\ProxyKiller\userPictures\{0}\{1}{2}.jpg", user.UserName, user.UserName, i);
                File.Copy(picture.ImageLocations[i], filename, true);
                picture.ImageLocations[i] = filename;
            }

            studentInfo.InsertOne(student);
            loginCredential.InsertOne(user);
            studentPicture.InsertOne(picture);

            textBox1.Text             = textBox2.Text = textBox3.Text = textBox4.Text = textBox5.Text = String.Empty;
            pictureBox1.ImageLocation = pictureBox2.ImageLocation = pictureBox3.ImageLocation = pictureBox4.ImageLocation = defaultImage;


            StudentForm s = StudentForm.GetInstance(user.UserName);

            MainContainer.LoadForm(s);
        }
Esempio n. 5
0
        //back to login link
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LoginForm l = LoginForm.GetInstance();

            MainContainer.LoadForm(l);
        }