Ejemplo n.º 1
0
        private void updateDgv(usertable user)
        {
            if (rbParts.Checked == true)
            {
                partList    = dbHelper.GetAllPartsByUser(user.userid);
                label2.Text = "Total # of Parts: " + partList.Count();
                if (partList.Count() == 0)
                {
                    MessageBox.Show("User hasn't created any parts.");
                }
                dgvPart.DataSource = partList;
            }
            else
            {
                productList = dbHelper.GetAllProductsByUser(user.userid);
                label2.Text = "Total # of Products: " + productList.Count();
                if (productList.Count() == 0)
                {
                    MessageBox.Show("User hasn't created any products.");
                }
                dgvPart.DataSource = productList;
            }

            dgvPart.RowHeadersVisible = false;
            dgvPart.DefaultCellStyle.SelectionBackColor = System.Drawing.Color.Yellow;
            dgvPart.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.Black;
            dgvPart.SelectionMode      = DataGridViewSelectionMode.FullRowSelect;
            dgvPart.AllowUserToAddRows = false;
            dgvPart.ClearSelection();
            dgvPart.Columns["usertable"].Visible             = false;
            dgvPart.Columns["productsparts"].Visible         = false;
            dgvPart.Columns["createdby"].Visible             = false;
            dgvPart.Columns["price"].DefaultCellStyle.Format = "c";
            dgvPart.Columns["lastmodified"].Width            = 150;
        }
Ejemplo n.º 2
0
 public static bool isPassword(string user, string password)
 {
     using (var con = new InventoryMgmtEntities())
     {
         usertable userObj = con.usertables.First(j => j.username == user);
         if (userObj.useractive != "t")
         {
             MessageBox.Show("This user does not have database priviledges. Please contact your supervisor.");
             return(false);
         }
         if (userObj.userpassword == password)
         {
             currentUser = userObj;
             return(true);
         }
         else
         {
             MessageBox.Show("Your password is incorrect.");
         }
         return(false);
     }
 }
Ejemplo n.º 3
0
 private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
 {
     userHolder = comboBox1.SelectedItem as usertable;
     updateDgv(userHolder);
 }