示例#1
0
        void OpenWindowCommandExecute()
        {
            if (Username == string.Empty)
            {
                MessageBoxService.ShowMessage("Wpisz Użytkownika!");
                return;
            }
            if (Password == string.Empty)
            {
                MessageBoxService.ShowMessage("Wpisz Hasło");
                return;
            }
            IHP_ZAM_USERS user = DoLogin(Username, Password);

            if (user != null)
            {
                ProgramDataSotrage.User = user;

                MainWindowService.ShowMainWindow();

                //var w = new JaednDodatPodpowiedz();
                //w.ShowDialog();

                Messenger.Default.Send <IHP_ZAM_USERS>(user);
                CurrentWindowService.Close();
            }
            else
            {
                MessageBoxService.ShowMessage("Niepoprawny Użytkownik lub Hasło!");
            }
        }
        private void AddUser()
        {
            string LastMessage;

            try
            {
                IHP_ZAM_USERS addtuser = new IHP_ZAM_USERS()
                {
                    ID_IHP_ZAM_USERS = GetNextNumer(10),
                    ID_UZYTKOWNIK    = 0,
                    LOGIN            = _user,
                    HASLO            = PasswordManager.Encrypt(_password),
                    NAZWISKO_IMIE    = _nazwauser,
                    AKTYWNY          = 0,
                    RESET_HASLA      = 0
                };
                if (checkData(addtuser))
                {
                    context.IHP_ZAM_USERS.Add(addtuser);
                    context.SaveChanges();
                }

                //    ObservlstUsersSl.Add(addtuser);
                Clear();
                Refresh();
            }

            catch (Exception ex)
            {
                LastMessage = ex.ToString();
                LogManager.WriteLogMessage(LogManager.LogType.Error, LastMessage);
                throw ex;
            }
        }
示例#3
0
 public ViewModelLogin()
 {
     _uzytkownik           = new IHP_ZAM_USERS();
     OpenMainWindowCommand = new DelegateCommand(OpenWindowCommandExecute);
     Username = "******";
     Password = "******";
 }
示例#4
0
 private void txtUser_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
 {
     if (currentUser == null)
     {
         currentUser = new IHP_ZAM_USERS();
     }
     currentUser.LOGIN = txtUser.Text;
 }
示例#5
0
 private void Clear()
 {
     txtUser.IsEnabled = true;
     txtNazwa.Text     = string.Empty;
     txtUser.Text      = string.Empty;
     txtPassword.Text  = string.Empty;
     currentUser       = null;
 }
示例#6
0
 private void txtPassword_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
 {
     if (currentUser == null)
     {
         currentUser = new IHP_ZAM_USERS();
     }
     currentUser.HASLO = PasswordManager.Encrypt(txtPassword.Text);
 }
示例#7
0
 private void txtNazwa_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e)
 {
     if (currentUser == null)
     {
         currentUser = new IHP_ZAM_USERS();
     }
     currentUser.NAZWISKO_IMIE = txtNazwa.Text;
 }
示例#8
0
        private void dgvTabelaUprawnien_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var row = (IHP_ZAM_USERS)dgvTabelaUprawnien.SelectedItem;

            if (row != null)
            {
                currentUser = row;
                Edycja      = true;
            }
        }
        private bool checkData(IHP_ZAM_USERS Item)
        {
            if (string.IsNullOrEmpty(Item.NAZWISKO_IMIE))
            {
                MessageBoxService.ShowMessage("Nazwa pusta");

                return(false);
            }

            if (string.IsNullOrEmpty(Item.LOGIN))
            {
                MessageBoxService.ShowMessage("Login pusty");
                return(false);
            }

            if (string.IsNullOrEmpty(Item.HASLO))
            {
                MessageBoxService.ShowMessage("Hasło puste");
                return(false);
            }
            return(true);
        }
        private void  AktRec(IHP_ZAM_USERS_EX Item)
        {
            IHP_ZAM_USERS it = context.IHP_ZAM_USERS?.FirstOrDefault(w => w.ID_IHP_ZAM_USERS == Item.ID_IHP_ZAM_USERS);

            if (it != null)
            {
                if (Item.REJWAGAEX == false)
                {
                    Item.REJWAGA = 0;
                }
                if (Item.REJWAGAEX == true)
                {
                    Item.REJWAGA = 1;
                }

                if (Item.USLUGAEX == false)
                {
                    Item.USLUGA = 0;
                }
                if (Item.USLUGAEX == true)
                {
                    Item.USLUGA = 1;
                }

                if (Item.KIEROWCYEX == false)
                {
                    Item.KIEROWCY = 0;
                }
                if (Item.KIEROWCYEX == true)
                {
                    Item.KIEROWCY = 1;
                }

                if (Item.KARTOTEKIEX == false)
                {
                    Item.KARTOTEKI = 0;
                }
                if (Item.KARTOTEKIEX == true)
                {
                    Item.KARTOTEKI = 1;
                }

                if (Item.POJAZDYEX == false)
                {
                    Item.POJAZDY = 0;
                }
                if (Item.POJAZDYEX == true)
                {
                    Item.POJAZDY = 1;
                }

                if (Item.KONTRAHENTEX == false)
                {
                    Item.KONTRAHENT = 0;
                }
                if (Item.KONTRAHENTEX == true)
                {
                    Item.KONTRAHENT = 1;
                }

                if (Item.DANEFIRMYEX == false)
                {
                    Item.DANEFIRMY = 0;
                }
                if (Item.DANEFIRMYEX == true)
                {
                    Item.DANEFIRMY = 1;
                }
                if (_ischangepass)
                {
                    it.HASLO = PasswordManager.Encrypt(Password);
                }
                //   it.LOGIN = Item.LOGIN;
                //    it.ID_UZYTKOWNIK = Item.ID_UZYTKOWNIK;
                it.KARTOTEKI   = Item.KARTOTEKI;
                it.KIEROWCY    = Item.KIEROWCY;
                it.KONTRAHENT  = Item.KONTRAHENT;
                it.POJAZDY     = Item.POJAZDY;
                it.REJWAGA     = Item.REJWAGA;
                it.RESET_HASLA = Item.RESET_HASLA;
                it.USLUGA      = Item.USLUGA;
                it.DANEFIRMY   = Item.DANEFIRMY;
                it.AKTYWNY     = Item.AKTYWNY;
                context.SaveChanges();
            }
        }
 public void OnMessageUser(IHP_ZAM_USERS user)
 {
     _loginuser = user;
 }