//*****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); }
//*****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); }
/// <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); }