Esempio n. 1
0
        public override Dictionary <string, Field> GetUpdateFields()
        {
            ComboBoxField primary     = new ComboBoxField(keyValueData.Keys, "Номер госрегистрации автомобиля");
            TextField     surname     = new TextField("Фамилия");
            TextField     name        = new TextField("Имя");
            TextField     second_name = new TextField("Отчество");
            TextField     address     = new TextField("Адрес");

            primary.SelectedValueChanged += (string newPrimary) =>
            {
                object[] newCurrent = keyValueData[newPrimary];

                surname.SetValue(newCurrent[1]);
                name.SetValue(newCurrent[2]);
                second_name.SetValue(newCurrent[3]);
                address.SetValue(newCurrent[4]);
            };

            primary.ResetSelectedItem();

            return(new Dictionary <string, Field>
            {
                { "auto_register_number", primary },
                { "surname", surname },
                { "name", name },
                { "second_name", second_name },
                { "address", address }
            });
        }
Esempio n. 2
0
        public override Dictionary <string, Field> GetDeleteFields()
        {
            if (keyValueData.Count == 0)
            {
                throw new NoRowsToEditException();
            }

            User user = Program.Container.GetCurrentUser();

            IEnumerable <string> comboValues = user.Role.Name == "worker" ? GetCurrentUserKeys() : keyValueData.Keys;

            if (comboValues.Count() == 0)
            {
                throw new NoRowsToEditException();
            }

            ComboBoxField combo = new ComboBoxField(comboValues, "Id");

            combo.ResetSelectedItem();

            return(new Dictionary <string, Field>
            {
                { "id", combo }
            });
        }
Esempio n. 3
0
        public override Dictionary <string, Field> GetUpdateFields()
        {
            ComboBoxField primary   = new ComboBoxField(keyValueData.Keys, "Номер госрегистрации");
            TextField     newRegNum = new TextField("Новый номер госрегистрации");
            TextField     mark      = new TextField("Марка");
            TextField     year      = new TextField("Год выпуска");
            TextField     creator   = new TextField("Изготовитель");

            primary.SelectedValueChanged += (string newPrimary) =>
            {
                object[] newCurrent = keyValueData[newPrimary];
                newRegNum.SetValue(newPrimary);
                mark.SetValue(newCurrent[1]);
                year.SetValue(newCurrent[2]);
                creator.SetValue(newCurrent[3]);
            };

            primary.ResetSelectedItem();

            return(new Dictionary <string, Field>
            {
                { "register_number", primary },
                { "new_register_number", newRegNum },
                { "mark", mark },
                { "year", year },
                { "creator", creator },
            });
        }
Esempio n. 4
0
        public override Dictionary <string, Field> GetDeleteFields()
        {
            ComboBoxField combo = new ComboBoxField(keyValueData.Keys, "Номер госрегистрации автомобиля");

            combo.ResetSelectedItem();

            return(new Dictionary <string, Field>
            {
                { "auto_register_number", combo }
            });
        }
Esempio n. 5
0
        public override Dictionary <string, Field> GetDeleteFields()
        {
            ComboBoxField combo = new ComboBoxField(keyValueData.Keys, pasport.Title);

            combo.ResetSelectedItem();

            return(new Dictionary <string, Field>
            {
                { pasport.Code, combo }
            });
        }
Esempio n. 6
0
        public Dictionary <string, Field> GetResult()
        {
            var keyValueData = this.keyValueData;
            var textFields   = this.textFields;

            primary.SelectedValueChanged += (string newValue) =>
            {
                object[] newCurrent = keyValueData[newValue];

                foreach (var pair in textFields)
                {
                    pair.Value.SetValue(newCurrent[pair.Key]);
                }
            };

            if (primary.ItemsCount > 0)
            {
                primary.ResetSelectedItem();
            }

            return(result);
        }