public static void addData(FormInstance dm, System.String xpath, System.Object data, int dataType) { if (data == null) { dataType = -1; } IAnswerData val; switch (dataType) { case -1: val = null; break; case Constants.DATATYPE_TEXT: val = new StringData((System.String)data); break; case Constants.DATATYPE_INTEGER: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new IntegerData(ref new System.Int32[] { (System.Int32)data }[0]); break; case Constants.DATATYPE_LONG: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new LongData(ref new System.Int64[] { (System.Int64)data }[0]); break; case Constants.DATATYPE_DECIMAL: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new DecimalData(ref new System.Double[] { (System.Double)data }[0]); break; case Constants.DATATYPE_BOOLEAN: val = new StringData(((System.Boolean)data) ? "t" : "f"); break; case Constants.DATATYPE_DATE: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new DateData(ref new System.DateTime[] { (System.DateTime)data }[0]); break; case Constants.DATATYPE_DATE_TIME: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new DateTimeData(ref new System.DateTime[] { (System.DateTime)data }[0]); break; case Constants.DATATYPE_TIME: //UPGRADE_NOTE: ref keyword was added to struct-type parameters. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1303'" val = new TimeData(ref new System.DateTime[] { (System.DateTime)data }[0]); break; case Constants.DATATYPE_CHOICE_LIST: val = (SelectMultiData)data; break; default: throw new System.ArgumentException("Don't know how to handle data type [" + dataType + "]"); } TreeReference ref_Renamed = absRef(xpath, dm); if (dm.addNode(ref_Renamed, val, dataType) == null) { throw new System.SystemException("error setting value during object backup [" + xpath + "]"); } }
public virtual System.Object serializeAnswerData(IntegerData data) { return(((System.Int32)data.Value).ToString()); }