Ejemplo n.º 1
0
        private void EditClient()
        {
            AdminValidation VM          = new AdminValidation();
            bool            correctForm = VM.ClientValidation(FirstName, LastName, CompanyName, NIP, REGON);

            if (correctForm)
            {
                MySelectedClient.FirstName = FirstName;
                MySelectedClient.LastName  = LastName;

                MySelectedClient.CompanyName = CompanyName;

                MySelectedClient.NIP             = NIP;
                MySelectedClient.REGON           = REGON;
                MySelectedClient.Street          = Street;
                MySelectedClient.HouseNumber     = HouseNumber;
                MySelectedClient.ApartmentNumber = ApartmentNumber;
                MySelectedClient.Postcode        = Postcode;
                MySelectedClient.City            = City;

                dbContext.SaveChanges();

                Clients = new ObservableCollection <Client>(dbContext.Client);

                setVariable();

                ErrorMessage er = new ErrorMessage("Client edit successfully!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void AddArticle()
        {
            AdminValidation VM          = new AdminValidation();
            bool            correctForm = VM.WikiValidation(Url, Description);

            if (correctForm)
            {
                Article article = new Article()
                {
                    Url         = _Url,
                    Description = _Description,
                    DateAdded   = DateTime.Now,
                    UserID      = Global.user.UserID
                };

                dbContext.Article.Add(article);
                dbContext.SaveChanges();

                Articles = new ObservableCollection <Article>(dbContext.Article);

                setVariableWhenAddArticle();
                ErrorMessage er = new ErrorMessage("Add article!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 3
0
        private void CreateTeam()
        {
            AdminValidation AV          = new AdminValidation();
            bool            correctForm = AV.EditTeamValidation(Name, UserInNewTeam);

            if (correctForm)
            {
                addTeam();
                setVariableWhenAddNewTeam();
                setVariableWhenEditTeam();

                ErrorMessage er = new ErrorMessage("Taam created successfully!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 4
0
        private void EditRemoveUserWithTeam(object ID)
        {
            int  val  = Convert.ToInt32(ID);
            User user = dbContext.User.Find(val);

            AdminValidation AV          = new AdminValidation();
            bool            correctForm = AV.EditTeamRemoveUserValidation(user);

            if (correctForm)
            {
                EditUserInNewTeam.Remove(user);
                EditUserWithoutTeam.Add(user);

                RaisePropertyChanged("EditIsEnabledAddTeamButton");
            }
        }
Ejemplo n.º 5
0
        private void EditArticle()
        {
            AdminValidation VM          = new AdminValidation();
            bool            correctForm = VM.WikiValidation(UrlEdit, DescriptionEdit);

            if (correctForm)
            {
                MySelectedArticle.Url         = UrlEdit;
                MySelectedArticle.Description = DescriptionEdit;

                dbContext.SaveChanges();

                Articles = new ObservableCollection <Article>(dbContext.Article);

                setVariableWhenEditArticle();
                ErrorMessage er = new ErrorMessage("Edit article!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 6
0
        private void AddClient()
        {
            AdminValidation VM          = new AdminValidation();
            bool            correctForm = VM.ClientValidation(FirstName, LastName, CompanyName, NIP, REGON);

            if (correctForm)
            {
                PMSContext dbContext = new PMSContext();
                Client     client;

                client = AddClientObject();

                dbContext.Client.Add(client);
                dbContext.SaveChanges();

                setVariable();

                ErrorMessage er = new ErrorMessage("Client created successfully!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 7
0
        private void EditUser()
        {
            AdminValidation AV         = new AdminValidation();
            bool            corretForm = AV.EditUserValidation(FirstName, LastName, Password, Salary, PhoneNumber, Email,
                                                               MySelectedUser, FiredDate, HiredDate);

            if (corretForm)
            {
                //team == null
                MySelectedUser.FirstName = FirstName;
                MySelectedUser.LastName  = LastName;

                MySelectedUser.Password = Password;

                MySelectedUser.Salary                        = Salary;
                MySelectedUser.PhoneNumber                   = PhoneNumber;
                MySelectedUser.Email                         = Email;
                MySelectedUser.ResidenceStreet               = ResidenceStreet;
                MySelectedUser.ResidenceHouseNumber          = ResidenceHouseNumber;
                MySelectedUser.ResidenceApartmentNumber      = ResidenceApartmentNumber;
                MySelectedUser.ResidencePostcode             = ResidencePostcode;
                MySelectedUser.ResidenceCity                 = ResidenceCity;
                MySelectedUser.CorrespondenceStreet          = CorrespondenceStreet;
                MySelectedUser.CorrespondenceHouseNumber     = CorrespondenceHouseNumber;
                MySelectedUser.CorrespondenceApartmentNumber = CorrespondenceApartmentNumber;
                MySelectedUser.CorrespondencePostcode        = CorrespondencePostcode;
                MySelectedUser.CorrespondenceCity            = CorrespondenceCity;
                MySelectedUser.HiredDate                     = HiredDate;
                MySelectedUser.FiredDate                     = FiredDate;

                dbContext.SaveChanges();


                Users = new ObservableCollection <User>(dbContext.User);

                setVariable();
                ErrorMessage er = new ErrorMessage("User edit successfully!");
                er.ShowDialog();
            }
        }
Ejemplo n.º 8
0
        /*public string VisibilityTeam
         * {
         *  get
         *  {
         *      return _VisibilityTeam;
         *  }
         *  set
         *  {
         *      _VisibilityTeam = value;
         *      RaisePropertyChanged("VisibilityTeam");
         *  }
         * }*/

        #endregion


        private void AddUser()
        {
            PMSContext dbContext = new PMSContext();
            User       user;

            AdminValidation AV          = new AdminValidation();
            bool            correctForm = AV.AddUserValidation(FirstName, LastName, Login, Password, Salary, PhoneNumber, Email, UserRole, FiredDate, HiredDate);

            if (correctForm == true)
            {
                if (CorrespondenceCity == null)
                {
                    user = AddUserWithoutCorrespondenceAdress();

                    dbContext.User.Add(user);
                    dbContext.SaveChanges();

                    setVariable();

                    ErrorMessage er = new ErrorMessage("User created successfully!");
                    er.ShowDialog();
                }

                else
                {
                    user = AddUserWithCorrespondenceAdress();
                    dbContext.User.Add(user);
                    dbContext.SaveChanges();

                    setVariable();

                    ErrorMessage er = new ErrorMessage("User created successfully!");
                    er.ShowDialog();
                }
            }
        }