Exemplo n.º 1
0
        private void update_Employee_Details_Load(object sender, EventArgs e)
        {
            MmasweEntities5 db = new MmasweEntities5();
            int             id = Globals.Employeepassing;

            try
            {
                Employee EmEdited = db.Employees.FirstOrDefault(c => c.Employee_ID == id);

                txtName.Text      = EmEdited.Employee_Name;
                txtSurname.Text   = EmEdited.Employee_Surname;
                txtAddress.Text   = EmEdited.Adress;
                txtNextOfKin.Text = EmEdited.Next_Of_Kin_Name;
                txtNKC.Text       = EmEdited.Next_Of_Kin_Contact_Number.ToString();
                txtEmail.Text     = EmEdited.Email_Adress;
                txtIdNumber.Text  = EmEdited.Employee_ID.ToString();

                ItemsPicture pic = db.ItemsPictures.FirstOrDefault(c => c.EmployeeID == id);
                // Image n = (Bitmap)((new ImageConverter()).ConvertFrom(pic.imageVar));

                pictureBox1.Image = Globals.converBinToImage(pic.imageVar);
            }
            catch (Exception i)
            {
                MessageBox.Show(i.ToString());
            }
        }
Exemplo n.º 2
0
        private bool IsvalidUser(string userName, string password)

        {
            MmasweEntities5 db = new MmasweEntities5();


            var q = from p in db.Users

                    where p.UserName == txtUsername.Text

                    && p.User_Password == txtPassword.Text

                    select p;



            if (q.Any())

            {
                return(true);
            }

            else

            {
                MessageBox.Show("The login details entered are incorrect");
                txtPassword = null;
                txtUsername = null;
                return(false);
            }
        }