/// <summary> /// Get Location from Cache /// </summary> /// <param name="ctx">context</param> /// <param name="C_Location_ID">id</param> /// <param name="trxName">transaction</param> /// <returns>MLocation</returns> public static MLocation Get(Ctx ctx, int C_Location_ID, Trx trxName) { // New if (C_Location_ID == 0) { return(new MLocation(ctx, C_Location_ID, trxName)); } // int key = (int)C_Location_ID; MLocation retValue = (MLocation)s_cache[key]; if (retValue != null) { return(retValue); } retValue = new MLocation(ctx, C_Location_ID, trxName); if (retValue.Get_ID() != 0) // found { s_cache.Add(key, retValue); return(retValue); } return(null); // not found }
/** * Make name Unique * @param address address */ private void MakeUnique(MLocation address) { // _uniqueName = address.toString(); // return; if (_uniqueName.Length == 0) { _uniqueName.Clear(); } _unique++; // 0 + Address1 // to set address1 if (_uniqueName.Length == 0) { String xx = address.GetAddress1(); if (xx != null && xx.Length > 0) { _uniqueName.Append(xx); } // Set address2, address3 and address4 in case of VA077 if (VAdvantage.Utility.Env.IsModuleInstalled("VA077_")) { xx = address.GetAddress2(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } xx = address.GetAddress3(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } xx = address.GetAddress4(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } } _unique = 0; } // 0 - City // to set address1 and City as Name if (_unique == 0 && _uniqueName.Length >= 0) { String xx = address.GetCity(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } // Copy region, postal code country name in case of VA077 if (VAdvantage.Utility.Env.IsModuleInstalled("VA077_")) { xx = address.GetRegionName(true); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } xx = address.GetPostal(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } xx = address.GetCountryName(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } } _unique = 0; } // 1 + Address1 if (_unique == 1 || _uniqueName.Length == 0) { String xx = address.GetAddress1(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } _unique = 1; } // 2 + Address2 if (_unique == 2 || _uniqueName.Length == 0) { String xx = address.GetAddress2(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } _unique = 2; } // 3 - Region if (_unique == 3 || _uniqueName.Length == 0) { String xx = address.GetRegionName(true); { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } _unique = 3; } // 5 - Country if (_unique == 5 || _uniqueName.Length == 0) { String xx = address.GetCountryName(); { if (_uniqueName.Length > 0) { _uniqueName.Append(" "); } _uniqueName.Append(xx); } _unique = 5; } // 4 - ID if (_unique == 4 || _uniqueName.Length == 0) { int id = Get_ID(); if (id == 0) { id = address.Get_ID(); } _uniqueName.Append("#" + id); _unique = 4; } }
/** * Make name Unique * @param address address */ private void MakeUnique(MLocation address) { // _uniqueName = address.toString(); // return; if (_uniqueName == null) { _uniqueName = ""; } _unique++; // 0 + Address1 // to set address1 if (_uniqueName.Length == 0) { String xx = address.GetAddress1(); if (xx != null && xx.Length > 0) { _uniqueName = xx; } _unique = 0; } // 0 - City // to set address1 and City as Name if (_unique == 0 && _uniqueName.Length >= 0) { String xx = address.GetCity(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName += " "; } _uniqueName += xx; } _unique = 0; } // 1 + Address1 if (_unique == 1 || _uniqueName.Length == 0) { String xx = address.GetAddress1(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName += " "; } _uniqueName += xx; } _unique = 1; } // 2 + Address2 if (_unique == 2 || _uniqueName.Length == 0) { String xx = address.GetAddress2(); if (xx != null && xx.Length > 0) { if (_uniqueName.Length > 0) { _uniqueName += " "; } _uniqueName += xx; } _unique = 2; } // 3 - Region if (_unique == 3 || _uniqueName.Length == 0) { String xx = address.GetRegionName(true); { if (_uniqueName.Length > 0) { _uniqueName += " "; } _uniqueName += xx; } _unique = 3; } // 5 - Country if (_unique == 5 || _uniqueName.Length == 0) { String xx = address.GetCountryName(); { if (_uniqueName.Length > 0) { _uniqueName += " "; } _uniqueName += xx; } _unique = 5; } // 4 - ID if (_unique == 4 || _uniqueName.Length == 0) { int id = Get_ID(); if (id == 0) { id = address.Get_ID(); } _uniqueName += "#" + id; _unique = 4; } }