Exemple #1
0
        public T Create()
        {
            var entity = new T();

            ItemCreated?.Invoke();
            return(entity);
        }
        private void AddingButton_Click(object sender, EventArgs e)
        {
            string name       = _nameTextBox.Text;
            string surname    = _surnameTextBox.Text;
            string middleName = _middleNameTextBox.Text;
            string phone      = _phoneTextBox.Text;

            if (name == "" || surname == "" || middleName == "" || phone == "" || _seriesTextBox.Text == "" || _numberTextBox.Text == "")
            {
                DisplayError("Не все поля заполнены!");
                return;
            }

            string gender;

            if (_maleRadioButton.Checked)
            {
                gender = _maleRadioButton.Text;
            }
            else
            {
                gender = _femaleRadioButton.Text;
            }
            DateTime birthDate         = _birthdatePicker.Value;
            DateTime passportIssueDate = _issueDatePicker.Value;

            int passportSeries;
            int passportNumber;

            if (int.TryParse(_seriesTextBox.Text, out passportSeries) == false)
            {
                DisplayError("Некорректная серия паспорта!");
                return;
            }
            if (int.TryParse(_numberTextBox.Text, out passportNumber) == false)
            {
                DisplayError("Некорректный номер паспорта!");
                return;
            }

            if (_guestToChange == null)
            {
                Guest newGuest = new Guest(_newId, name, surname, middleName, birthDate, gender, phone, passportSeries, passportNumber, passportIssueDate);
                ItemCreated?.Invoke(newGuest);
            }
            else
            {
                _guestToChange.Name              = name;
                _guestToChange.Surname           = surname;
                _guestToChange.MiddleName        = middleName;
                _guestToChange.Phone             = phone;
                _guestToChange.Gender            = gender;
                _guestToChange.BirthDate         = birthDate;
                _guestToChange.PassportSeries    = passportSeries;
                _guestToChange.PassportNumber    = passportNumber;
                _guestToChange.PassportIssueDate = passportIssueDate;
            }

            Close();
        }
Exemple #3
0
 protected virtual void OnItemCreated(View view)
 {
     if (this.ItemCreated != null)
     {
         ItemCreated.Invoke(this, new RepeaterViewItemAddedEventArgs(view, view.BindingContext));
     }
 }
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            int number = (int)_numberInput.Value;
            int floors = (int)_floorsInput.Value;
            int rooms  = (int)_roomsInput.Value;

            string country = _countryInput.Text;
            string city    = _cityInput.Text;
            string street  = _streetInput.Text;
            string house   = _houseInput.Text;

            if (country == "" || city == "" || street == "" || house == "")
            {
                DisplayError("Не все поля заполнены!");
                return;
            }

            if (_existingHotel == null)
            {
                Hotel newHotel = new Hotel(_newId, number, floors, rooms, country, city, street, house);
                ItemCreated?.Invoke(newHotel);
            }
            else
            {
                _existingHotel.Number         = number;
                _existingHotel.FloorsCount    = floors;
                _existingHotel.RoomsCount     = rooms;
                _existingHotel.Adress.Country = country;
                _existingHotel.Adress.City    = city;
                _existingHotel.Adress.Street  = street;
                _existingHotel.Adress.House   = house;
            }

            Close();
        }
Exemple #5
0
 public virtual void NotifyCreated(ContentItem item)
 {
     notifier.NotifiyCreated(item);
     if (ItemCreated != null)
     {
         ItemCreated.Invoke(this, new ItemEventArgs(item));
     }
 }
Exemple #6
0
 protected virtual void OnItemCreating(ContentItem item, ContentItem parentItem)
 {
     item.Parent = parentItem;
     notifier.NotifiyCreated(item);
     if (ItemCreated != null)
     {
         ItemCreated.Invoke(this, new ItemEventArgs(item));
     }
 }
        private static void CreateItem <TItem>(Func <Table, TItem> create, string actionName) where TItem : IItem
        {
            var table = Table;
            var item  = create(table);

            table.Add(item, true);
            Selection.activeGameObject = CreateRenderable(table, item as IRenderable);
            ItemCreated?.Invoke(Selection.activeGameObject);
            Undo.RegisterCreatedObjectUndo(Selection.activeGameObject, actionName);
        }
Exemple #8
0
        private void CreateItem <TItem>(Func <Table, TItem> create, string actionName) where TItem : IItem
        {
            var tableContainer = TableComponent.TableContainer;

            tableContainer.Refresh();
            var item = create(tableContainer.Table);

            Selection.activeGameObject = CreateRenderable(item);
            ItemCreated?.Invoke(Selection.activeGameObject);
            Undo.RegisterCreatedObjectUndo(Selection.activeGameObject, actionName);
        }
Exemple #9
0
        private void NewEvent(object sender, IEvent e)
        {
            switch (e)
            {
            case ItemCreated itemCreated:
                ItemCreated?.Invoke(sender, itemCreated);
                break;

            case ItemDestroyed itemDestroyed:
                ItemDestroyed?.Invoke(sender, itemDestroyed);
                break;
            }
        }
Exemple #10
0
        public StoryClip CreateStoryBlockClipItem(StoryClip parentUiItem)
        {
            if (parentUiItem == null)
            {
                parentUiItem = RootClip;
            }

            StoryClip item = new StoryClip(this);

            ItemCreated?.Invoke(item, parentUiItem);

            parentUiItem.AddChildItem(item);

            return(item);
        }
Exemple #11
0
        private void OkButton_Click(object sender, RoutedEventArgs e)
        {
            if (IsValidated())
            {
                if (isOnCreation)
                {
                    ItemCreated?.Invoke(noteDisplayedData);
                }

                EndOfInput?.Invoke();
            }
            else
            {
                ctrl.Notify(InvalidDataMessage);
            }
        }
Exemple #12
0
        public UiItem CreateUiItem(UiItem parentUiItem)
        {
            if (parentUiItem == null)
            {
                parentUiItem = RootUiItem;
            }

            UiItem item = new UiItem(null);

            ItemCreatedPreview?.Invoke(item, parentUiItem);

            parentUiItem.AddChildItem(item);

            ItemCreated?.Invoke(item, parentUiItem);

            return(item);
        }
Exemple #13
0
        void CreateItem(object sender, EventArgs e)
        {
            RadioComponent rc = new RadioComponent(

                ModelTxtBox.Text,
                NameTxtBox.Text,
                SpecsTxtBox.Text,
                MaxValTxtBox.Text,
                (float)PriceNumericUpDown.Value
                );

            if (IsValidInput(rc))
            {
                ItemCreated?.Invoke(rc);
                Close();
            }
        }
Exemple #14
0
        public MotionItem CreateMotionEmpty(MotionFolderItem parentFolder = null, string name = null)
        {
            if (parentFolder == null)
            {
                parentFolder = rootFolder;
            }
            if (string.IsNullOrEmpty(name))
            {
                name = GetNewName(MotionItemType.Motion);
            }

            MotionItem motion = new MotionItem(this);

            ItemCreated?.Invoke(motion, parentFolder);

            parentFolder.AddChild(motion);
            motion.SetName(name);

            return(motion);
        }
Exemple #15
0
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            int   number = (int)_numberInput.Value;
            int   rooms  = (int)_roomsInput.Value;
            float area   = (float)_squareinput.Value;

            if (_existingRoom == null)
            {
                Room newRoom = new Room(number, rooms, area, _newId, Administrator.Authorized.Hotel);
                ItemCreated?.Invoke(newRoom);
            }
            else
            {
                _existingRoom.Number          = number;
                _existingRoom.InnerRoomsCount = rooms;
                _existingRoom.Area            = area;
            }

            Close();
        }
Exemple #16
0
        public MotionFolderItem CreateFolder(MotionFolderItem parentFolder = null, string name = null)
        {
            if (parentFolder == null)
            {
                parentFolder = rootFolder;
            }
            if (string.IsNullOrEmpty(name))
            {
                name = GetNewName(MotionItemType.Folder);
            }

            MotionFolderItem folder = new MotionFolderItem(this);

            ItemCreated?.Invoke(folder, parentFolder);

            if (parentFolder != null)
            {
                parentFolder.AddChild(folder);
            }
            folder.SetName(name);

            return(folder);
        }
Exemple #17
0
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            string login      = _loginInput.Text;
            string password   = _passwordInput.Text;
            string name       = _nameInput.Text;
            string surname    = _surnameInput.Text;
            string middleName = _middleNameInput.Text;
            string phone      = _phoneInput.Text;

            int selectedIndex = _hotelUpDown.SelectedIndex;

            if (login == "" || password == "" || name == "" || surname == "" || middleName == "" || phone == "" || selectedIndex == -1)
            {
                DisplayError("Не все поля заполнены!");
                return;
            }

            Hotel newHotel = Database.Hotels.First(x => x.Number == int.Parse(_hotelUpDown.Items[_hotelUpDown.SelectedIndex].ToString().Split(' ')[1]));

            if (_existingAdministrator == null)
            {
                Administrator newAdministrator = new Administrator(_newId, login, password, name, surname, middleName, phone, newHotel);
                ItemCreated?.Invoke(newAdministrator);
            }
            else
            {
                _existingAdministrator.Login      = login;
                _existingAdministrator.Password   = password;
                _existingAdministrator.Name       = name;
                _existingAdministrator.Surname    = surname;
                _existingAdministrator.MiddleName = middleName;
                _existingAdministrator.Phone      = phone;
                _existingAdministrator.Hotel      = newHotel;
            }

            Close();
        }
Exemple #18
0
 protected virtual void OnItemCreated(ItemCreateEventArgs <T> e)
 {
     ItemCreated?.Invoke(this, e);
 }
 protected virtual void OnItemCreated(IndexedItemCreatedEventArgs <TItem> e) =>
 ItemCreated?.Invoke(this, e);
Exemple #20
0
 protected virtual void NotifyItemAdded(View view, object model)
 {
     ItemCreated?.Invoke(this, new RepeaterItemAddedEventArgs(view, model));
 }
 /// <summary>
 /// Sends event <see cref="ItemCreated"/>
 /// </summary>
 protected void SendItemCreatedEvent()
 {
     ItemCreated?.Invoke(this, EventArgs.Empty);
 }
Exemple #22
0
 private void OnItemCreated(object sender, SwatcherCreatedEventArgs e)
 {
     ItemCreated?.Invoke(sender, e);
 }
Exemple #23
0
        private void CreateRootItem()
        {
            RootClip = new StoryClip(this);

            ItemCreated?.Invoke(RootClip, null);
        }