Exemplo n.º 1
0
 public GraphData(Table table)
 {
     Table = table;
     TableValues.ForEach(graphTableCell => graphTableCell.GraphTablePropertyChanged += GraphTableCell_GraphTablePropertyChanged);
     GraphValues = new List <GraphCell>();
     Width       = table.Width;
 }
Exemplo n.º 2
0
        public CaptureManager(IOnlineManager onlineManager)
        {
            this.onlineManager = onlineManager;

            table = new TableValues <byte, float>();
            table.ValueChanged    += TableOnValueChanged;
            table.PropertyChanged += TableOnPropertyChanged;

            onlineManager.FirmwareManager.OnOpenFirmware  += FirmwareManagerOnOpenFirmware;
            onlineManager.FirmwareManager.OnCloseFirmware += FirmwareManagerOnOpenFirmware;
            onlineManager.FirmwareManager.PropertyChanged += FirmwareManagerOnPropertyChanged;

            onlineManager.FirmwareManager.AutoCorrection += (sender, args) =>
            {
                if (!onlineManager.EnabledRamOnlineCorrection)
                {
                    return;
                }
                if (CapturedTable == null || CapturedTable.Address != args.Address)
                {
                    return;
                }

                CapturedTable.SetSource(args.Index, args.Source);
                args.Cancel = true;
            };

            SetEnabled();
        }
Exemplo n.º 3
0
        private void LoadTable(int rowIndex, string part)
        {
            if (ItemInfo == null)
            {
                return;
            }
            if (Table == null)
            {
                Table = new TableValues <int, float>(ItemInfo.Address, ItemInfo.ColCount, ItemInfo.RowCount,
                                                     this.Convert2Value, this.Convert2Source);

                Table.PropertyChanged += Table_PropertyChanged;
            }

            var cols = part.Split(' ');

            if (cols.Length != ItemInfo.ColCount)
            {
                return;
            }

            for (int i = 0; i < cols.Length; i++)
            {
                int cell;
                if (!int.TryParse(cols[i], out cell))
                {
                    continue;
                }

                Table[i, rowIndex] = cell;
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="tableName"></param>
 /// <param name="tableValues"></param>
 /// <returns></returns>
 protected virtual string CreateTableSQL(string tableName, TableValues tableValues)
 {
     if (tableValues == null)
     {
         throw new ArgumentNullException("tableValues");
     }
     StringBuilder stringBuilder = new StringBuilder("CREATE TABLE");
     stringBuilder.Append(SPACE_CHAR);
     stringBuilder.Append(tableName);
     stringBuilder.Append(";");
     return stringBuilder.ToString();
 }
Exemplo n.º 5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tableName"></param>
        /// <param name="tableValues"></param>
        /// <returns></returns>
        protected virtual string CreateTableSQL(string tableName, TableValues tableValues)
        {
            if (tableValues == null)
            {
                throw new ArgumentNullException("tableValues");
            }
            StringBuilder stringBuilder = new StringBuilder("CREATE TABLE");

            stringBuilder.Append(SPACE_CHAR);
            stringBuilder.Append(tableName);
            stringBuilder.Append(";");
            return(stringBuilder.ToString());
        }
Exemplo n.º 6
0
        private void FillGbc()
        {
            gbc = new TableValues <byte, short>(FirmwareHelper.GbcAddr, 16, 16,
                                                source =>
                                                (short)
                                                (Math.Round(source * 8f / 3f,
                                                            MidpointRounding.AwayFromZero)),
                                                value =>
                                                (byte)
                                                Math.Round(value * 3f / 8f,
                                                           MidpointRounding.AwayFromZero));

            InitTable(gbc, buffer);
            gbc.PropertyChanged += GBCOnPropertyChanged;
        }
Exemplo n.º 7
0
        public static void FillMinMax(TableValues <byte, float> table, EntryBase entry)
        {
            float min = table.converter((byte)table.RawMin);
            float max = table.converter((byte)table.RawMax);

            if (entry.Lower_lim != 0)
            {
                min = (float)entry.Lower_lim;
            }
            if (entry.Upper_lim != 0)
            {
                max = (float)entry.Upper_lim;
            }
            table.Min = min;
            table.Max = max;
        }
Exemplo n.º 8
0
        private void FillKGbcPress()
        {
            var colCount = J7esFlags.IsKgbcPress32_32 ? 32 : 16;
            var rowCount = J7esFlags.IsKgbcPress32_32 ? 32 : 16;

            kgbc_press = new TableValues <byte, float>(FirmwareHelper.KGbcPressAddr, colCount, rowCount,
                                                       source =>
                                                       (float)
                                                       Math.Round(source / 128f, 2,
                                                                  MidpointRounding.AwayFromZero),
                                                       value =>
                                                       (byte)
                                                       Math.Round((value > 1.992f ? 1.992f : value) * 128f,
                                                                  MidpointRounding.AwayFromZero));

            InitTable(kgbc_press, buffer);
        }
Exemplo n.º 9
0
        private void FillKGbc()
        {
            var colCount = J7esFlags.IsKgbc32_16 ? 32 : 16;

            kgbc = new TableValues <byte, float>(FirmwareHelper.KGbcAddr, colCount, 16,
                                                 source =>
                                                 (float)
                                                 Math.Round(source / 128f, 2,
                                                            MidpointRounding.AwayFromZero),
                                                 value =>
                                                 (byte)
                                                 Math.Round((value > 1.992f ? 1.992f : value) * 128f,
                                                            MidpointRounding.AwayFromZero));

            InitTable(kgbc, buffer);
            kgbc.PropertyChanged += KGBOnPropertyChanged;
        }
Exemplo n.º 10
0
        public int CreateTable(string tableName, TableValues tableValues)
        {
            string sql = CreateTableSQL(tableName, tableValues);

            return(ExecSql(sql));
        }
Exemplo n.º 11
0
 public int CreateTable(string tableName, TableValues tableValues)
 {
     string sql = CreateTableSQL(tableName,tableValues);
     return ExecSql(sql);
 }
Exemplo n.º 12
0
        private void BuildTableData(int patientItemId)
        {
            string tableName       = service.GetTableName();
            string tablePriKeyName = service.GetPriKeyName();
            IEnumerable <string> display_fields = service.GetFieldNames();
            DataView             view           = new DataView();

            int pageNum       = PageNumber;
            int start_row_num = GetStart(pageNum);
            int end_row_num   = GetEnd(pageNum);

            // build pager
            //int count = service.GetVisitRelatedRecordsCount();
            //BuildPages(count);

            DataTable table = service.GetVisitRelatedRecords(start_row_num, end_row_num);

            // clear columns, except special columns
            while (TableValues.Columns.Count > 1)
            {
                TableValues.Columns.RemoveAt(1);
            }

            //string[] display_columns = new string[] { "TableName" }.Concat(display_fields).Distinct().ToArray();
            // get display fields, flatted date fields
            string[] display_columns = display_fields.Except(from field in display_fields
                                                             where field.EndsWith("DateText") || field.EndsWith("Source") || field.EndsWith("Quality")
                                                             select field).ToArray();

            // add table value fields
            for (int i = 0; i < display_columns.Length; i++)
            {
                string     fieldName = display_columns[i];
                BoundField bf        = new BoundField();
                bf.DataField  = fieldName;
                bf.HeaderText = fieldName == "TableName" ? "Table" : pdec.GetFieldLabel(tableName, fieldName);
                if (fieldName.EndsWith("Date"))
                {
                    bf.DataFormatString = "{0:d}";
                }
                TableValues.Columns.Add(bf);
            }

            updateRowsIndexes.Clear();

            view = table.DefaultView;

            // build header
            TableHeaderRptr.DataSource = TableValues.Columns.Cast <DataControlField>().Select(c => c.HeaderText).ToArray();
            TableHeaderRptr.DataBind();

            // build data
            TableValues.DataKeyNames = new string[] { "TableName", tablePriKeyName };
            TableValues.DataSource   = view;
            TableValues.DataBind();

            RecordCount.Text = view.Count + " Record(s)";

            if (view.Count == 0)
            {
                Message.Text            = "There are no " + (!string.IsNullOrEmpty(tableName) ? pdec.GetTableLabel(tableName) : "") + " records for this Patient.";
                Message.Visible         = true;
                TableHeaderRptr.Visible = false;
                TableValues.Visible     = false;
                UpdateBtn.Visible       = false;
            }
            else
            {
                Message.Visible         = false;
                TableHeaderRptr.Visible = true;
                TableValues.Visible     = true;
                UpdateBtn.Visible       = true;
            }
        }