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