コード例 #1
0
        /// <summary>
        ///   JGENGO: Return Japanese gengo (the name of an era)
        /// </summary>
        protected internal void eval_op_jgengo(ExpressionEvaluator.ExpVal resVal, NUM_TYPE val1, NUM_TYPE val2,
                                               DisplayConvertor displayConvertor)
        {
            String strFormat;
            int    intType;

            resVal.Attr = StorageAttribute.ALPHA;
            if (val1 == null || val2 == null)
            {
                _expressionEvaluator.SetNULL(resVal, StorageAttribute.ALPHA);
                return;
            }

            intType = val2.NUM_2_LONG();

            if (intType >= 4)
            {
                strFormat = "JJJJ";
            }
            else if (intType >= 2)
            {
                strFormat = "JJ";
            }
            else if (intType >= 1)
            {
                strFormat = "J";
            }
            else
            {
                resVal.StrVal = "";
                return;
            }

            _expressionEvaluator.eval_op_date_str(resVal, val1, strFormat, displayConvertor);
        }
コード例 #2
0
        /// <summary>
        /// Converts Magic 'Date' Type to 'dotNetType'
        /// </summary>
        /// <param name="magicVal"></param>
        /// <param name="dotNetType"></param>
        /// <returns></returns>
        private static object convertDateToDotNet(string magicVal, Type dotNetType)
        {
            if (dotNetType == typeof(DateTime))
            {
                NUM_TYPE         numType          = new NUM_TYPE(magicVal);
                DisplayConvertor displayConvertor = DisplayConvertor.Instance;

                int date = numType.NUM_2_LONG();
                if (date == 0)
                {
                    magicVal = FieldDef.getMagicDefaultValue(StorageAttribute.DATE);
                    numType  = new NUM_TYPE(magicVal);
                    date     = numType.NUM_2_LONG();
                }

                // Break date into its components - year month date
                DisplayConvertor.DateBreakParams breakParams = displayConvertor.getNewDateBreakParams();
                displayConvertor.date_break_datemode(breakParams, date, true, -1);
                int year  = breakParams.year;
                int month = breakParams.month;
                int day   = breakParams.day;

                return(new DateTime(year, month, day));
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        public void Convert(DBField sourceField, DBField destinationField, FieldValue sourceValue, FieldValue destinationValue)
        {
            switch ((StorageAttribute)destinationField.Attr)
            {
            case StorageAttribute.ALPHA:
            case StorageAttribute.UNICODE:
                var pic = new PIC(sourceField.Picture, StorageAttribute.NUMERIC, 0);
                destinationValue.Value = DisplayConvertor.Instance.mg2disp(sourceValue.Value.ToString(), null, pic, false, 0, true, false);
                break;

            case StorageAttribute.BOOLEAN:
                NUM_TYPE num = new NUM_TYPE(sourceValue.Value.ToString());
                destinationValue.Value = num.NUM_2_LONG() > 0 ? "1" : "0";
                break;

            case StorageAttribute.NUMERIC:
            case StorageAttribute.DATE:
            case StorageAttribute.TIME:
                destinationValue.Value = sourceValue.Value;
                break;
            }
        }
コード例 #4
0
ファイル: CommandFactory.cs プロジェクト: rinavin/RCJS
        /// <summary>
        ///   creates only a real refresh event command
        /// </summary>
        /// <returns>newly created command.</returns>
        internal static RefreshEventCommand CreateRealRefreshCommand(String taskId, int magicEvent, int currentRow, ArgumentsList argList, int currentRecId)
        {
            RefreshEventCommand cmd = new RefreshEventCommand(magicEvent)
            {
                TaskTag          = taskId,
                RefreshMode      = ViewRefreshMode.CurrentLocation,
                KeepUserSort     = false,
                ClientRecId      = currentRecId,
                CurrentRecordRow = currentRow
            };

            if (argList != null && argList.getSize() != 0)
            {
                try
                {
                    var refreshMode = new NUM_TYPE(argList.getArgValue(0, StorageAttribute.NUMERIC, 0));
                    cmd.RefreshMode = (ViewRefreshMode)refreshMode.NUM_2_LONG() + 1;
                }
                catch (Exception)
                {
                    cmd.RefreshMode = ViewRefreshMode.CurrentLocation;
                }

                if (argList.getSize() > 1)
                {
                    try
                    {
                        cmd.KeepUserSort = (argList.getArgValue(1, StorageAttribute.BOOLEAN, 0) == "1");
                    }
                    catch (Exception)
                    {
                        cmd.KeepUserSort = false;
                    }
                }
            }

            return(cmd);
        }
コード例 #5
0
ファイル: CommandFactory.cs プロジェクト: rinavin/RCJS
        ///   creates an Index Change event command
        /// </summary>
        /// <returns>newly created command.</returns>
        internal static IndexChangeEventCommand CreateIndexChangeCommand(string taskTag, int recId, ArgumentsList argList)
        {
            IndexChangeEventCommand cmd = new IndexChangeEventCommand
            {
                TaskTag     = taskTag,
                ClientRecId = recId
            };

            // 1 parameter : The new Key Index
            if (argList != null && argList.getSize() != 0)
            {
                try
                {
                    var keyIndex = new NUM_TYPE(argList.getArgValue(0, StorageAttribute.NUMERIC, 0));
                    cmd.KeyIndex = keyIndex.NUM_2_LONG();
                }
                catch (Exception)
                {
                    cmd.KeyIndex = 0;
                }
            }

            return(cmd);
        }