/** * After Save * @param newRecord new * @param success success * @return true */ protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(success); } // Update Products if (!newRecord) { MProduct[] products = MProduct.Get(GetCtx(), "S_Resource_ID IN " + "(SELECT S_Resource_ID FROM S_Resource WHERE S_ResourceType_ID=" + GetS_ResourceType_ID() + ")", Get_TrxName()); for (int i = 0; i < products.Length; i++) { MProduct product = products[i]; if (product.SetResource(this)) { product.Save(Get_TrxName()); } } } return(success); }
/** * After Save * @param newRecord new * @param success success * @return success */ /** * @Modified by Vijayamurugan D * */ protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(success); } if (Convert.ToString(GetVS_CATEGORY()) == "P") { MProduct prod = GetProduct(); if (prod == null) { if (GetValue() == null || GetValue().Length == 0) { SetValue(GetName()); } _product = new MProduct(this, GetResourceType()); return(_product.Save(Get_TrxName())); } else if (prod.SetResource(this)) { prod.Save(Get_TrxName()); } } return(success); }
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); }
/** * beforeSave * @see Model.PO#beforeSave(bool) * @param newRecord * @return true */ protected override bool BeforeSave(bool newRecord) { if (newRecord) { if (GetValue() == null || GetValue().Length == 0) { SetValue(GetName()); } _product = new MProduct(this); return(_product.Save(Get_TrxName())); } 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); }
/** * After Save * @param newRecord new * @param success success * @return success */ protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(success); } MProduct prod = GetProduct(); if (prod.SetExpenseType(this)) { prod.Save(Get_TrxName()); } return(success); }
//*****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); }
/** * After Save * @param newRecord new * @param success success * @return success */ protected override bool AfterSave(bool newRecord, bool success) { if (!success) { return(success); } //added by arpit on Jan 5,2015 Mentis issue no. 0000274 _product = new MProduct(this); _product.SetS_ExpenseType_ID(GetS_ExpenseType_ID()); if (!_product.Save(Get_TrxName())) { } MProduct prod = GetProduct(); if (prod.SetExpenseType(this)) { prod.Save(Get_TrxName()); } return(success); }
/** * Before Save * @param newRecord new * @return true if it can be saved */ /** * @ Modified by Vijayamurugan D * Modified for has not to update the product table * while creating the new resource * NOTE: The RESOURCE CATEGORY field should be 'Profile' if it's product it will update on * product window. */ protected override bool BeforeSave(bool newRecord) { string sql = "select count(*) from s_resource where ad_user_ID = " + GetAD_User_ID() + " and isactive = 'Y' and s_resource_ID <> " + GetS_Resource_ID(); int count = Util.GetValueOfInt(DB.ExecuteScalar(sql, null, Get_TrxName())); if (count > 0) { // ShowMessage.Info("UserAlreadyAssignedToResource", true, null, null); return(false); } if (newRecord && Convert.ToString(GetVS_CATEGORY()) == "P") { /**inserted new field as Resource category(VS_Category)on the resource table*/ if (GetValue() == null || GetValue().Length == 0) { SetValue(GetName()); } _product = new MProduct(this, GetResourceType()); return(_product.Save(Get_TrxName())); } return(true); }