Exemplo n.º 1
0
        public void GetThreeHareketTipiWithScalar()
        {
            var         cmdText  = "SELECT COUNT(*) FROM HareketTip";
            AdoProvider provider = new AdoProvider("Server = PC-551; Database=DernekYonetimDb;Integreted Security = True;");
            var         result   = provider.ExecuteScalar(cmdText);

            Assert.AreEqual(3, result);
        }
Exemplo n.º 2
0
        public void GetIntWithScalar()
        {
            var         cmdText  = "SELECT COUNT(*) FROM HareketTip";
            AdoProvider provider = new AdoProvider("Server = PC-551; Database=DernekYonetimDb;Integreted Security = True;");
            var         result   = provider.ExecuteScalar <int>(cmdText);

            Assert.AreEqual(typeof(int), result.GetType());
        }           // generic metodumuza gidiyor direk
Exemplo n.º 3
0
        public int Add(Donem item)
        {
            var komutText = "INSERT INTO Donem (Ay,Yil,Tanim) VALUES (@Ay, @Yil, @Tanim); SELECT SCOPE_IDENTITY()";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@Ay", item.Ay);
            parameters.Add("@Yil", item.Yil);
            parameters.Add("@Tanim", item.Tanim);
            return(provider.ExecuteScalar <int>(komutText, parameters));
        }
        public void GetThreeHareketTipiWithScalar()
        {
            var         cmdText  = "SELECT COUNT(*) FROM HareketTip WHERE Id >= @Id";
            AdoProvider provider = new AdoProvider("Server= PC-517; Database= DernekYonetimDb; Integrated Security = true;");
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@Id", 2);
            var result = provider.ExecuteScalar <int>(cmdText, parameters);

            Assert.AreEqual(2, result);
        }
Exemplo n.º 5
0
        public int Add(Yonetici item)
        {
            var cmdText = "INSERT INTO Yonetici (KisiId,UnvanId,BaslangicTarihi,BitisTarihi) VALUES (@KisiId,@UnvanId,@BaslangicTarihi,@BitisTarihi); SELECT SCOPE_IDENTITY() ";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            parameters.Add("@KisiId", item.Id);
            parameters.Add("@UnvanId", item.UnvanId);
            parameters.Add("@BaslangicTarihi", item.BaslangicTarihi);
            parameters.Add("@BitisTarihi", item.BitisTarihi);
            return(provider.ExecuteScalar <int>(cmdText, parameters));
        }
Exemplo n.º 6
0
        public int Add(T item)
        {
            Type tip       = typeof(T);
            var  propInfos = tip.GetProperties();
            var  cmdText   = _queryBuilder.Insert <T>();
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            foreach (var propInfo in propInfos)
            {
                if (propInfo.Name == "Id")
                {
                    continue;
                }
                else
                {
                    parameters.Add("@" + propInfo.Name, propInfo.GetValue(item));
                }
            }
            return(provider.ExecuteScalar <int>(cmdText, parameters));
        }