private void btnUserSave_Click(object sender, EventArgs e)
 {
     if (ValidateText(txtOldUser.Text))
     {
         if (ValidateOldUser(txtOldUser.Text))
         {
             if (ValidateText(txtNewUser.Text))
             {
                 UpdateUser(Gulipso.DataEncrypt(txtNewUser.Text));
             }
             else
             {
                 MessageBox.Show("Please Enter New Username!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("Old Username is not correct!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Please Enter your Old Username!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
 public Passwords DecryptUserPasswords(Passwords password)
 {
     if (Verifier.Text(password.Name))
     {
         password.Name = Gulipso.DataDecrypt(password.Name);
     }
     if (Verifier.Text(password.Email))
     {
         password.Email = Gulipso.DataDecrypt(password.Email);
     }
     if (Verifier.Text(password.Username))
     {
         password.Username = Gulipso.DataDecrypt(password.Username);
     }
     if (Verifier.Text(password.Website))
     {
         password.Website = Gulipso.DataDecrypt(password.Website);
     }
     if (Verifier.Text(password.Text))
     {
         password.Text = Gulipso.DataDecrypt(password.Text);
     }
     if (Verifier.Text(password.Notes))
     {
         password.Notes = Gulipso.DataDecrypt(password.Notes);
     }
     return(password);
 }
        private void DataGrid()
        {
            dataGridViewStudents.Rows.Clear();
            ArrayList idList      = new ArrayList();
            ArrayList SNameList   = new ArrayList();
            ArrayList FNameList   = new ArrayList();
            ArrayList EmailList   = new ArrayList();
            ArrayList ContactList = new ArrayList();


            foreach (var std in StudentsList.Where(c => c.Course_Id == COURSE_ID))
            {
                idList.Add(std.Student_Id);
                SNameList.Add(std.Name);
                FNameList.Add(std.FatherName);
                EmailList.Add(std.Email);
                ContactList.Add(std.Contact);
            }

            int n = 0;

            for (int i = 0; i <= idList.ToArray().Length - 1; i++)
            {
                n = dataGridViewStudents.Rows.Add();
                dataGridViewStudents.Rows[n].Cells[0].Value = idList[i].ToString();
                dataGridViewStudents.Rows[n].Cells[1].Value = Gulipso.DataDecrypt(SNameList[i].ToString());
                dataGridViewStudents.Rows[n].Cells[2].Value = Gulipso.DataDecrypt(FNameList[i].ToString());
                dataGridViewStudents.Rows[n].Cells[3].Value = Gulipso.DataDecrypt(EmailList[i].ToString());
                dataGridViewStudents.Rows[n].Cells[4].Value = Gulipso.DataDecrypt(ContactList[i].ToString());
            }
        }
 public StudentInfo(Data.Students Students)
 {
     InitializeComponent();
     txtStdId.Text      = (Students.Student_Id);
     txtStdName.Text    = Gulipso.DataDecrypt(Students.Name);
     txtStdFname.Text   = Gulipso.DataDecrypt(Students.FatherName);
     txtStdCNIC.Text    = Gulipso.DataDecrypt(Students.CNIC);
     txtStdEmail.Text   = Gulipso.DataDecrypt(Students.Email);
     txtStdContact.Text = Gulipso.DataDecrypt(Students.Contact);
 }
 /// <summary>
 /// DataEncrypts the Password for supplied User.
 /// </summary>
 /// <param name="user">User for whom the Password is to be DataEncrypted.</param>
 /// <param name="password">Password to be DataEncrypted.</param>
 /// <returns>Password: The Password in DataEncrypted format.</returns>
 public Passwords EncryptUserPasswords(Passwords password)
 {
     password.Name     = Gulipso.DataEncrypt(password.Name);
     password.Email    = Gulipso.DataEncrypt(password.Email);
     password.Username = Gulipso.DataEncrypt(password.Username);
     password.Website  = Gulipso.DataEncrypt(password.Website);
     password.Text     = Gulipso.DataEncrypt(password.Text);
     password.Notes    = Gulipso.DataEncrypt(password.Notes);
     return(password);
 }
 private bool ValidateOldPass(string pass)
 {
     foreach (var item in Lists.UsersList)
     {
         if (Gulipso.DataDecrypt(item.Password) == pass)
         {
             return(true);
         }
     }
     return(false);
 }
 private bool ValidateOldUser(string username)
 {
     foreach (var item in Lists.UsersList)
     {
         if (Gulipso.DataDecrypt(item.UserId) == username)
         {
             return(true);
         }
     }
     return(false);
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtStdName.Text != "" && txtStdFname.Text != "" && txtStdEmail.Text != "" && txtStdContact.Text != "" && txtStdCNIC.Text != "")
            {
                if (IsEmailValid(txtStdEmail.Text))
                {
                    if (isNumberValid(txtStdContact.Text))
                    {
                        if (IsCNICValid(txtStdCNIC.Text))
                        {
                            Student_Name  = Regex.Replace(txtStdName.Text, @"(^\w)|(\s\w)", m => m.Value.ToUpper());
                            Student_FName = Regex.Replace(txtStdFname.Text, @"(^\w)|(\s\w)", m => m.Value.ToUpper());

                            Student_Name    = Gulipso.DataEncrypt(Student_Name);
                            Student_FName   = Gulipso.DataEncrypt(Student_FName);
                            Student_Email   = Gulipso.DataEncrypt(txtStdEmail.Text);
                            Student_Contact = Gulipso.DataEncrypt(txtStdContact.Text);
                            Student_CNIC    = Gulipso.DataEncrypt(txtStdCNIC.Text);

                            bw                     = new BackgroundWorker();
                            bw.DoWork             += bw_DoWork;
                            bw.RunWorkerCompleted += bw_RunWorkerCompleted;
                            if (!bw.IsBusy)
                            {
                                btnSave.Enabled = false;
                                btnSave.Text    = "Saving";
                                bw.RunWorkerAsync();
                            }
                        }
                        else
                        {
                            MessageBox.Show("Student's CNIC is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("Contact number is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Email is not valid!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("All fields are mandatory!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #9
0
        private void DoLogin()
        {
            UserID                      = Gulipso.DataEncrypt(txtboxUser.Text);
            Password                    = Gulipso.DataEncrypt(txtboxPass.Text);
            Loginbw                     = new BackgroundWorker();
            Loginbw.DoWork             += Loginbw_DoWork;
            Loginbw.RunWorkerCompleted += Loginbw_RunWorkerCompleted;

            if (!Loginbw.IsBusy)
            {
                progress1.LoaderText = "Please Wait";
                progress1.Visible    = true;
                btnLogin.Cursor      = Cursors.No;
                btnLogin.Enabled     = false;
                Loginbw.RunWorkerAsync();
            }
        }
Beispiel #10
0
        private void InitializeStudents(int Id)
        {
            this.Size                 = new System.Drawing.Size(423, 378);
            this.tabControl1.Size     = new System.Drawing.Size(439, 362);
            tabControl1.SelectedIndex = 0;


            var std = Lists.StudentsList.Where(c => c.ID == Id).FirstOrDefault();

            this.LabelText.Text = Gulipso.DataDecrypt(std.Name) + " (" + std.Student_Id + ")";

            txtStdId.Text      = std.Student_Id;
            txtStdName.Text    = Gulipso.DataDecrypt(std.Name);
            txtStdFName.Text   = Gulipso.DataDecrypt(std.FatherName);
            txtStdEmail.Text   = Gulipso.DataDecrypt(std.Email);
            txtStdContact.Text = Gulipso.DataDecrypt(std.Contact);

            btnDelete.Click += new EventHandler(btnStudentDelete_Click);
        }
Beispiel #11
0
        private async void btnlogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (!Verifier.Text(txtuser.Text))
                {
                    CustomMessageBox.Show("Credentials Missing", "Enter your username!", CustomMessageBox.eDialogButtons.OK, CustomMessageBox.eDialogImages.Exclamation);
                }
                else if (!Verifier.Text(txtpass.Text))
                {
                    CustomMessageBox.Show("Credentials Missing", "Enter your password!", CustomMessageBox.eDialogButtons.OK, CustomMessageBox.eDialogImages.Exclamation);
                }
                else
                {
                    pictureBox1.Visible = true;
                    Users user = new Users()
                    {
                        Username = txtuser.Text,
                        Master   = Gulipso.DataEncrypt(txtpass.Text)
                    };
                    Users Checkuser = await UsersService.Instance().LoginUserAsync(user);

                    if (Checkuser != null)
                    {
                        this.Hide();
                        CustomMessageBox.Show("Login Successfull", "You have succesfully Logged On to your app!", CustomMessageBox.eDialogButtons.OK, CustomMessageBox.eDialogImages.Success);
                        FormDashboard das = new FormDashboard();
                        das.Show();
                    }
                    else
                    {
                        CustomMessageBox.Show("Invalid Credentials", "You have entered an incorrect username and password!", CustomMessageBox.eDialogButtons.OK, CustomMessageBox.eDialogImages.Error);

                        pictureBox1.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                CustomMessageBox.Show("An Error Occurred", ex.Message.ToString(), CustomMessageBox.eDialogButtons.OK, CustomMessageBox.eDialogImages.Error);
            }
        }
 private void btnPassSave_Click(object sender, EventArgs e)
 {
     if (ValidateText(txtOldPass.Text))
     {
         if (ValidateOldPass(txtOldPass.Text))
         {
             if (ValidateText(txtNewPass.Text))
             {
                 if (ValidateText(txtConfirmPass.Text))
                 {
                     if (ComparePass(txtNewPass.Text, txtConfirmPass.Text))
                     {
                         UpdatePass(Gulipso.DataEncrypt(txtConfirmPass.Text));
                     }
                     else
                     {
                         MessageBox.Show("Confirm Password is not correct!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Please Enter your Confirm Password!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                 }
             }
             else
             {
                 MessageBox.Show("Please Enter your New Password!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
         }
         else
         {
             MessageBox.Show("Old Password is not correct!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
     else
     {
         MessageBox.Show("Please Enter your Old Password!", "Alert - GO TECH Terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }