C2024-027 RO Editor – Add additional feature to allow Cut/Paste (Moving) a RO within the same table.
This commit is contained in:
@@ -336,7 +336,7 @@ namespace RODBInterface
|
||||
public abstract bool RODB_GetChildData(VlnXmlElement node, bool CheckChildCount);
|
||||
public abstract bool IsDuplicateAccPageID(VlnXmlElement ro, string newacc);
|
||||
public abstract VlnXmlElement RODB_ReadRO(string tbl, string recid);
|
||||
public abstract bool RODB_WriteRO(VlnXmlElement ro);
|
||||
public abstract bool RODB_WriteRO(VlnXmlElement ro, bool movedRO = false);
|
||||
public abstract bool RODB_InsertRO(VlnXmlElement ro);
|
||||
public abstract ushort RODB_GetFieldType(VlnXmlElement elem, string TableName, string Fld);
|
||||
public abstract ArrayList RODB_GetFields(VlnXmlElement elem, uint rtype, bool refresh = false);
|
||||
@@ -2120,7 +2120,7 @@ namespace RODBInterface
|
||||
return retele;
|
||||
}
|
||||
|
||||
public override bool RODB_WriteRO(VlnXmlElement ro)
|
||||
public override bool RODB_WriteRO(VlnXmlElement ro, bool movedRO = false)
|
||||
{
|
||||
bool success;
|
||||
if (ro.Name == "vlnGroup")
|
||||
@@ -2140,6 +2140,13 @@ namespace RODBInterface
|
||||
string dt = string.Format("{0:yyyyMMddHHmmss}", System.DateTime.Now);
|
||||
string xmlstr = GenerateXmlString(ro, false);
|
||||
string strUpdate = "UPDATE " + ro.GetAttribute("Table") + " SET Info = '" + xmlstr + "'";
|
||||
if (movedRO)
|
||||
{
|
||||
VlnXmlElement parent = (VlnXmlElement)ro.ParentNode;
|
||||
ro.SetAttribute("ParentID", parent.GetAttribute("RecID"));
|
||||
strUpdate += ", ParentID = '" + ro.GetAttribute("ParentID") + "'";
|
||||
}
|
||||
|
||||
strUpdate = strUpdate + ", ModDateTime = '" + dt + "', AccPageID = '" + wraccid + "' WHERE RecID='" + ro.GetAttribute("RecID") + "'";
|
||||
try
|
||||
{
|
||||
@@ -2192,6 +2199,8 @@ namespace RODBInterface
|
||||
ro.SetAttribute("HasChild", "False");
|
||||
if (ro.HasAttribute("AccPageID"))
|
||||
{
|
||||
// Code is never reached, but this was noticed - this next line should likely be:
|
||||
// strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, AccPageID, ModDateTime, Info ) ";
|
||||
strInsert = "INSERT INTO " + parent.GetAttribute("Table") + "( RecID, RecType, ParentID, ModDateTime, AccPageID, Info ) ";
|
||||
strInsert = strInsert + " VALUES ('" + ro.GetAttribute("RecID") + "'," + (uint)RecordType.Group + ",'" + ro.GetAttribute("ParentID");
|
||||
strInsert = strInsert + "','" + wraccid + "','" + dt + "','" + xmlstr + "');";
|
||||
@@ -2396,7 +2405,7 @@ namespace RODBInterface
|
||||
Info = null;
|
||||
DBE.ReaderClose();
|
||||
DBE.CommandDispose();
|
||||
return Info.Replace("'", "\'");
|
||||
return Info?.Replace("'", "\'");
|
||||
}
|
||||
|
||||
public override bool RODB_NewSchemaPiece(string recid, string parentid, string table, string schpiece, uint rtype)
|
||||
|
@@ -1557,7 +1557,7 @@ namespace RODBInterface
|
||||
}
|
||||
return retele;
|
||||
}
|
||||
public override bool RODB_WriteRO(VlnXmlElement ro)
|
||||
public override bool RODB_WriteRO(VlnXmlElement ro, bool movedRO = false)
|
||||
{
|
||||
bool success;
|
||||
if (ro.Name == "vlnGroup")
|
||||
@@ -1589,6 +1589,13 @@ namespace RODBInterface
|
||||
command.Parameters.AddWithValue("@ModDateTime", dt);
|
||||
command.Parameters.AddWithValue("@AccPageID", wraccid); // B2020-003: set accpageid to correct value
|
||||
command.Parameters.AddWithValue("@RecID", ro.GetAttribute("RecID"));
|
||||
if (movedRO)
|
||||
{
|
||||
VlnXmlElement parent = (VlnXmlElement)ro.ParentNode;
|
||||
ro.SetAttribute("ParentID", parent.GetAttribute("RecID"));
|
||||
command.Parameters.AddWithValue("@ParentID", ro.GetAttribute("ParentID"));
|
||||
}
|
||||
|
||||
using (SqlDataReader reader = command.ExecuteReader())
|
||||
{
|
||||
success = true;
|
||||
|
Reference in New Issue
Block a user