This commit is contained in:
2019-10-08 21:14:47 +00:00
parent aad7577de0
commit 4d468ec240

View File

@@ -2368,40 +2368,7 @@ namespace GZTW.AyaNova.BLL
/*Custom fields*/
mCustom1,mCustom2,mCustom3,mCustom4,mCustom5,mCustom6,mCustom7,mCustom8,mCustom9,mCustom0));
//case 3701 set pm's inactive if client is now inactive
if (this.mActiveChanged && this.mActive == false)
{
//because firebird doesn't support updating through a join statement
//Need to fetch as a list object first then update them all...
//Find all PM's for this client
string pmListCriteria = "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
"<GRIDCRITERIA> \r\n" +
" <COLUMNITEM CM=\"aWorkorderPreventiveMaintenance.aPreventiveMaintenanceNumber\" UI=\"LT_O_WorkorderPreventiveMaintenance\" PIN=\"0\" WIDTH=\"150\" SORT=\"DESC\" /> \r\n" +
" <WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_O_Client\"> \r\n" +
" <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);
}
}
}
}
MarkOld();//db is now synched with object
@@ -2425,6 +2392,42 @@ namespace GZTW.AyaNova.BLL
this.mModified.Date=dtModified;
//case 3701 set pm's inactive if client is now inactive
if (this.mActiveChanged && this.mActive == false)
{
//because firebird doesn't support updating through a join statement
//Need to fetch as a list object first then update them all...
//Find all PM's for this client
string pmListCriteria = "<?xml version=\"1.0\" encoding=\"utf-16\" standalone=\"yes\"?> \r\n" +
"<GRIDCRITERIA> \r\n" +
" <COLUMNITEM CM=\"aWorkorderPreventiveMaintenance.aPreventiveMaintenanceNumber\" UI=\"LT_O_WorkorderPreventiveMaintenance\" PIN=\"0\" WIDTH=\"150\" SORT=\"DESC\" /> \r\n" +
" <WHEREITEMGROUP GROUPLOGICALOPERATOR=\"And\" UI=\"LT_O_Client\"> \r\n" +
" <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);
}
}
}
}
if (AyaBizUtils.AllowAutomaticMRUOnUpdate)
{
AyaBizUtils.MRU.Add(RootObjectTypes.Client, mID);