예제 #1
0
 private void ChangeKeyLogic()
 {
     if (!string.IsNullOrEmpty(SelectedWarehouseLocation.WarehouseLocationID))
     {//check to see if key is part of the current companylist...
         WarehouseLocation query = WarehouseLocationList.Where(company => company.WarehouseLocationID == SelectedWarehouseLocation.WarehouseLocationID &&
                                                               company.AutoID != SelectedWarehouseLocation.AutoID).FirstOrDefault();
         if (query != null)
         {//revert it back
             SelectedWarehouseLocation.WarehouseLocationID = SelectedWarehouseLocationMirror.WarehouseLocationID;
             //change to the newly selected company...
             SelectedWarehouseLocation = query;
             return;
         }
         //it is not part of the existing list try to fetch it from the db...
         WarehouseLocationList = GetWarehouseLocationByID(SelectedWarehouseLocation.WarehouseLocationID, XERP.Client.ClientSessionSingleton.Instance.CompanyID);
         if (WarehouseLocationList.Count == 0)//it was not found do new record required logic...
         {
             NotifyNewRecordNeeded("Record " + SelectedWarehouseLocation.WarehouseLocationID + " Does Not Exist.  Create A New Record?");
         }
         else
         {
             SelectedWarehouseLocation = WarehouseLocationList.FirstOrDefault();
         }
     }
     else
     {
         string errorMessage = "ID Is Required.";
         NotifyMessage(errorMessage);
         //revert back to the value it was before it was changed...
         if (SelectedWarehouseLocation.WarehouseLocationID != SelectedWarehouseLocationMirror.WarehouseLocationID)
         {
             SelectedWarehouseLocation.WarehouseLocationID = SelectedWarehouseLocationMirror.WarehouseLocationID;
         }
     }
 }
예제 #2
0
 private void OnSearchResult(object sender, NotificationEventArgs <BindingList <WarehouseLocation> > e)
 {
     if (e.Data != null && e.Data.Count > 0)
     {
         WarehouseLocationList     = e.Data;
         SelectedWarehouseLocation = WarehouseLocationList.FirstOrDefault();
         Dirty       = false;
         AllowCommit = false;
     }
     UnregisterToReceiveMessages <BindingList <WarehouseLocation> >(MessageTokens.WarehouseLocationSearchToken.ToString(), OnSearchResult);
 }