case 3759
This commit is contained in:
@@ -88,7 +88,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -141,7 +141,7 @@ namespace GZTW.AyaNova.BLL
|
|||||||
//mViewDS.Clear();
|
//mViewDS.Clear();
|
||||||
//System.IO.StringReader sr = new System.IO.StringReader(mViewXML);
|
//System.IO.StringReader sr = new System.IO.StringReader(mViewXML);
|
||||||
//mViewDS.ReadXml(sr);
|
//mViewDS.ReadXml(sr);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,8 +162,18 @@ namespace GZTW.AyaNova.BLL
|
|||||||
//bugbug - not removing old filters before adding new filter case 770
|
//bugbug - not removing old filters before adding new filter case 770
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (!value.Contains("<WHEREITEMGROUP") || !value.Contains("</WHEREITEMGROUP"))
|
//wait, this could be an issue, below it seems to anticipate this would be a normal condition
|
||||||
new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error value must contain open and closing WHEREITEMGROUP tags");
|
//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 nStart = -1;
|
||||||
int nEnd = -1;
|
int nEnd = -1;
|
||||||
@@ -180,8 +190,17 @@ namespace GZTW.AyaNova.BLL
|
|||||||
nEnd = nEnd + 17;//length of </WHEREITEMGROUP>
|
nEnd = nEnd + 17;//length of </WHEREITEMGROUP>
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nStart==-1 || nEnd==-1)
|
//case 3759
|
||||||
new System.ApplicationException("UIUserGridLastView->SubstituteCriteria: Error could not determine placement of inserted WHEREITEMGROUP tag in view xml:\r\n" + mViewXML);
|
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)
|
//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
|
//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.Control.WndProc(Message& m)
|
||||||
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
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
|
//reset
|
||||||
MarkDirty();
|
MarkDirty();
|
||||||
//flag as unsaved custom filter
|
//flag as unsaved custom filter
|
||||||
FilterID = GridFilter.NoFilterID;
|
FilterID = GridFilter.NoFilterID;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Guid of saved filter that was last being used
|
/// Guid of saved filter that was last being used
|
||||||
/// by the user when they closed AyaNova
|
/// by the user when they closed AyaNova
|
||||||
@@ -284,7 +322,7 @@ Parameter name: length
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the order by portion of the xml
|
/// Returns the order by portion of the xml
|
||||||
/// as a datatable
|
/// as a datatable
|
||||||
@@ -295,10 +333,10 @@ Parameter name: length
|
|||||||
{
|
{
|
||||||
if (ViewDS.Tables.Contains("COLUMNITEM"))
|
if (ViewDS.Tables.Contains("COLUMNITEM"))
|
||||||
return ViewDS.Tables["COLUMNITEM"];
|
return ViewDS.Tables["COLUMNITEM"];
|
||||||
else
|
else
|
||||||
return new DataTable();
|
return new DataTable();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -356,14 +394,14 @@ Parameter name: length
|
|||||||
if (string.IsNullOrEmpty(mViewXML)) return new DataSet();
|
if (string.IsNullOrEmpty(mViewXML)) return new DataSet();
|
||||||
string s = AyaBizUtils.EscapeXml(mViewXML);//case 1724
|
string s = AyaBizUtils.EscapeXml(mViewXML);//case 1724
|
||||||
System.IO.StringReader sr = new System.IO.StringReader(s);
|
System.IO.StringReader sr = new System.IO.StringReader(s);
|
||||||
DataSet ds = new DataSet();
|
DataSet ds = new DataSet();
|
||||||
ds.ReadXml(sr);
|
ds.ReadXml(sr);
|
||||||
return ds;
|
return ds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region System.Object overrides
|
#region System.Object overrides
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
@@ -420,19 +458,19 @@ Parameter name: length
|
|||||||
internal static string ScrubOutContactFieldsFromViewXML(string sxml, string gridkey)
|
internal static string ScrubOutContactFieldsFromViewXML(string sxml, string gridkey)
|
||||||
{
|
{
|
||||||
//short circuit if none of the offending fields are there
|
//short circuit if none of the offending fields are there
|
||||||
if (sxml.IndexOf("aContact",StringComparison.InvariantCultureIgnoreCase) ==-1 &&
|
if (sxml.IndexOf("aContact", StringComparison.InvariantCultureIgnoreCase) == -1 &&
|
||||||
sxml.IndexOf("aContactPhone.",StringComparison.InvariantCultureIgnoreCase)==-1)
|
sxml.IndexOf("aContactPhone.", StringComparison.InvariantCultureIgnoreCase) == -1)
|
||||||
return sxml;
|
return sxml;
|
||||||
|
|
||||||
string sRootObject=gridkey.Replace("List","");
|
string sRootObject = gridkey.Replace("List", "");
|
||||||
bool bUnknownObject=false;
|
bool bUnknownObject = false;
|
||||||
if (sRootObject != "Vendor" && sRootObject != "Client" && sRootObject != "HeadOffice")
|
if (sRootObject != "Vendor" && sRootObject != "Client" && sRootObject != "HeadOffice")
|
||||||
bUnknownObject = true;
|
bUnknownObject = true;
|
||||||
|
|
||||||
|
|
||||||
DataSet ds = new DataSet();
|
DataSet ds = new DataSet();
|
||||||
System.IO.StringReader sr = new System.IO.StringReader(AyaBizUtils.EscapeXml(sxml));
|
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 dtCM = ds.Tables[0];
|
||||||
DataTable dtGroup = new DataTable();
|
DataTable dtGroup = new DataTable();
|
||||||
@@ -444,13 +482,13 @@ Parameter name: length
|
|||||||
if (ds.Tables.Count > 2)
|
if (ds.Tables.Count > 2)
|
||||||
dtWhere = ds.Tables[2];
|
dtWhere = ds.Tables[2];
|
||||||
|
|
||||||
int nCMRowCount=dtCM.Rows.Count;
|
int nCMRowCount = dtCM.Rows.Count;
|
||||||
int nGroupCount = dtGroup.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];
|
DataRow dr = dtCM.Rows[x];
|
||||||
if (dr["CM"].ToString().IndexOf("aContact.aEmailAddress", StringComparison.InvariantCultureIgnoreCase) != -1)
|
if (dr["CM"].ToString().IndexOf("aContact.aEmailAddress", StringComparison.InvariantCultureIgnoreCase) != -1)
|
||||||
@@ -529,7 +567,7 @@ Parameter name: length
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
dr["UI"] = "LT_" + sRootObject + "_Label_Email";
|
dr["UI"] = "LT_" + sRootObject + "_Label_Email";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -550,7 +588,7 @@ Parameter name: length
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{//Sub last name for entire contact field
|
{//Sub last name for entire contact field
|
||||||
|
|
||||||
dr["UI"] = "LT_" + sRootObject + "_Label_Contact";
|
dr["UI"] = "LT_" + sRootObject + "_Label_Contact";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -646,11 +684,11 @@ Parameter name: length
|
|||||||
#endregion Whereitems
|
#endregion Whereitems
|
||||||
|
|
||||||
StringBuilder sbOut = new StringBuilder();
|
StringBuilder sbOut = new StringBuilder();
|
||||||
System.IO.StringWriter sw= new System.IO.StringWriter(sbOut);
|
System.IO.StringWriter sw = new System.IO.StringWriter(sbOut);
|
||||||
ds.WriteXml(sw);
|
ds.WriteXml(sw);
|
||||||
sw.Close();
|
sw.Close();
|
||||||
|
|
||||||
return sbOut.ToString();
|
return sbOut.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -668,7 +706,7 @@ Parameter name: length
|
|||||||
|
|
||||||
//UIUserGridLastView fields
|
//UIUserGridLastView fields
|
||||||
mGridKey = dr.GetString("aGridKey");
|
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
|
//dataset get's filled which is in turn
|
||||||
//consumed by the UI
|
//consumed by the UI
|
||||||
ViewXML = dr.GetString("aViewXML");
|
ViewXML = dr.GetString("aViewXML");
|
||||||
@@ -737,8 +775,8 @@ Parameter name: length
|
|||||||
cm.AddInParameter("@GridKey", DbType.String, mGridKey);
|
cm.AddInParameter("@GridKey", DbType.String, mGridKey);
|
||||||
cm.AddInParameter("@ViewXML", DbType.String, mViewXML);
|
cm.AddInParameter("@ViewXML", DbType.String, mViewXML);
|
||||||
cm.AddInParameter("@FilterID", DbType.Guid, mFilterID);
|
cm.AddInParameter("@FilterID", DbType.Guid, mFilterID);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DBUtil.DB.ExecuteNonQuery(cm, tr);
|
DBUtil.DB.ExecuteNonQuery(cm, tr);
|
||||||
|
|||||||
Reference in New Issue
Block a user