case 3759

This commit is contained in:
2020-05-08 20:40:49 +00:00
parent 85b0379175
commit 4f6f383cef

View File

@@ -88,7 +88,7 @@ namespace GZTW.AyaNova.BLL
}
}
/// <summary>
///
@@ -141,7 +141,7 @@ namespace GZTW.AyaNova.BLL
//mViewDS.Clear();
//System.IO.StringReader sr = new System.IO.StringReader(mViewXML);
//mViewDS.ReadXml(sr);
}
}
}
@@ -162,8 +162,18 @@ namespace GZTW.AyaNova.BLL
//bugbug - not removing old filters before adding new filter case 770
set
{
if (!value.Contains("<WHEREITEMGROUP") || !value.Contains("</WHEREITEMGROUP"))
new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error value must contain open and closing WHEREITEMGROUP tags");
//wait, this could be an issue, below it seems to anticipate this would be a normal condition
//I'm going to leave this out for now, prior attempt didn't actually "throw" it so it would have been benign
//if (!value.Contains("<WHEREITEMGROUP") || !value.Contains("</WHEREITEMGROUP"))
// throw new System.ApplicationException(
// "UIUserGridLastView->SubstituteCriteria: Error unexpected view xml (missing WHEREITEMGROUP tags)\r\n" +
// "ViewXML:\r\n"+
// mViewXML+
// "Substitute XML:\r\n"+
// value +
// "\r\nGridKey:"+this.GridKey + ", UserId: " + this.UserID +
// "\r\n---------eot-----"
// );//case 3759
int nStart = -1;
int nEnd = -1;
@@ -180,8 +190,17 @@ namespace GZTW.AyaNova.BLL
nEnd = nEnd + 17;//length of </WHEREITEMGROUP>
}
if (nStart==-1 || nEnd==-1)
new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error could not determine placement of inserted WHEREITEMGROUP tag in view xml:\r\n" + mViewXML);
//case 3759
if (nStart == -1 || nEnd == -1)
// throw new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error could not determine placement of inserted WHEREITEMGROUP tag in view xml:\r\n" + mViewXML);
throw new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error unexpected view xml\r\n" +
"ViewXML:\r\n" +
mViewXML +
"Substitute XML:\r\n" +
value +
"\r\nGridKey:" + this.GridKey + ", UserId: " + this.UserID +
"\r\n---------eot-----"
);
//BUGBUG: this line is throwing an exception for some users (adam tecnica uk)
//It needs to be wrapped in a try catch block or tested for sanity
@@ -246,19 +265,38 @@ Parameter name: length
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
*/
mViewXML = mViewXML.Substring(0, nStart) + value + mViewXML.Substring(nEnd, mViewXML.Length-nEnd);
//case 3759 for above
int StartViewXMLLength = nStart;
int EndViewXMLLength = mViewXML.Length - nEnd;
if (StartViewXMLLength < 0 || EndViewXMLLength < 0)
throw new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error bad view xml\r\n" +
"ViewXML:\r\n" +
mViewXML +
"Substitute XML:\r\n" +
value +
"\r\n=-=-=-=-=-+\r\nStartViewXMLLength:" + StartViewXMLLength.ToString() +
", EndViewXMLLength:" + EndViewXMLLength.ToString() +
"\r\nGridKey:" + this.GridKey + ", UserId: " + this.UserID +
"\r\n---------eot-----"
);
//originally before this case
//mViewXML = mViewXML.Substring(0, nStart) + value + mViewXML.Substring(nEnd, mViewXML.Length-nEnd);
mViewXML = mViewXML.Substring(0, StartViewXMLLength) + value + mViewXML.Substring(nEnd, EndViewXMLLength);
//reset
MarkDirty();
//flag as unsaved custom filter
FilterID = GridFilter.NoFilterID;
}
}
/// <summary>
/// Guid of saved filter that was last being used
/// by the user when they closed AyaNova
@@ -284,7 +322,7 @@ Parameter name: length
}
/// <summary>
/// Returns the order by portion of the xml
/// as a datatable
@@ -295,10 +333,10 @@ Parameter name: length
{
if (ViewDS.Tables.Contains("COLUMNITEM"))
return ViewDS.Tables["COLUMNITEM"];
else
else
return new DataTable();
}
}
@@ -356,14 +394,14 @@ Parameter name: length
if (string.IsNullOrEmpty(mViewXML)) return new DataSet();
string s = AyaBizUtils.EscapeXml(mViewXML);//case 1724
System.IO.StringReader sr = new System.IO.StringReader(s);
DataSet ds = new DataSet();
DataSet ds = new DataSet();
ds.ReadXml(sr);
return ds;
}
}
#endregion
#region System.Object overrides
public override string ToString()
@@ -420,19 +458,19 @@ Parameter name: length
internal static string ScrubOutContactFieldsFromViewXML(string sxml, string gridkey)
{
//short circuit if none of the offending fields are there
if (sxml.IndexOf("aContact",StringComparison.InvariantCultureIgnoreCase) ==-1 &&
sxml.IndexOf("aContactPhone.",StringComparison.InvariantCultureIgnoreCase)==-1)
if (sxml.IndexOf("aContact", StringComparison.InvariantCultureIgnoreCase) == -1 &&
sxml.IndexOf("aContactPhone.", StringComparison.InvariantCultureIgnoreCase) == -1)
return sxml;
string sRootObject=gridkey.Replace("List","");
bool bUnknownObject=false;
string sRootObject = gridkey.Replace("List", "");
bool bUnknownObject = false;
if (sRootObject != "Vendor" && sRootObject != "Client" && sRootObject != "HeadOffice")
bUnknownObject = true;
DataSet ds = new DataSet();
System.IO.StringReader sr = new System.IO.StringReader(AyaBizUtils.EscapeXml(sxml));
ds.ReadXml(sr,XmlReadMode.InferSchema);
ds.ReadXml(sr, XmlReadMode.InferSchema);
DataTable dtCM = ds.Tables[0];
DataTable dtGroup = new DataTable();
@@ -444,13 +482,13 @@ Parameter name: length
if (ds.Tables.Count > 2)
dtWhere = ds.Tables[2];
int nCMRowCount=dtCM.Rows.Count;
int nCMRowCount = dtCM.Rows.Count;
int nGroupCount = dtGroup.Rows.Count;
#region ColumnItems
for (int x = 0; x<nCMRowCount;x++)
#region ColumnItems
for (int x = 0; x < nCMRowCount; x++)
{
DataRow dr = dtCM.Rows[x];
if (dr["CM"].ToString().IndexOf("aContact.aEmailAddress", StringComparison.InvariantCultureIgnoreCase) != -1)
@@ -529,7 +567,7 @@ Parameter name: length
}
else
{
dr["UI"] = "LT_" + sRootObject + "_Label_Email";
}
}
@@ -550,7 +588,7 @@ Parameter name: length
}
else
{//Sub last name for entire contact field
dr["UI"] = "LT_" + sRootObject + "_Label_Contact";
}
}
@@ -646,11 +684,11 @@ Parameter name: length
#endregion Whereitems
StringBuilder sbOut = new StringBuilder();
System.IO.StringWriter sw= new System.IO.StringWriter(sbOut);
ds.WriteXml(sw);
sw.Close();
System.IO.StringWriter sw = new System.IO.StringWriter(sbOut);
ds.WriteXml(sw);
sw.Close();
return sbOut.ToString();
return sbOut.ToString();
}
#endregion
@@ -668,7 +706,7 @@ Parameter name: length
//UIUserGridLastView fields
mGridKey = dr.GetString("aGridKey");
//Important: use the property so that the
//Important: use the property so that the
//dataset get's filled which is in turn
//consumed by the UI
ViewXML = dr.GetString("aViewXML");
@@ -737,8 +775,8 @@ Parameter name: length
cm.AddInParameter("@GridKey", DbType.String, mGridKey);
cm.AddInParameter("@ViewXML", DbType.String, mViewXML);
cm.AddInParameter("@FilterID", DbType.Guid, mFilterID);
DBUtil.DB.ExecuteNonQuery(cm, tr);