Example #1
0
        private void InitHistoryTable()
        {
            _tbHistory = new DataTable();
            _tbHistory.Columns.Add(ResStrings.str_TagUID, typeof(string));
            _tbHistory.Columns.Add(ResStrings.str_Change_UID_Date, typeof(string));

            Invoke((MethodInvoker) delegate
            {
                //dataGridViewHistory.DataSource = null;
                //dataGridViewHistory.DataSource = tbHistory.DefaultView;

                _tbHistory.DefaultView.RowFilter = null;
                dataListViewHistory.DataSource   = null;
                dataListViewHistory.DataSource   = _tbHistory.DefaultView;

                for (int i = 0; i < dataListViewHistory.Columns.Count; i++)
                {
                    OLVColumn ol      = dataListViewHistory.GetColumn(i);
                    ol.FillsFreeSpace = true;

                    ol.HeaderFont               = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Point, 0);
                    ol.HeaderForeColor          = Color.AliceBlue;
                    ol.IsTileViewColumn         = true;
                    ol.UseInitialLetterForGroup = false;

                    ol.MinimumWidth = 20 + ol.Text.Length * 10;
                    ol.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                    if (ol.Index == dataListViewHistory.Columns.Count - 1)
                    {
                        ol.FillsFreeSpace = true;
                    }
                }
            });
        }
Example #2
0
        private void UpdateDataList()
        {
            DataTable newDt = new DataTable();

            newDt.Columns.Add(ResStrings.BoxModeConfig_UpdateDataList_Box, typeof(string));
            for (int i = 0; i < _columnInfo.Count; i++)
            {
                newDt.Columns.Add(_columnInfo[i].ToString(), typeof(string));
            }

            foreach (string uid in _groupTagList)
            {
                string    selectString = "[" + ResStrings.BoxModeConfig_UpdateGroup_TagUID + "]= '" + uid + "'";
                DataRow[] productInfo  = _dtProductRef.Select(selectString);
                if (productInfo.Length > 0)
                {
                    DataRow rowToadd = newDt.NewRow();
                    rowToadd[0] = ResStrings.BoxModeConfig_UpdateDataList_Box;
                    for (int i = 0; i < _columnInfo.Count; i++)
                    {
                        rowToadd[i + 1] = productInfo[0].ItemArray[i];
                    }
                    newDt.Rows.Add(rowToadd);
                }
                else
                {
                    DataRow rowToadd = newDt.NewRow();
                    rowToadd[0] = ResStrings.BoxModeConfig_UpdateDataList_Box;
                    rowToadd[1] = uid;
                    rowToadd[2] = ResStrings.str_Unreferenced;
                    newDt.Rows.Add(rowToadd);
                }
            }

            dataListView.DataSource = null;
            dataListView.DataSource = newDt;
            dataListView.BuildList();


            for (int i = 0; i < dataListView.Columns.Count; i++)
            {
                OLVColumn ol = dataListView.GetColumn(i);
                ol.Width          = 25;
                ol.FillsFreeSpace = false;
                ol.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                if (ol.Index == dataListView.Columns.Count - 1)
                {
                    ol.FillsFreeSpace = true;
                }
            }
        }
Example #3
0
        private void SetUpChatView()
        {
            List <OLVColumn> columns = new List <OLVColumn>();

            foreach (var key in ProjectInfo.Data.SelectedFields)
            {
                OLVColumn cl = new OLVColumn();
                cl.AspectGetter = delegate(object x)
                {
                    DynamicMessage message = (DynamicMessage)x;
                    return(message.Contents[key]);
                };
                cl.Text     = key;
                cl.WordWrap = true;


                columns.Add(cl);
            }
            suggesterView.AllColumns.Clear();
            suggesterView.AllColumns.AddRange(columns);

            foreach (var cl in suggesterView.AllColumns)
            {
                if (cl.Text != ProjectInfo.TextFieldKey)
                {
                    cl.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                }
                else
                {
                    cl.FillsFreeSpace = true;
                }
            }

            suggesterView.RebuildColumns();
            suggesterView.Refresh();
        }
        private void UpdateGrid(bool bDisplayAll)
        {
            /*int nbTot = 0;
             * int nbOk = 0;
             * int nbMissing = 0;
             * int nbNotExpexted = 0;
             *
             * if (bDisplayAll)
             * {
             *  dt.DefaultView.RowFilter = null;
             *  dataGridViewImport.DataSource = null;
             *  dataGridViewImport.DataSource = dt.DefaultView;
             * }
             * else
             * {
             *  dt.DefaultView.RowFilter = "Status <> 'Ok'";
             *  dataGridViewImport.DataSource = null;
             *  dataGridViewImport.DataSource = dt.DefaultView;
             * }
             *
             *
             * foreach (DataGridViewRow dgvRow in dataGridViewImport.Rows)
             * {
             *
             *
             *  Object cellValue = dgvRow.Cells["Status"].Value;
             *  if (cellValue != null)
             *  {
             *      nbTot++;
             *      switch (cellValue.ToString())
             *      {
             *          case "Ok": dgvRow.DefaultCellStyle.ForeColor = Color.Green; nbOk++; break;
             *          case "Missing": dgvRow.DefaultCellStyle.ForeColor = Color.Red; nbMissing++; break;
             *          case "Not Expected": dgvRow.DefaultCellStyle.ForeColor = Color.Blue;  nbNotExpexted++; break;
             *      }
             *  }
             * }
             * string strInfo = "Info : Nb Total = " + nbTot;
             * if (bDisplayAll)   strInfo += " - Nb Present = " + nbOk;
             * strInfo += " - Nb Missing = " + nbMissing;
             * strInfo += " - Nb Not Expected = " + nbNotExpexted;
             *
             * toolStripStatusLabel.Text = strInfo; */
            int nbTot         = 0;
            int nbOk          = 0;
            int nbMissing     = 0;
            int nbNotExpexted = 0;

            if (bDisplayAll)
            {
                _dt.DefaultView.RowFilter     = null;
                dataListViewImport.DataSource = null;
                dataListViewImport.DataSource = _dt.DefaultView;
            }
            else
            {
                _dt.DefaultView.RowFilter     = ResStrings.CompareInventoryForm_ProcessData_CompareStatus + " <> '" + ResStrings.str_Ok + "'";
                dataListViewImport.DataSource = null;
                dataListViewImport.DataSource = _dt.DefaultView;
            }

            for (int i = 0; i < dataListViewImport.Columns.Count; i++)
            {
                OLVColumn ol = dataListViewImport.GetColumn(i);
                //ol.FillsFreeSpace = true;
                ol.HeaderFont               = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Point, ((byte)(0)));
                ol.HeaderForeColor          = Color.AliceBlue;
                ol.IsTileViewColumn         = true;
                ol.UseInitialLetterForGroup = false;
                ol.MinimumWidth             = 20 + ol.Text.Length * 10;
                ol.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                if (ol.Index == dataListViewImport.Columns.Count - 1)
                {
                    ol.FillsFreeSpace = true;
                }
            }


            foreach (ListViewItem lvi in dataListViewImport.Items)
            {
                string strCase = lvi.SubItems[0].Text;
                {
                    if (strCase.Equals(ResStrings.str_Ok))
                    {
                        lvi.ForeColor = Color.Green; nbOk++;
                    }
                    else if (strCase.Equals(ResStrings.CompareInventoryForm_ProcessData_Missing))
                    {
                        lvi.ForeColor = Color.Red; nbMissing++;
                    }
                    else if (strCase.Equals(ResStrings.CompareInventoryForm_UpdateGrid_Not_Expected))
                    {
                        lvi.ForeColor = Color.Blue; nbNotExpexted++;
                    }
                    else
                    {
                        lvi.ForeColor = Color.Black;
                    }
                }
            }

            if (dataListViewImport.OLVGroups != null)
            {
                for (int i = 0; i < dataListViewImport.OLVGroups.Count; i++)
                {
                    OLVGroup grp = dataListViewImport.OLVGroups[i];
                    grp.Collapsed = true;
                }
            }

            string strInfo = string.Format(ResStrings.CompareInventoryForm_UpdateGrid_, nbTot);

            if (bDisplayAll)
            {
                strInfo += string.Format(ResStrings.CompareInventoryForm_UpdateGrid_NbPresent, nbOk);
            }
            strInfo += string.Format(ResStrings.CompareInventoryForm_UpdateGrid_Missing, nbMissing);
            strInfo += string.Format(ResStrings.CompareInventoryForm_UpdateGrid_Notexpected, nbNotExpexted);

            toolStripStatusLabel.Text = strInfo;
        }
Example #5
0
        private void UpdateHistoryTable(string tagUid)
        {
            try
            {
                _listUidHistory = null;
                string initialUid = _db.GetInitialUID(tagUid);
                if (!string.IsNullOrEmpty(initialUid))
                {
                    _listUidHistory = _db.GetUidHistory(initialUid);
                }

                InitHistoryTable();
                if (_listUidHistory != null)
                {
                    foreach (UidWriteHistory uwh  in _listUidHistory)
                    {
                        DataRow rowToadd = _tbHistory.NewRow();
                        rowToadd[0] = uwh._writtenUid;
                        rowToadd[1] = uwh._writtenDate;
                        _tbHistory.Rows.Add(rowToadd);

                        _initialUid = uwh._initialUid; // last one is initial
                    }
                    if (!string.IsNullOrEmpty(_initialUid))
                    {
                        DataRow rowInitial = _tbHistory.NewRow();
                        rowInitial[0] = _initialUid;
                        _tbHistory.Rows.Add(rowInitial);
                    }
                }

                Invoke((MethodInvoker) delegate
                {
                    //dataGridViewHistory.DataSource = null;
                    //dataGridViewHistory.DataSource = tbHistory.DefaultView;

                    _tbHistory.DefaultView.RowFilter = null;
                    dataListViewHistory.DataSource   = null;
                    dataListViewHistory.DataSource   = _tbHistory.DefaultView;

                    for (int i = 0; i < dataListViewHistory.Columns.Count; i++)
                    {
                        OLVColumn ol = dataListViewHistory.GetColumn(i);
                        //ol.FillsFreeSpace = true;
                        ol.HeaderFont               = new Font("Arial", 12F, FontStyle.Bold, GraphicsUnit.Point, 0);
                        ol.HeaderForeColor          = Color.AliceBlue;
                        ol.IsTileViewColumn         = true;
                        ol.UseInitialLetterForGroup = false;
                        ol.MinimumWidth             = 20 + ol.Text.Length * 10;
                        ol.AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
                        if (ol.Index == dataListViewHistory.Columns.Count - 1)
                        {
                            ol.FillsFreeSpace = true;
                        }
                    }
                });
            }
            catch (Exception exp)
            {
                ErrorMessage.ExceptionMessageBox.Show(exp);
            }
        }