internal override object ConvertGatewayToRuntimeField(DBField dbField, object gatewayValue) { NUM_TYPE value = new NUM_TYPE(); if (dbField.Length <= 2) { value.NUM_4_LONG((short)gatewayValue); } else { value.NUM_4_LONG((int)gatewayValue); } return(value.toXMLrecord()); }
/// <summary> /// Converts 'dotNetObj' to 'Time' Magic type /// </summary> /// <param name="dotNetObj"></param> /// <returns></returns> private static string convertDotNetToTime(object dotNetObj) { String retObject = ""; Type dotNetType = dotNetObj.GetType(); if (dotNetType == typeof(DateTime)) { DateTime date = (DateTime)dotNetObj; int magicTime = DisplayConvertor.Instance.time_2_int(date.Hour, date.Minute, date.Second); NUM_TYPE numtypeMagicTime = new NUM_TYPE(); numtypeMagicTime.NUM_4_LONG(magicTime); retObject = numtypeMagicTime.toXMLrecord(); } else if (dotNetType == typeof(TimeSpan)) { TimeSpan time = (TimeSpan)dotNetObj; int magicTime = DisplayConvertor.Instance.time_2_int(time.Hours, time.Minutes, time.Seconds); NUM_TYPE numtypeMagicTime = new NUM_TYPE(); numtypeMagicTime.NUM_4_LONG(magicTime); retObject = numtypeMagicTime.toXMLrecord(); } return(retObject); }
/// <summary>Adds the pane to the status bar/// </summary> /// <param name="statusBarIdx">Status bar index</param> /// <param name="paneType">Pane type: label or image</param> /// <param name="paneIdx">Pane index</param> /// <param name="paneWidth">Pane width</param> /// <param name="showPaneBorder">Show border or not</param> public void AddPane(MgControlType paneType, int paneIdx, int paneWidth, bool showPaneBorder) { var num = new NUM_TYPE(); //Get status bar index. int statusBarIdx = getForm().getControlIdx(this); // Create pane object MgControlBase paneObj = getForm().ConstructMgControl(paneType, getForm().getTask(), statusBarIdx); if (paneObj != null) { // Set width of pane object. num.NUM_4_LONG(paneWidth); paneObj.setProp(PropInterface.PROP_TYPE_WIDTH, num.toXMLrecord()); // Set Idx of pane object. num.NUM_4_LONG(paneIdx); paneObj.setProp(PropInterface.PROP_TYPE_LAYER, num.toXMLrecord()); // Set border of pane object. if (showPaneBorder) { paneObj.setProp(PropInterface.PROP_TYPE_BORDER, "1"); } //Properties specific to image pane only. if (paneObj.Type == MgControlType.CTRL_TYPE_SB_IMAGE) { paneObj.DataType = StorageAttribute.ALPHA; paneObj.setPIC("1000"); num.NUM_4_LONG((int)CtrlImageStyle.Copied); paneObj.setProp(PropInterface.PROP_TYPE_IMAGE_STYLE, num.toXMLrecord()); } //Add to control table collection. getForm().CtrlTab.addControl(paneObj); //Add to collection. Debug.Assert(!_paneObjectsCollection.ContainsKey(paneIdx)); _paneObjectsCollection[paneIdx] = paneObj; } }
/// <summary> /// Converts 'dotNetObj' to 'Date' Magic type /// </summary> /// <param name="dotNetObj"></param> /// <returns></returns> private static string convertDotNetToDate(object dotNetObj) { String retObject = ""; Type dotNetType = dotNetObj.GetType(); if (dotNetType == typeof(DateTime)) { DateTime date = (DateTime)dotNetObj; int magicDate = DisplayConvertor.Instance.date_4_calender(date.Year, date.Month, date.Day, 0, false); NUM_TYPE numtypeMagicDate = new NUM_TYPE(); numtypeMagicDate.NUM_4_LONG(magicDate); retObject = numtypeMagicDate.toXMLrecord(); } return(retObject); }
/// <summary> /// Converts 'dotNetObj' to 'Numeric' Magic type /// </summary> /// <param name="dotNetObj"></param> /// <returns></returns> private static string convertDotNetToNumeric(object dotNetObj) { Double doubleVal = 0.0; Type dotNetType = dotNetObj.GetType(); NUM_TYPE numType; if (dotNetType.IsEnum) { dotNetType = Enum.GetUnderlyingType(dotNetType); } if (dotNetType == typeof(SByte) || dotNetType == typeof(Byte) || dotNetType == typeof(Int16) || dotNetType == typeof(UInt16) || dotNetType == typeof(Int32) || dotNetType == typeof(Char)) { int intVal = (int)ReflectionServices.DynCast(dotNetObj, typeof(int)); numType = new NUM_TYPE(); numType.NUM_4_LONG(intVal); } else if (dotNetType == typeof(UInt32) || dotNetType == typeof(Int64) || dotNetType == typeof(UInt64) || dotNetType == typeof(float) || dotNetType == typeof(Decimal) || dotNetType == typeof(Single) || dotNetType == typeof(Double)) { doubleVal = (Double)ReflectionServices.DynCast(dotNetObj, typeof(Double)); numType = NUM_TYPE.from_double(doubleVal); } else { if (dotNetType == typeof(IntPtr)) { doubleVal = (Double)((IntPtr)dotNetObj).ToInt64(); } else if (dotNetType == typeof(UIntPtr)) { doubleVal = (Double)((UIntPtr)dotNetObj).ToUInt64(); } numType = NUM_TYPE.from_double(doubleVal); } return(numType.toXMLrecord()); }