Esempio n. 1
0
        private void btnOkAddPhoto_Click(object sender, RoutedEventArgs e)
        {
            CurrentInfo currentid = new CurrentInfo();
            int         itemid    = currentid.ItemID;
            int         boxid     = currentid.BoxID;

            if (boxid != 0 && itemid != 0)
            {
                //OFileDialog();
                // trzeba  dodac zapis do bazy - dodac zdj przedmiotu
            }
            if (boxid != 0 && itemid == 0)
            {
                //OFileDialog();
                // trzeba  dodac zapis do bazy - dodac zdj pudełka
            }
        }
Esempio n. 2
0
        private void btnLoginLogin_Click(object sender, RoutedEventArgs e)
        {
            CurrentInfo currentuser = new CurrentInfo();


            using (var bb = new BoxesEntities())
            {
                //var users = bb.Users
                //    .ToList()
                //    .Select(x => x.Login.ToString() && x.Password.ToString())
                //    .ToList();

                try
                {
                    //var users = bb.Users
                    //        .ToList()
                    //        .Select(x => x.UserId)
                    //        .Select(x => ViewModel.UserViewModel.Create(x.Login, x.Password, x.UserId))
                    //        .Where(x => x.Login == tbLoginLogin.Text && x.Password == pbPasswordLogin.Text)
                    //        .ToList();

                    //rekord z tabeli users
                    IQueryable <Users> us =
                        from u in bb.Users
                        where u.Login == tbLoginLogin.Text
                        select u;

                    int zmienna = 0;
                    foreach (var i in us)
                    {
                        //string haslo = i.Password.Trim();
                        //string haslo1 = tbPasswordLogin.Text;//pbPasswordLogin.SecurePassword.ToString();
                        //MessageBox.Show(haslo);
                        //MessageBox.Show(haslo1);
                        if (tbPasswordLogin.Text == i.Password.Trim())
                        {
                            zmienna = i.UserId;
                        }
                    }
                    if (zmienna == 0)
                    {
                        MessageBox.Show("Błędne dane logowania \n Użytkownik nie istnieje");
                    }
                    else
                    {
                        currentuser.UserId = zmienna;//int.Parse(uid.ToString())
                        MessageBox.Show(currentuser.UserId.ToString());
                        this.Hide();
                        View.Boxes boxes = new View.Boxes(currentuser.UserId);
                        boxes.ShowDialog();
                        this.Close();
                    }

                    //var zm = (from u in us
                    //          where u.Password == pbPasswordLogin.ToString()
                    //          select u.UserId);

                    //var uid = (from u in bb.Users
                    //           where u.Login == tbLoginLogin.Text
                    //           select u.UserId).First();

                    //var uid = (from u in bb.Users
                    //           where u.Login == tbLoginLogin.Text && u.Password == pbPasswordLogin.ToString()
                    //           select u.UserId).First();
                    //var uid = (from u in bb.Users
                    //           where u.Login == tbLoginLogin.Text && u.Password == tbPasswordLogin.Text
                    //           select u.UserId).First();

                    //if (int.Parse(zm.ToString()) != 0)
                    //{
                    //    currentuser.UserId = int.Parse(zm.ToString());//int.Parse(uid.ToString())

                    //    this.Hide();
                    //    View.Boxes boxes = new View.Boxes();
                    //    boxes.ShowDialog();
                    //    this.Close();
                    //}
                    //else
                    //{
                    //    MessageBox.Show("Błędne dane logowania \n Użytkownik nie istnieje");
                    //    tbLoginLogin.Clear();
                    //    tbPasswordLogin.Clear();
                    //}
                }
                catch
                {
                    MessageBox.Show("Błędne dane logowania \n Użytkownik nie istnieje");
                }
                //currentuser.UserId = zmienna;


                //var users = bb.Users
                //    .ToList()
                //    .Select(x => x.UserId == Id)
                //    .Where(x => tbLoginLogin.Text==ViewModel.UserViewModel.Check(x.login,x.password))
                //    .ToList();
            }
        }