예제 #1
0
 private void ChangeKeyLogic()
 {
     if (!string.IsNullOrEmpty(SelectedAddress.AddressID))
     {//check to see if key is part of the current companylist...
         Address query = AddressList.Where(company => company.AddressID == SelectedAddress.AddressID &&
                                           company.AutoID != SelectedAddress.AutoID).FirstOrDefault();
         if (query != null)
         {//revert it back
             SelectedAddress.AddressID = SelectedAddressMirror.AddressID;
             //change to the newly selected company...
             SelectedAddress = query;
             return;
         }
         //it is not part of the existing list try to fetch it from the db...
         AddressList = GetAddressByID(SelectedAddress.AddressID, XERP.Client.ClientSessionSingleton.Instance.CompanyID);
         if (AddressList.Count == 0)//it was not found do new record required logic...
         {
             NotifyNewRecordNeeded("Record " + SelectedAddress.AddressID + " Does Not Exist.  Create A New Record?");
         }
         else
         {
             SelectedAddress = AddressList.FirstOrDefault();
         }
     }
     else
     {
         string errorMessage = "ID Is Required.";
         NotifyMessage(errorMessage);
         //revert back to the value it was before it was changed...
         if (SelectedAddress.AddressID != SelectedAddressMirror.AddressID)
         {
             SelectedAddress.AddressID = SelectedAddressMirror.AddressID;
         }
     }
 }
예제 #2
0
        // Адрес в строку
        public string GetAddressToString(int id)
        {
            var    adr  = AddressList.FirstOrDefault(m => m.AddressID == id);
            string addr = adr.Country + ", " + adr.Locality + ", " + adr.Street + ", " + adr.House + "/ " + adr.Apartment;

            return(addr);
        }
예제 #3
0
 private void OnSearchResult(object sender, NotificationEventArgs <BindingList <Address> > e)
 {
     if (e.Data != null && e.Data.Count > 0)
     {
         AddressList     = e.Data;
         SelectedAddress = AddressList.FirstOrDefault();
         Dirty           = false;
         AllowCommit     = false;
     }
     UnregisterToReceiveMessages <BindingList <Address> >(MessageTokens.AddressSearchToken.ToString(), OnSearchResult);
 }
예제 #4
0
        public string GetAddress(Guid departmentId)
        {
            if (!AddressList.HasValue())
            {
                return(null);
            }

            var address = AddressList.FirstOrDefault(i => i.HousingDepartmentId == departmentId)?.Address;

            return(address);
        }
예제 #5
0
        public void ChangeAddress(Guid housingDepartmentId, string address)
        {
            var addressItem = AddressList.FirstOrDefault(x => x.HousingDepartmentId == housingDepartmentId);

            if (addressItem == null)
            {
                addressItem = new JobAddress
                {
                    HousingDepartmentId = housingDepartmentId,
                    Address             = address
                };

                AddressList.Add(addressItem);
            }
            else
            {
                addressItem.Address = address;
            }

            RaiseEvent(new JobAddressChanged {
                AddressList = AddressList
            });
        }