Пример #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();
            }
        }
Пример #2
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();
            }
        }