This commit is contained in:
@@ -2028,6 +2028,8 @@ namespace GZTW.AyaNova.BLL
|
|||||||
}
|
}
|
||||||
return nm;
|
return nm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region DAL Data Access
|
#region DAL Data Access
|
||||||
@@ -2369,15 +2371,36 @@ namespace GZTW.AyaNova.BLL
|
|||||||
//case 3701 set pm's inactive if client is now inactive
|
//case 3701 set pm's inactive if client is now inactive
|
||||||
if (this.mActiveChanged && this.mActive == false)
|
if (this.mActiveChanged && this.mActive == false)
|
||||||
{
|
{
|
||||||
//here set all pm's for this client to inactive
|
//because firebird doesn't support updating through a join statement
|
||||||
DBCommandWrapper cmPM = DBUtil.GetCommandFromSQL(
|
//Need to fetch as a list object first then update them all...
|
||||||
"UPDATE AWORKORDERPREVENTIVEMAINTENANCE set aactive = 0 from AWORKORDERPREVENTIVEMAINTENANCE " +
|
//Find all PM's for this client
|
||||||
"LEFT OUTER JOIN AWORKORDER ON (AWORKORDERPREVENTIVEMAINTENANCE.AWORKORDERID=AWORKORDER.AID) " +
|
string pmListCriteria = "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
|
||||||
"WHERE AWORKORDER.AWORKORDERTYPE='2' AND AWORKORDER.ACLIENTID=@CLIENTID "
|
"<GRIDCRITERIA> \r\n" +
|
||||||
);
|
" <COLUMNITEM CM=\"aWorkorderPreventiveMaintenance.aPreventiveMaintenanceNumber\" UI=\"LT_O_WorkorderPreventiveMaintenance\" PIN=\"0\" WIDTH=\"150\" SORT=\"DESC\" /> \r\n" +
|
||||||
cmPM.AddInParameter("@CLIENTID", DbType.Guid, mID);
|
" <WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_O_Client\"> \r\n" +
|
||||||
DBUtil.DB.ExecuteNonQuery(cmPM, transaction);
|
" <WHEREITEM COMPAREOPERATOR=\"Equals\" CM=\"aClient.aID\" UICOMPAREVALUE=\"ABC Accounting\" TYPE=\"System.Guid\" COMPAREVALUE=\"{" + mID.ToString().ToUpper() + "}\" /> \r\n" +
|
||||||
|
" </WHEREITEMGROUP> \r\n" +
|
||||||
|
"</GRIDCRITERIA> ";
|
||||||
|
|
||||||
|
var wopm = WorkorderPMList.GetList(pmListCriteria);
|
||||||
|
if (wopm.Count > 0)
|
||||||
|
{
|
||||||
|
foreach (WorkorderPMList.WorkorderPMListInfo i in wopm)
|
||||||
|
{
|
||||||
|
if (i.LT_O_WorkorderPreventiveMaintenance.Value != Guid.Empty)
|
||||||
|
{
|
||||||
|
DBCommandWrapper cmPM = DBUtil.GetCommandFromSQL(
|
||||||
|
"UPDATE " +
|
||||||
|
" AWORKORDERPREVENTIVEMAINTENANCE " +
|
||||||
|
" SET " +
|
||||||
|
" AACTIVE=0 " +
|
||||||
|
" WHERE AWORKORDERID=@PMID "
|
||||||
|
);
|
||||||
|
cmPM.AddInParameter("@PMID", DbType.Guid, i.LT_O_WorkorderPreventiveMaintenance.Value);
|
||||||
|
DBUtil.DB.ExecuteNonQuery(cmPM, transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user