Пример #1
0
        private void OnSearchResult(object sender, NotificationEventArgs <BindingList <UdList> > e)
        {
            if (e.Data != null && e.Data.Count > 0)
            {
                UdListList     = e.Data;
                SelectedUdList = UdListList.FirstOrDefault();
                if (SelectedUdList.UdListItems.Count > 0)
                {
                    SelectedUdListItem = SelectedUdList.UdListItems[0];
                }

                Dirty       = false;
                AllowCommit = false;
            }
            UnregisterToReceiveMessages <BindingList <UdList> >(MessageTokens.UdListSearchToken.ToString(), OnSearchResult);
        }
Пример #2
0
 private void ChangeKeyLogic()
 {
     if (!string.IsNullOrEmpty(SelectedUdList.UdListID))
     {
         //check to see if key is part of the current udListlist...
         UdList query = UdListList.Where(udList => udList.UdListID == SelectedUdList.UdListID &&
                                         udList.AutoID != SelectedUdList.AutoID).FirstOrDefault();
         if (query != null)
         {//change to the newly selected udList...
             //before navigating to the newly selected client cached record revert the old one back to what it was...
             SelectedUdList.UdListID = SelectedUdListMirror.UdListID;
             SelectedUdList          = query;
             return;
         }
         //it is not part of the existing list try to fetch it from the db...
         UdListList = GetUdListByID(SelectedUdList.UdListID, ClientSessionSingleton.Instance.CompanyID);
         if (UdListList.Count == 0)
         {//it was not found do new record required logic...
             NotifyNewRecordNeeded("Record " + SelectedUdList.UdListID + " Does Not Exist.  Create A New Record?");
         }
         else
         {
             SelectedUdList = UdListList.FirstOrDefault();
         }
     }
     else
     {
         string errorMessage = "ID Is Required.";
         NotifyMessage(errorMessage);
         //revert back to the value it was before it was changed...
         if (SelectedUdList.UdListID != SelectedUdListMirror.UdListID)
         {
             SelectedUdList.UdListID = SelectedUdListMirror.UdListID;
         }
     }
 }