protected override bool AfterDelete(bool success) { // when we delete BOM, then set IsVerified False on Product MProduct product = new MProduct(GetCtx(), GetM_Product_ID(), Get_Trx()); product.SetIsVerified(false); if (!product.Save()) { log.SaveError("Error", "Verified not updated on Product : " + product.GetValue()); } return(true); }
//*****Manfacturing /// <summary> /// After Delete /// </summary> /// <param name="success">success</param> /// <returns>true</returns> /// <writer>raghu</writer> /// <date>08-march-2011</date> protected override Boolean AfterDelete(Boolean success) { MBOMProduct[] lines = MBOMProduct.GetBOMLines(GetBOM()); if (lines == null || 0 == lines.Length || (1 == lines.Length && lines[0].GetM_BOMProduct_ID() == GetM_BOMProduct_ID())) { MProduct product = MProduct.Get(GetCtx(), _bom.GetM_Product_ID()); product.SetIsVerified(false); if (!product.Save(Get_Trx())) { return(false); } } return(true); }
} // beforeSave protected override bool AfterSave(bool newRecord, bool success) { //set verified on Product as False when we change BOMType AND BOMUse if (newRecord || Is_ValueChanged("BOMType") || Is_ValueChanged("BOMUse") || Is_ValueChanged("IsActive") || Is_ValueChanged("M_AttributeSetInstance_ID")) { MProduct product = new MProduct(GetCtx(), GetM_Product_ID(), Get_Trx()); product.SetIsVerified(false); if (!product.Save()) { log.SaveError("Error", "Verified not updated on Product : " + product.GetValue()); } } return(true); }
//*****Manfacturing /// <summary> /// After Delete /// </summary> /// <param name="success">success</param> /// <returns>true</returns> /// <writer>raghu</writer> /// <date>08-march-2011</date> protected override Boolean AfterDelete(Boolean success) { //MBOMProduct[] lines = MBOMProduct.GetBOMLines(GetBOM()); //if (lines == null || 0 == lines.Length || (1 == lines.Length && lines[0].GetM_BOMProduct_ID() == GetM_BOMProduct_ID())) //{ // when we delete any record, then make isverfied as false on product MBOM _bom = new MBOM(GetCtx(), GetM_BOM_ID(), Get_Trx()); MProduct product = MProduct.Get(GetCtx(), _bom.GetM_Product_ID()); product.SetIsVerified(false); if (!product.Save(Get_Trx())) { return(false); } //} return(true); }
/** * After Save * @param newRecord new * @param success success * @return success */ protected override bool AfterSave(bool newRecord, bool success) { // Product Line was changed if (newRecord || Is_ValueChanged("M_ProductBOM_ID")) { // Invalidate BOM MProduct product = new MProduct(GetCtx(), GetM_Product_ID(), Get_TrxName()); if (Get_TrxName() != null) { product.Load(Get_TrxName()); } if (product.IsVerified()) { product.SetIsVerified(false); product.Save(Get_TrxName()); } // Invalidate Products where BOM is used } return(success); }
/// <summary> /// After Save /// </summary> /// <param name="newRecord"></param> /// <param name="success"></param> /// <returns>success</returns> /// <writer>raghu</writer> /// <date>08-march-2011</date> protected override Boolean AfterSave(Boolean newRecord, Boolean success) { // BOM Component Line was changed if (newRecord || Is_ValueChanged("M_ProductBOM_ID") || Is_ValueChanged("M_ProductBOMVersion_ID") || Is_ValueChanged("IsActive")) { MBOM mbom = new MBOM(GetCtx(), GetM_BOM_ID(), Get_Trx()); // Invalidate BOM MProduct product = new MProduct(GetCtx(), mbom.GetM_Product_ID(), Get_Trx()); if (Get_Trx() != null) { product.Load(Get_Trx()); } if (product.IsVerified()) { product.SetIsVerified(false); product.Save(Get_Trx()); } // Invalidate Products where BOM is used } return(success); }