Exemple #1
0
        public Kontakt[] KuvaKontakt(String kontakt_id, String eesnimi, String perenimi, String telefonKodu, String telefonToo,
            String telefonMob, String emailKodu, String emailToo, String riik, String maakond, String asula, String tanav,
            String maja_nr, String wlm, String facebook, String orkut, String skype, String twitter, String pilt)
        {
            int id = 0;
            Int32.TryParse(kontakt_id, out id);

            if (Session["kasutaja"] == null)
            {
                return null;
            }

            Kasutaja k = (Kasutaja)Session["kasutaja"];

            Kontakt kontakt = new Kontakt();
            kontakt.Id = id;
            if (eesnimi != "") kontakt.Eesnimi = eesnimi;
            if(eesnimi != "") kontakt.Eesnimi = eesnimi;
            if(perenimi != "") kontakt.Perenimi = perenimi;
            if(telefonKodu != "") kontakt.TelefonKodu = telefonKodu;
            if(telefonToo != "") kontakt.TelefonToo = telefonToo;
            if(telefonMob != "") kontakt.TelefonMob = telefonMob;
            if(emailKodu != "") kontakt.EmailKodu = emailKodu;
            if(emailToo != "") kontakt.EmailToo = emailToo;
            if(riik != "") kontakt.Riik = riik;
            if(maakond != "") kontakt.Maakond = maakond;
            if(asula != "") kontakt.Asula = asula;
            if(tanav != "") kontakt.Tanav = tanav;
            if(maja_nr != "") kontakt.MajaNr = maja_nr;
            if(wlm != "") kontakt.WindowsLiveMessenger = wlm;
            if(facebook != "") kontakt.Facebook = facebook;
            if(orkut != "") kontakt.Orkut = orkut;
            if(skype != "") kontakt.Skype = skype;
            if(twitter != "") kontakt.Twitter = twitter;
            if(pilt != "") kontakt.Pilt = pilt;
            Kontakt[] kontaktid = k.otsiKontaktid(kontakt, ab);

            return kontaktid;
        }
Exemple #2
0
        public Kontakt[] otsiKontaktid(Kontakt otsing, SQLiteConnection c)
        {
            string query = "SELECT * FROM Kontakt WHERE ";

            if (otsing.Id != 0)
            {
                query += "Id == " + otsing.Id;
                return(c.Query <Kontakt>(query, string.Empty).ToArray());
            }

            if (otsing.Eesnimi != null)
            {
                query += "Eesnimi LIKE '%" + otsing.Eesnimi + "%' AND ";
            }

            if (otsing.Perenimi != null)
            {
                query += "Perenimi LIKE '%" + otsing.Perenimi + "%' AND ";
            }

            if (otsing.Asula != null)
            {
                query += "Asula LIKE '%" + otsing.Asula + "%' AND ";
            }

            if (otsing.Facebook != null)
            {
                query += "Facebook LIKE '%" + otsing.Facebook + "%' AND ";
            }

            if (otsing.Maakond != null)
            {
                query += "Maakond LIKE '%" + otsing.Maakond + "%' AND ";
            }

            if (otsing.MajaNr != null)
            {
                query += "MajaNr LIKE '%" + otsing.MajaNr + "%' AND ";
            }

            if (otsing.Orkut != null)
            {
                query += "Orkut LIKE '%" + otsing.Orkut + "%' AND ";
            }

            if (otsing.Riik != null)
            {
                query += "Riik LIKE '%" + otsing.Riik + "%' AND ";
            }

            if (otsing.Skype != null)
            {
                query += "Skype LIKE '%" + otsing.Skype + "%' AND ";
            }

            if (otsing.Tanav != null)
            {
                query += "Tanav LIKE '%" + otsing.Tanav + "%' AND ";
            }

            if (otsing.Twitter != null)
            {
                query += "Twitter LIKE '%" + otsing.Twitter + "%' AND ";
            }

            if (otsing.WindowsLiveMessenger != null)
            {
                query += "WindowsLiveMessenger LIKE '%" + otsing.WindowsLiveMessenger + "%' AND ";
            }

            if (otsing.EmailKodu != null)
            {
                query += "EmailKodu LIKE '%" + otsing.EmailKodu + "%' AND ";
            }

            if (otsing.EmailToo != null)
            {
                query += "EmailToo LIKE '%" + otsing.EmailToo + "%' AND ";
            }

            if (otsing.TelefonKodu != null)
            {
                query += "TelefonKodu LIKE '%" + otsing.TelefonKodu + "%' AND ";
            }

            if (otsing.TelefonMob != null)
            {
                query += "TelefonMob LIKE '%" + otsing.TelefonMob + "%' AND ";
            }

            if (otsing.TelefonToo != null)
            {
                query += "TelefonToo LIKE '%" + otsing.TelefonToo + "%' AND ";
            }

            if (query.Substring(query.Length - 5) == " AND ")
            {
                query = query.Substring(0, query.Length - 5);
            }
            else if (query.Substring(query.Length - 7) == " WHERE ")
            {
                query = query.Substring(0, query.Length - 7);
            }

            return(c.Query <Kontakt>(query, string.Empty).ToArray());
        }
Exemple #3
0
        public Kontakt[] otsiKontaktid(Kontakt otsing, SQLiteConnection c)
        {
            string query = "SELECT * FROM Kontakt WHERE ";

            if (otsing.Id != 0)
            {
                query += "Id == " + otsing.Id;
                return c.Query<Kontakt>(query, string.Empty).ToArray();
            }

            if (otsing.Eesnimi != null)
                query += "Eesnimi LIKE '%" + otsing.Eesnimi + "%' AND ";

            if(otsing.Perenimi != null)
                query += "Perenimi LIKE '%" + otsing.Perenimi + "%' AND ";

            if(otsing.Asula != null)
                query += "Asula LIKE '%" + otsing.Asula + "%' AND ";

            if(otsing.Facebook != null)
                query += "Facebook LIKE '%" + otsing.Facebook + "%' AND ";

            if(otsing.Maakond != null)
                query += "Maakond LIKE '%" + otsing.Maakond + "%' AND ";

            if(otsing.MajaNr != null)
                query += "MajaNr LIKE '%" + otsing.MajaNr + "%' AND ";

            if(otsing.Orkut != null)
                query += "Orkut LIKE '%" + otsing.Orkut + "%' AND ";

            if(otsing.Riik != null)
                query += "Riik LIKE '%" + otsing.Riik + "%' AND ";

            if(otsing.Skype != null)
                query += "Skype LIKE '%" + otsing.Skype + "%' AND ";

            if(otsing.Tanav != null)
                query += "Tanav LIKE '%" + otsing.Tanav + "%' AND ";

            if(otsing.Twitter != null)
                query += "Twitter LIKE '%" + otsing.Twitter + "%' AND ";

            if(otsing.WindowsLiveMessenger != null)
                query += "WindowsLiveMessenger LIKE '%" + otsing.WindowsLiveMessenger + "%' AND ";

            if(otsing.EmailKodu != null)
                query += "EmailKodu LIKE '%" + otsing.EmailKodu + "%' AND ";

            if(otsing.EmailToo != null)
                query += "EmailToo LIKE '%" + otsing.EmailToo + "%' AND ";

            if(otsing.TelefonKodu != null)
                query += "TelefonKodu LIKE '%" + otsing.TelefonKodu + "%' AND ";

            if(otsing.TelefonMob != null)
                query += "TelefonMob LIKE '%" + otsing.TelefonMob + "%' AND ";

            if(otsing.TelefonToo != null)
                query += "TelefonToo LIKE '%" + otsing.TelefonToo + "%' AND ";

            if (query.Substring(query.Length - 5) == " AND ")
            {
                query = query.Substring(0, query.Length - 5);
            }
            else if (query.Substring(query.Length - 7) == " WHERE ")
            {
                query = query.Substring(0, query.Length - 7);
            }

            return c.Query<Kontakt>(query, string.Empty).ToArray();
        }
Exemple #4
0
 public int LisaKontakt(Kontakt k, SQLiteConnection c)
 {
     k.KasutajaId = Id;
     return(c.Insert(k));
 }
Exemple #5
0
 public int LisaKontakt(Kontakt k, SQLiteConnection c)
 {
     k.KasutajaId = Id;
     return c.Insert(k);
 }