Пример #1
0
        /// <summary>
        /// ComputeAndRefresh DataColumn
        /// </summary>
        /// <param name="colID"></param>
        /// <param name="removeHandler"></param>
        /// <param name="colVal"></param>
        private void ComputeAndRefreshColumn(int colID, bool removeHandler, ref object colVal)
        {
            Field field = null;

            if (colID > 0)
            {
                int fldIdx = DVDataTableObj.GetFldIdx(colID);
                field = (Field)DVControl.getForm().getTask().DataView.getField(fldIdx);
            }

            //First column is 'Isn'. Give a call to core to fetch PosCache's current Isn. And store it
            if (colID == 0)
            {
                colVal = (int)((TaskBase)DVControl.getForm().getTask()).GetDVControlPosition();
            }
            else if (field != null)
            {
                String value   = String.Empty;
                Object dnValue = null;
                bool   isNull  = false;

                //get field's value by
                ((TaskBase)field.getTask()).getFieldDisplayValue(field, ref value, ref isNull);

                dnValue = DNConvert.convertMagicToDotNet(value, field.getType(), typeof(Object));
                colVal  = dnValue;
            }
        }
Пример #2
0
        /// <summary>InitiateLoadingDataTable()
        /// </summary>
        public void InitiateLoadingDataTable()
        {
            initialDataLoading = true;

            // isDataBound will be true, if we are here due to vew_refresh(). remove the data binding of dvcontrol
            // before loading records.
            if (isDataBound)
            {
                // Set data table to datasource.
                string propName = DVControl.getProp(PropInterface.PROP_TYPE_DN_CONTROL_DATA_SOURCE_PROPERTY).getValue();
                Commands.SetDataSourceToDataViewControl(DVControl, null, propName);
            }
        }
Пример #3
0
        /// <summary>TerminateLoadingDataTable()
        /// </summary>
        public void TerminateLoadingDataTable()
        {
            initialDataLoading = false;

            DVDataTableObj.DataTblObj.AcceptChanges(); // commit all rows.

            // bind data table to datasource.
            string propName = DVControl.getProp(PropInterface.PROP_TYPE_DN_CONTROL_DATA_SOURCE_PROPERTY).getValue();

            Commands.SetDataSourceToDataViewControl(DVControl, DVDataTableObj.DataTblObj, propName);
            isDataBound = true;

            // add handlers
            Commands.addAsync(GuiCommandType.ADD_DVCONTROL_HANDLER, DVControl, DVDataTableObj.DataTblObj);
        }
Пример #4
0
 /// <summary>
 /// This will be called, while fetching records into DataTable at the start to create row.
 /// </summary>
 /// <param name="idx"></param>
 internal void checkAndCreateRow(int idx)
 {
     if (!DVControl.getForm().getTask().DataView.isEmptyDataview())
     {
         if (!initialDataLoading)
         {
             // When new row is created in dataTable,"Isn" column which is primary key of dataTable
             // need to be initialized. this invokes of DataTable's ColumnChanged Handler. So, in order to avoid
             // this, DVControl Handler should be unregisterd before creating new row.
             Commands.addAsync(GuiCommandType.REMOVE_DVCONTROL_HANDLER, DVControl, DVDataTableObj.DataTblObj);
             DVDataTableObj.checkAndCreateRow(idx);
             Commands.addAsync(GuiCommandType.ADD_DVCONTROL_HANDLER, DVControl, DVDataTableObj.DataTblObj);
         }
         else
         {
             DVDataTableObj.CurrRow = idx;
         }
     }
 }
Пример #5
0
        /// <summary>Refresh row of DVControl.
        /// </summary>
        internal void RefreshDisplay()
        {
            if (DVDataTableObj.ColumnList != null && !DVControl.getForm().getTask().DataView.isEmptyDataview())
            {
                object[] row = new object[DVDataTableObj.DataTblObj.Columns.Count];

                for (int i = 0; i <= DVDataTableObj.ColumnList.Count; i++)
                {
                    ComputeAndRefreshColumn(i, false, ref row[i]);
                }

                if (initialDataLoading)
                {
                    DVDataTableObj.LoadNewRow(row);
                }
                else
                {
                    Commands.addAsync(GuiCommandType.UPDATE_DVCONTROL_ROW, DVDataTableObj, DVDataTableObj.CurrRow, row);
                }
            }
        }