static void CreateFirstBranch(NodeReference node, Connection myConn) { node.AppendSubscript("111111111111"); node.Set("Smith,John"); node.AppendSubscript("DBO546"); node.Set("Some bank 1"); node.AppendSubscript(29244825509100); node.Set(28741.35); node.AppendSubscript(2145632596588547); string slip = "Smith,John/1965"; byte[] bytes = System.Text.Encoding.GetEncoding(1251).GetBytes(slip); node.Set(bytes); node.AppendSubscript(1); ValueList myList = myConn.CreateList(); myList.Append(0, 29244225564111, "John Doe", 500.26, "Payment for goods from ToysRUs"); node.Set(myList); myList.Close(); node.SetSubscriptCount(4); node.AppendSubscript(2); myList = myConn.CreateList(); myList.Append(0, 26032009100100, "John Smith", 115.54, "Transfer to own account in different bank"); node.Set(myList); myList.Close(); Console.WriteLine("Info about first bank is createed"); }
// complex (multi-value) property access methods #region complex properties public int ValueCount(string property_name) { ValueList working_vl = _DocNodeRef.GetList(property_name, VALUE_SUBSCRIPT); int result = working_vl.Length; working_vl.Close(); return(result); // we can't just return ...GetList(...).Length because we need to close the VL object explicitly }
static void CreateSecondBranch(NodeReference node, Connection myConn) { node.SetSubscriptCount(1); node.Set("Some bank 2", "DXO987"); node.Set(65241.24, "DXO987", 26032009100100); string slip = "Smith John||1965"; byte[] bytes = System.Text.Encoding.GetEncoding(1251).GetBytes(slip); node.Set(bytes, "DXO987", 26032009100100, 6541963285249512); ValueList myList = myConn.CreateList(); myList.Append(1, 29242664509184, "Jane Doe", 500.26, "Recurring payment to Amazon"); node.Set(myList, "DXO987", 26032009100100, 6541963285249512, 1); myList.Close(); myList = myConn.CreateList(); myList.Append(0, 26548962495545, "John Doe", 1015.10, "Payment for delivery"); node.Set(myList, "DXO987", 26032009100100, 6541963285249512, 2); myList.Close(); Console.WriteLine("Info about second bank is createed"); }
private void AppendActualString(string property_name, string new_value) { ValueList current_vl = _DocNodeRef.GetList(property_name, VALUE_SUBSCRIPT); if (current_vl == null) { current_vl = GlobalsDocDB.ActiveConnection().CreateList(); } current_vl.Append(new_value); _DocNodeRef.Set(current_vl, property_name, VALUE_SUBSCRIPT); current_vl.Close(); }
static void CreateThirdBranch(NodeReference node, Connection myConn) { node.SetSubscript(2, "DXJ342"); node.Set("Some bank 3"); node.SetSubscript(3, 26008962495545); node.Set(126.32); node.SetSubscript(4, 4567098712347654); string slip = "John Smith 1965"; byte[] bytes = System.Text.Encoding.GetEncoding(1251).GetBytes(slip); node.Set(bytes); node.SetSubscript(5, 1); ValueList myList = myConn.CreateList(); myList.Append(0, 29244825509100, "John Smith", 115.54, "Transfer to own account in different bank"); node.Set(myList); myList.Close(); node.SetSubscript(5, 2); myList = myConn.CreateList(); myList.Append(1, 26032009100100, "John Smith", 1015.54, "Transfer to own account in different bank"); node.Set(myList); myList.Close(); Console.WriteLine("Info about third bank is createed"); }
private List <string> GetActualStringList(string property_name) { List <string> working_list = new List <string>(); try { ValueList string_vl = _DocNodeRef.GetList(property_name, VALUE_SUBSCRIPT); for (int loop_ix = 1; loop_ix <= string_vl.Length; loop_ix++) { string loop_str = string_vl.GetNextString(); working_list.Add(loop_str); } string_vl.Close(); return(working_list); } catch { return(null); } }
private void RemoveActualString(string property_name, string value_to_remove) { ValueList current_vl = _DocNodeRef.GetList(property_name, VALUE_SUBSCRIPT); ValueList new_vl = GlobalsDocDB.ActiveConnection().CreateList(); string loop_str = current_vl.GetNextString(); while (loop_str != null) { if (loop_str != value_to_remove) { new_vl.Append(loop_str); } loop_str = current_vl.GetNextString(); } _DocNodeRef.Set(new_vl, property_name, VALUE_SUBSCRIPT); current_vl.Close(); new_vl.Close(); }
static void GetData(NodeReference node) { Object value = node.GetObject(); if (value is string) { if ((node.GetSubscriptCount() == 1) || (node.GetSubscriptCount() == 2)) { Console.WriteLine(value.ToString()); } else if (node.GetSubscriptCount() == 5) { ValueList outList = node.GetList(); outList.ResetToFirst(); for (int i = 0; i < outList.Length - 1; i++) { Console.Write(outList.GetNextObject() + ", "); } Console.WriteLine(outList.GetNextObject()); outList.Close(); } else if (node.GetSubscriptCount() == 4) { string tempString = Encoding.GetEncoding(1251).GetString(node.GetBytes()); Console.WriteLine(tempString); } } else if (value is double) { Console.WriteLine(value.ToString()); } else if (value is int) { Console.WriteLine(value.ToString()); } }