示例#1
0
        public List <Ven> HentVenner(int id)
        {
            conn.Open();
            List <Ven> venner    = new List <Ven>();
            string     selectSQL = "Select Id, Fornavn, Efternavn from Bruger " +
                                   "where (Bruger.Id in (Select AcceptId from Venner where AnsøgId = '" + id + "' and Godkendt = '1'))" +
                                   " or(Bruger.Id in (Select AnsøgId from Venner where AcceptId = '" + id + "' and Godkendt = '1'))";
            SqlCommand    com      = new SqlCommand(selectSQL, conn);
            SqlDataReader myReader = com.ExecuteReader();// NB new method used here

            try
            {                           // loop through the ResultSet, one tuple at the time:
                while (myReader.Read()) // first advance the curser to the next tuple.
                {
                    Ven ven = new Ven();
                    ven.Id        = myReader.GetInt32(0);
                    ven.Fornavn   = myReader.GetString(1);
                    ven.Efternavn = myReader.GetString(2);
                    venner.Add(ven);
                }
            }
            catch { }
            finally
            {
                myReader.Close(); // close nicely the ResultSet
                conn.Close();
            }
            return(venner);
        }
示例#2
0
        private string parseVenFromDeviceID(string deviceId)
        {
            string[] splitDeviceId = deviceId.Split('\\');
            string   Ven;

            //Разбиваем строку на несколько частей.
            //Каждая чаcть отделяется по символу &
            string[] splitVen = splitDeviceId[1].Split('&');

            Ven = splitVen[1].Replace("VEN_", "");
            Ven = Ven.Replace("_", " ");
            return(Ven);
        }
示例#3
0
        public void UpdateListview()
        {
            string strSql = "Select * from MainVenneTabel";

            using (var ctx = new VennerEntities())
            {
                var minVen = ctx.MainVenneTabel.SqlQuery(strSql);
                foreach (MainVenneTabel i in minVen)
                {
                    ClassVen cv = new ClassVen(i);
                    cv.venData = i;
                    Ven.Add(cv);
                }
            }
        }
示例#4
0
        private static string parseVenFromDeviceID(string deviceId)
        {
            Logger.Debug(() => $" parsevendor from id = {deviceId}");

            try
            {
                string[] splitDeviceId = deviceId.Split('\\');
                string   Ven;
                //Разбиваем строку на несколько частей.
                //Каждая чаcть отделяется по символу &
                string[] splitVen = splitDeviceId[1].Split('&');

                Ven = splitVen[1].Replace("VEN_", "");
                Ven = Ven.Replace("_", " ");
                return(Ven);
            }
            catch (Exception ex)
            {
                Logger.Debug(() => $"{ex}");
            }

            return(string.Empty);
        }