Esempio n. 1
0
        public void ChangeInfo(View view, int indexRow, DBHelper.ADVANCED_S_TABLES columnProperty)
        {
            // Проверка на то, имеется ли ссылка на справочную таблицу
            if (columnProperty.S_TABLE != null)
            {
                // если имеется, то подставляем справочное значение
                // проверка на null
                if (_tableRows[_currentPosition][indexRow] != DBNull.Value)
                {
                    var connection   = ConnectionClass.CreateDatabase();
                    var sTableResult = connection.Query <DBHelper.S_INFO_TABLES>(
                        $"select * from S_INFO_TABLES where TABLE_NAME='{columnProperty.S_TABLE}' and ID={Convert.ToInt32(_tableRows[_currentPosition][indexRow])}").ToList();
                    SetTextInfo(view, sTableResult[0].VALUE);
                    connection.Close();
                }
                else
                {
                    GetTextLayout(columnProperty.READONLY, "");
                    SetTextInfo(view, "");
                }
            }
            else
            {
                // Задаем новое значение в соответствии с типом контрола
                switch (columnProperty.COLUMNTYPE)
                {
                case "text":
                case "varchar":
                    SetTextInfo(view, _tableRows[_currentPosition][indexRow] != DBNull.Value ? Convert.ToString(_tableRows[_currentPosition][indexRow]) : "");
                    break;

                case "int":
                case "smallint":
                    SetNumericInfo(view, _tableRows[_currentPosition][indexRow] != DBNull.Value ? Convert.ToInt32(_tableRows[_currentPosition][indexRow]) : int.MinValue);
                    break;

                case "float":
                case "double":
                    SetDoubleInfo(view, _tableRows[_currentPosition][indexRow] != DBNull.Value ? Convert.ToDouble(_tableRows[_currentPosition][indexRow])
                            : double.MinValue, columnProperty.FORMAT);
                    break;

                case "long":
                case "date":
                case "datetime":
                    SetDateInfo(view, _tableRows[_currentPosition][indexRow] != DBNull.Value ? Convert.ToInt64(_tableRows[_currentPosition][indexRow]) : long.MinValue);
                    break;

                case "bit":
                case "bool":
                    SetSwitchInfo(view, _tableRows[_currentPosition][indexRow] != DBNull.Value && Convert.ToInt16(_tableRows[_currentPosition][indexRow]) == 1);
                    break;
                }
            }
        }
Esempio n. 2
0
        public TextPopupPage(View view, DBHelper.ADVANCED_S_TABLES property, CellType cellType, string sysName)
        {
            InitializeComponent();
            _view     = view;
            _property = property;
            _cellType = cellType;
            //// Получим строку для определения верхней и нижней границы
            //StringBuilder minmax = new StringBuilder("(");
            //if (property.MIN_V != 0)
            //    minmax.Append(String.Format("от {0} ", property.MIN_V));
            //if(property.MAX_V != 0)
            //    minmax.Append(String.Format("до {0}", property.MAX_V));
            //minmax.Append(")");
            // Добавляем описание нашего popup окна
            Header = $"{property.DESCRIPTION}";

            // Смотрим, есть ли у нас колонка с CultureInfo
            var driver = Ais7DataColumnDriver.Create(sysName, property.TABLE_COLUMN);

            if (driver is Ais7DataColumnDriver_V_ISSO_W_ISSO)
            {
                editorText.Behaviors.Add(IntColonValidatorBehavior.Instance);
                _cellType = CellType.IsLocation;
            }

            switch (_cellType)
            {
            case CellType.IsNumeric:
            case CellType.IsDouble:
                editorText.Keyboard = Keyboard.Numeric;
                break;

            case CellType.IsLocation:
                editorText.Keyboard = Keyboard.Telephone;
                break;
            }

            editorText.Text = ((Label)((Grid)view).Children[0]).Text;
        }
Esempio n. 3
0
        public async void DoAnimation(View view, SwipeDirections direction, int indexRow, DBHelper.ADVANCED_S_TABLES columnProperty)
        {
            switch (direction)
            {
            case SwipeDirections.LeftSwipe:
                // двигаем вьюху влево
                await Task.WhenAny
                (
                    view.TranslateTo(-100, 0, _millisecondsAnim),
                    view.FadeTo(0, _millisecondsAnim)
                );

                // затем переносим её вправо и двигаем на исходное место
                await view.TranslateTo(100, 0, 0);

                if (indexRow != -1)
                {
                    ChangeInfo(view, indexRow, columnProperty);
                }
                else
                {
                    //Label_number.Text = String.Format("Запись №{0}", current_position + 1);
                    picker_entries.SelectedIndex = _currentPosition;
                }
                await Task.WhenAny
                (
                    view.TranslateTo(0, 0, _millisecondsAnim),
                    view.FadeTo(1, _millisecondsAnim)
                );

                break;

            case SwipeDirections.RightSwipe:
                // двигаем вьюху вправо
                await Task.WhenAny
                (
                    view.TranslateTo(100, 0, 100),
                    view.FadeTo(0, 100)
                );

                // затем переносим её влево и двигаем на исходное место
                await view.TranslateTo(-100, 0, 0);

                if (indexRow != -1)
                {
                    ChangeInfo(view, indexRow, columnProperty);
                }
                else
                {
                    //Label_number.Text = String.Format("Запись №{0}", current_position + 1);
                    picker_entries.SelectedIndex = _currentPosition;
                }

                await Task.WhenAny
                (
                    view.TranslateTo(0, 0, 100),
                    view.FadeTo(1, 100)
                );

                break;
            }
        }