Exemple #1
0
        private void BindEditForm(object[] data)
        {
            userBAL = new BAL.UserBAL();
            DataTable table = new DataTable();

            table = userBAL.getUsers(data);
            BindFields(table);
        }
Exemple #2
0
        private void BindUserDataGrid(object[] data)
        {
            userBAL = new BAL.UserBAL();
            DataTable table = new DataTable();

            table = userBAL.getUsers(data);
            this.dataGridUser.RowPostPaint += new System.Windows.Forms.DataGridViewRowPostPaintEventHandler(this.dgvUserDetails_RowPostPaint);
            dataGridUser.DataSource         = table;
            this.dataGridUser.Columns["UserId"].Visible     = false;
            dataGridUser.Columns[5].DefaultCellStyle.Format = "MM/dd/yyyy";
            dataGridUser.Columns[6].DefaultCellStyle.Format = "MM/dd/yyyy";
            // Auto Resize
            dataGridUser.AutoResizeColumns();
            dataGridUser.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
        }
Exemple #3
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         string uName    = Convert.ToString(txtUserName.Text);
         string password = Convert.ToString(txtPassword.Text);
         if (uName != "" && password != "")
         {
             DataTable dt = userBAL.getUsers(new object[] { 0, uName });
             if (dt.Rows.Count > 0)
             {
                 string passs = dt.Rows[0]["Password"].ToString();
                 byte[] bytes = Convert.FromBase64String(passs);
                 string str   = Encoding.UTF8.GetString(bytes);
                 if (password == str)
                 {
                     this.Hide();
                     Home home = new Home();
                     home.ShowDialog();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("Invalid Credentails.");
                     txtUserName.Text = string.Empty;
                     txtPassword.Text = string.Empty;
                 }
             }
             else
             {
                 MessageBox.Show("User does not exists.");
                 txtUserName.Text = string.Empty;
                 txtPassword.Text = string.Empty;
             }
         }
         else
         {
             MessageBox.Show("Invalid Credentails.");
             txtUserName.Text = string.Empty;
             txtPassword.Text = string.Empty;
         }
     }
     catch (Exception ex) { Exceptions.WriteExceptionLog(ex); }
 }