/// <summary> /// Get Display ColumnName /// </summary> /// <returns>column name</returns> public String GetDisplayColumnName() { String et = GetElementType(); // Changed By Amit 23-3-2016 //if (ELEMENTTYPE_UserElement1.Equals(et) || ELEMENTTYPE_UserElement2.Equals(et)) if (ELEMENTTYPE_UserElement1.Equals(et) || ELEMENTTYPE_UserElement2.Equals(et) || ELEMENTTYPE_UserElement3.Equals(et) || ELEMENTTYPE_UserElement4.Equals(et) || ELEMENTTYPE_UserElement5.Equals(et) || ELEMENTTYPE_UserElement6.Equals(et) || ELEMENTTYPE_UserElement7.Equals(et) || ELEMENTTYPE_UserElement8.Equals(et) || ELEMENTTYPE_UserElement9.Equals(et)) { if (_ColumnName == null) { _ColumnName = MColumn.GetColumnName(GetCtx(), GetAD_Column_ID()); } return(_ColumnName); } return(GetColumnName(et)); }
/// <summary> /// Before Save /// </summary> /// <param name="newRecord">new</param> /// <returns>true if it can be saved</returns> protected override bool BeforeSave(bool newRecord) { if (GetAD_Org_ID() != 0) { SetAD_Org_ID(0); } String et = GetElementType(); if (IsMandatory() && (ELEMENTTYPE_UserList1.Equals(et) || ELEMENTTYPE_UserList2.Equals(et) || ELEMENTTYPE_UserElement1.Equals(et) || ELEMENTTYPE_UserElement2.Equals(et) || ELEMENTTYPE_UserElement3.Equals(et) || ELEMENTTYPE_UserElement4.Equals(et) || ELEMENTTYPE_UserElement5.Equals(et) || ELEMENTTYPE_UserElement6.Equals(et) || ELEMENTTYPE_UserElement7.Equals(et) || ELEMENTTYPE_UserElement8.Equals(et) || ELEMENTTYPE_UserElement9.Equals(et))) { SetIsMandatory(false); } else if (IsMandatory()) { String errorField = null; if (ELEMENTTYPE_Account.Equals(et) && GetC_ElementValue_ID() == 0) { errorField = "C_ElementValue_ID"; } else if (ELEMENTTYPE_Activity.Equals(et) && GetC_Activity_ID() == 0) { errorField = "C_Activity_ID"; } else if (ELEMENTTYPE_BPartner.Equals(et) && GetC_BPartner_ID() == 0) { errorField = "C_BPartner_ID"; } else if (ELEMENTTYPE_Campaign.Equals(et) && GetC_Campaign_ID() == 0) { errorField = "C_Campaign_ID"; } else if (ELEMENTTYPE_LocationFrom.Equals(et) && GetC_Location_ID() == 0) { errorField = "C_Location_ID"; } else if (ELEMENTTYPE_LocationTo.Equals(et) && GetC_Location_ID() == 0) { errorField = "C_Location_ID"; } else if (ELEMENTTYPE_Organization.Equals(et) && GetOrg_ID() == 0) { errorField = "Org_ID"; } else if (ELEMENTTYPE_OrgTrx.Equals(et) && GetOrg_ID() == 0) { errorField = "Org_ID"; } else if (ELEMENTTYPE_Product.Equals(et) && GetM_Product_ID() == 0) { errorField = "M_Product_ID"; } else if (ELEMENTTYPE_Project.Equals(et) && GetC_Project_ID() == 0) { errorField = "C_Project_ID"; } else if (ELEMENTTYPE_SalesRegion.Equals(et) && GetC_SalesRegion_ID() == 0) { errorField = "C_SalesRegion_ID"; } if (errorField != null) { log.SaveError("Error", Msg.ParseTranslation(GetCtx(), "@IsMandatory@: @" + errorField + "@")); return(false); } } // if (GetAD_Column_ID() == 0 && (ELEMENTTYPE_UserElement1.Equals(et) || ELEMENTTYPE_UserElement2.Equals(et))) { log.SaveError("Error", Msg.ParseTranslation(GetCtx(), "@IsMandatory@: @AD_Column_ID@")); return(false); } return(true); }