Example #1
0
        public void UnpackFirmen(XmlElement root)
        {
            foreach (XmlNode element in root.ChildNodes)
            {
                Models.Firma firma = new Models.Firma();

                foreach (XmlNode item in element.ChildNodes)
                {
                    if (item.Name == "ID")
                    {
                        firma.ID = item.InnerText;
                    }
                    if (item.Name == "Name")
                    {
                        firma.Name = item.InnerText;
                    }
                    if (item.Name == "UID")
                    {
                        firma.UID = item.InnerText;
                    }
                    if (item.Name == "Adresse")
                    {
                        firma.Adresse = item.InnerText;
                    }
                    if (item.Name == "Ort")
                    {
                        firma.Ort = item.InnerText;
                    }
                    if (item.Name == "PLZ")
                    {
                        firma.PLZ = item.InnerText;
                    }
                    if (item.Name == "RechnungsAdresse")
                    {
                        firma.RechnungsAdresse = item.InnerText;
                    }
                    if (item.Name == "RechnungsOrt")
                    {
                        firma.RechnungsOrt = item.InnerText;
                    }
                    if (item.Name == "RechnungsPLZ")
                    {
                        firma.RechnungsPLZ = item.InnerText;
                    }
                    if (item.Name == "LieferAdresse")
                    {
                        firma.LieferAdresse = item.InnerText;
                    }
                    if (item.Name == "LieferOrt")
                    {
                        firma.LieferOrt = item.InnerText;
                    }
                    if (item.Name == "LieferPLZ")
                    {
                        firma.LieferPLZ = item.InnerText;
                    }
                }
                Firmen.Add(firma);
            }
        }
Example #2
0
        public DetailedInformationWindowViewModel(Models.Kontakt param)
        {
            Color = Brushes.LightGreen;
            RaisePropertyChanged("Color");

            Firmen = new List <Models.Firma>();
            GetFirmen();
            amountFirmen = 0;

            //ParamFirma = new Models.Firma();
            //ParamPerson = new Models.Person();

            Firma  = new Models.Firma();
            Person = new Models.Person();

            if (param is Models.Firma)
            {
                //ParamFirma = (Models.Firma)param;
                Firma = (Models.Firma)param.Clone();
            }
            else
            {
                //ParamPerson = (Models.Person)param;
                Person   = (Models.Person)param.Clone();
                isPerson = true;
            }
        }
Example #3
0
 public SelectFirmaViewModel()
 {
     Firma           = new Models.Firma();
     FirmenList      = new List <Models.Firma>();
     FirmenList      = Proxy.Instance.FirmenList;
     FirmaCollection = new ObservableCollection <Models.Firma>();
 }
Example #4
0
 public SearchViewModel()
 {
     Firma              = new Models.Firma();
     Person             = new Models.Person();
     RechnungSearch     = new Models.SearchReceipt();
     Rechnung           = new Models.Rechnung();
     FirmaCollection    = new ObservableCollection <Models.Firma>();
     PersonCollection   = new ObservableCollection <Models.Person>();
     RechnungCollection = new ObservableCollection <Models.Rechnung>();
 }
        private void buttonName_Click(object sender, RoutedEventArgs e)
        {
            Models.Firma firma = new Models.Firma(textBoxNaziv.ToString(), textBoxAdresaPravnog.ToString(), textBoxRacun.ToString());
            //firme.Add(new Models.Firma(textBoxNaziv, textBoxAdresaPravnog, textBoxRacun);
            if (textBoxEmail.ToString() == textBoxPotvrdaEmail.ToString())
            {
                Plica.Add(new Models.PravnoLice(textBoxIme.ToString(), textBoxPrezime.ToString(), textBoxTelefon.ToString(), textBoxEmail.ToString(), firma, textBoxBrojLicne.ToString()));
                this.Frame.Navigate(typeof(Sala));
            }
            else
            {
                //Poruka za nepravilan unos email
                textBoxEmail.Text        = " ";
                textBoxPotvrdaEmail.Text = " ";
            }

            using (var db = new LiceDbContext())
            {
                var contact = new Lice
                {
                    Ime     = textBoxIme.Text,
                    Prezime = textBoxPrezime.Text,
                    Email   = textBoxEmail.Text,
                    Telefon = textBoxTelefon.Text,
                };
                db.Lice.Add(contact);
                //SaveChanges obavezno da se reflektuju izmjene u bazi, tek tada dolazi do komunikacije

                db.SaveChanges();
                //reset polja za unos
                textBoxIme.Text          = string.Empty;
                textBoxPrezime.Text      = string.Empty;
                textBoxEmail.Text        = string.Empty;
                textBoxTelefon.Text      = string.Empty;
                textBoxPotvrdaEmail.Text = string.Empty;
            }
        }
Example #6
0
        public void GetFirmen()
        {
            XElement xml;

            xml =
                new XElement("Search",
                             new XElement("Firmen")
                             );
            byte[] data = Encoding.UTF8.GetBytes(xml.ToString());
            Proxy.Instance.Send(data);
            Proxy.Instance.Receive();

            XmlDocument response = new XmlDocument();

            response.LoadXml(Proxy.Instance.Response);

            XmlElement root = response.DocumentElement;

            foreach (XmlNode element in root.ChildNodes)
            {
                Models.Firma firma = new Models.Firma();

                foreach (XmlNode item in element.ChildNodes)
                {
                    if (item.Name == "ID")
                    {
                        firma.ID = item.InnerText;
                    }
                    if (item.Name == "Name")
                    {
                        firma.Name = item.InnerText;
                    }
                }
                Firmen.Add(firma);
            }
        }
Example #7
0
        //Models.Firma ParamFirma;
        //Models.Person ParamPerson;

        public DetailedInformationWindowViewModel()
        {
            Firma  = new Models.Firma();
            Person = new Models.Person();
        }
Example #8
0
        public void GeneralCommandMethod(object param)
        {
            switch (param as string)
            {
            case "Firma":
                Firmen.Clear();
                SearchFirma();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                Proceed();
                break;

            case "Person":
                Personen.Clear();
                SearchPerson();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                Proceed();
                break;

            case "Rechnung":
                Rechnungen.Clear();
                SearchRechnung();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                Proceed();
                break;

            case "ViewFirma":
                lViewDoubleClickFirma();
                break;

            case "ViewRechnung":
                lViewDoubleClickRechnung();
                break;

            case "ViewPerson":
                lViewDoubleClickPerson();
                break;

            case "AddFirma":
                Firma = new Models.Firma();
                lViewDoubleClickFirma();
                break;

            case "AddPerson":
                Person = new Models.Person();
                lViewDoubleClickPerson();
                break;

            case "AddRechnung":
                Rechnung = new Models.Rechnung();
                lViewDoubleClickRechnung();
                break;

            case "SearchRechnungen":
                Rechnungen.Clear();
                SearchRechnung();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                Proceed();
                break;

            case "DeleteFirma":
                DeleteFirma();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                break;

            case "DeletePerson":
                DeletePerson();
                Proxy.Instance.Send(data);
                Proxy.Instance.Receive();
                break;

            default:
                //DetailedInformationWindow window = new DetailedInformationWindow();
                //window.Show();
                break;
            }
        }