/// <summary> /// gets the default DotNetType for 'magicType'. /// </summary> public Type GetDefaultDotNetTypeForMagicType() { Type dotNetType = null; switch (getType()) { case StorageAttribute.BLOB: { if (getContentType() == BlobType.CONTENT_TYPE_BINARY) { dotNetType = typeof(Byte[]); } else { dotNetType = DNConvert.getDefaultDotNetTypeForMagicType(null, getType()); } } break; case StorageAttribute.NUMERIC: { PIC pic = new PIC(_picture, StorageAttribute.NUMERIC, getTask().getCompIdx()); if (pic.getDec() > 0) { dotNetType = typeof(Double); } else { dotNetType = typeof(long); } } break; default: dotNetType = DNConvert.getDefaultDotNetTypeForMagicType(null, getType()); break; } return(dotNetType); }
/// <summary> /// ***********************Numeric***************************************** /// </summary> private void getRealNumericPicture() { String mask = _picData.getMask(); int dec_ = _picData.getDec(); int whole_ = _picData.getWholes(); bool decimal_ = _picData.withDecimal(); bool dec_pnt_in_first = _picData.decInFirstPos(); bool isNegative = _picData.isNegative(); bool isFirstPic_N = true; bool isPointInserted = false; int currChar; for (int i = 0; i < _picData.getMaskSize(); i++) { currChar = mask[i]; // it's ASCII of the char switch (currChar) { case PICInterface.PIC_N: if (isFirstPic_N) { if (isNegative) { setPictures('-', '0'); } if (dec_pnt_in_first) { setPictures('.', '1'); isPointInserted = true; } else if (whole_ > 0) { whole_--; setPictures('#', '0'); } isFirstPic_N = false; break; } if (decimal_) { if (whole_ > 0) { whole_--; setPictures('#', '0'); } else if (whole_ == 0 && !isPointInserted) { setPictures('.', '1'); isPointInserted = true; } else if (dec_ > 0) { dec_--; setPictures('#', '0'); } } else { if (whole_ > 0) { whole_--; setPictures('#', '0'); } } break; default: // const string in Alpha setPictures((char)currChar, '1'); break; } } Events.WriteDevToLog(_pictureReal.ToString()); Events.WriteDevToLog(_pictureEnable.ToString()); }