Ejemplo n.º 1
0
        private void GetFromKRS()
        {
            Messenger.Default.Register<KRSsendBack>(this, (message) =>
            {
                if (message.id == 1)
                {
                    foreach (var item in message.krsitem.Members)
                    {
                        var cc = new CustomerContact();
                        cc.FirstName = item.FirstName;
                        cc.LastName = item.LastName;
                        cc.WorkPlace = item.Position;
                        this.CustomerContactList.Add(cc);
                    }

                    foreach (var item in message.krsitem.CompanyInfo)
                    {
                        switch (item.Key)
                        {
                            case "Nazwa":
                                this.CustomerFullName = item.Value;
                                break;
                            case "Numer KRS":
                                int xKRS = 0;
                                if (Int32.TryParse(item.Value, out xKRS))
                                {
                                    this.Krs = xKRS;
                                }
                                break;
                            case "NIP":
                                int xNIP = 0;
                                if (Int32.TryParse(item.Value, out xNIP))
                                {
                                    this.Nip = xNIP;
                                }
                                break;
                            case "REGON":
                                int xREGON = 0;
                                if (Int32.TryParse(item.Value, out xREGON))
                                {
                                    this.Regon = xREGON;
                                }
                                break;
                            case "Miejscowość":
                                this.City = item.Value;
                                break;
                            case "Adres":
                                this.Street = item.Value;
                                break;
                            case "Kod pocztowy":
                                this.PostalCode = item.Value;
                                break;
                            case "Adres WWW":
                                this.WebAddress = item.Value;
                                break;
                            case "Województwo":
                                var x = db.State.SingleOrDefault(itemx => itemx.Name.ToUpper() == item.Value.ToUpper());
                                if(x != null)
                                {
                                    this.State = x;
                                }
                                break;

                            default:
                                break;
                        }
                    }
                }
            });

            InfoFromKrsView v = new InfoFromKrsView();
            v.DataContext = new InfoFromKrsViewModel(this.Krs.ToString().PadLeft(10,'0'));
            v.ShowDialog();
        }
Ejemplo n.º 2
0
 private void AddCustomerContact()
 {
     var cc = new CustomerContact();
     cc.FirstName = " ";
     this.CustomerContactList.Add(cc);
     this.SelectedCustomer = cc;
 }