Beispiel #1
0
        protected void AddAssociations()
        {
            LookupCodeDa da          = new LookupCodeDa();
            string       parentLkpId = Request.Form[ParentLookupId];
            string       keyList     = Request.Form[ChildLookupCodeIdList];

            if (!string.IsNullOrEmpty(parentLkpId) && !string.IsNullOrEmpty(keyList))
            {
                int      parentKey = int.Parse(parentLkpId);
                string[] childKeys = keyList.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                da.InsertChildCodes(parentKey, childKeys);
            }
            GetCodesByParentIdAndChildFieldName();
        }
Beispiel #2
0
 /// <summary>
 /// Update the lookup relationships. Keys will be added to respecitve lists to have 1 udpate
 /// for inserition and 1 for deltion of relationships
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void SaveRelationships(object sender, EventArgs e)
 {
     foreach (int parLkpId in codesToInsert.Keys)
     {
         string[] childLkpIds = codesToInsert[parLkpId].ToArray();
         da.InsertChildCodes(parLkpId, childLkpIds);
     }
     foreach (int parLkpId in codesToRemove.Keys)
     {
         string[] childLkpIds = codesToRemove[parLkpId].ToArray();
         da.RemoveChildCodes(parLkpId, childLkpIds);
     }
     codesToInsert.Clear();
     codesToRemove.Clear();
 }