示例#1
0
        public OrderViewModel(domain.Order order, domain.Recipient recipient, OrderService orderService)
        {
            this.order = order;
            this.order.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(OnOrder_PropertyChanged);
            this.orderService = orderService;

            this.recipient = recipient;
        }
        private void OnParseRawTextRecipientFinished(ParseRawTextRecipientFinishedPayload payload)
        {
            foreach (var item in payload.CnRecipientInfoList)
            {
                bool isDuplicateName = this.recipientList.Any(x => x.Name == item.Name);


                domain.Recipient newObject = new domain.Recipient();
                newObject.ID = -1;
                newObject.Name = item.Name +( isDuplicateName ? "[有重复]" :string.Empty);
                newObject.CnAddress = item.Address;
                newObject.MainTel = item.TelList.FirstOrDefault();
                newObject.OtherTels = string.Join(",", item.TelList.Skip(1));
                newObject.PostCode = item.PostCode;
                newObject.ProviceCity = item.ProviceCity;
                var newVm = new RecipientItemViewModel(newObject);
                this.recipientList.Add(newVm);
                this.SelectedItem = newVm;
            }
        }