Beispiel #1
0
        public static void ParametreOlustur <T>(SqlCommand cmd, KomutTip kt, T ent)
        {
            PropertyInfo[] properties = typeof(T).GetProperties();

            foreach (PropertyInfo item in properties)
            {
                string name = item.Name;
                switch (kt)
                {
                case KomutTip.Select:
                    break;

                case KomutTip.Insert:
                    if ((name.ToLower() == "ıd" || name.ToLower() == "id"))
                    {
                        continue;
                    }
                    break;

                case KomutTip.Update:
                    if (name.ToLower() == "ıd" || name.ToLower() == "id" || name.ToLower() == "miktar")
                    {
                    }
                    else
                    {
                        continue;
                    }
                    break;

                case KomutTip.Updated:
                    break;

                case KomutTip.Delete:
                    if ((name.ToLower() == "ıd") || (name.ToLower() == "id"))
                    {
                    }
                    else
                    {
                        continue;
                    }
                    break;

                default:
                    break;
                }
                object value = item.GetValue(ent);
                cmd.Parameters.AddWithValue("@" + name, value);
            }
        }
Beispiel #2
0
 public static void PropertyInfo <T>(SqlCommand cmd, KomutTip kmt, T entity)
 {
     PropertyInfo[] pInfo = typeof(T).GetProperties();
     foreach (var Pitem in pInfo)
     {
         string name     = Pitem.Name;
         object getValue = Pitem.GetValue(entity);
         if ((KomutTip.Insert == kmt && (name.ToLower() == "ıd" || name.ToLower() == "id") || name == "SatisTarihi"))
         {
             continue;
         }
         else if (KomutTip.Delete == kmt && !((name.ToLower() == "ıd" || name.ToLower() == "id")))
         {
             continue;
         }
         cmd.Parameters.AddWithValue("@" + name, getValue);
     }
 }
Beispiel #3
0
 public static void ParametreOlustur <T>(SqlCommand komut, KomutTip komuttip, T ent)
 {
     PropertyInfo[] propertyInfo = typeof(T).GetProperties();
     foreach (PropertyInfo pi in propertyInfo)
     {
         string name = pi.Name;
         if (name.ToLower() == "ıd" || name.ToLower() == "id" && komuttip == KomutTip.Insert)
         {
             continue;
         }
         else if (komuttip == KomutTip.Delete && name.ToLower() != "ıd" || name.ToLower() != "id")
         {
             continue;
         }
         object value = pi.GetValue(ent);
         komut.Parameters.AddWithValue("@" + name, value);
     }
 }
Beispiel #4
0
        public static void ParametreOlustur <T>(MySqlCommand cmd, KomutTip kt, T ent)
        {
            PropertyInfo[] properties = typeof(T).GetProperties();
            foreach (PropertyInfo pi in properties)
            {
                string name = pi.Name;
                if (true)
                {
                }

                else if (kt == KomutTip.Delete && (name.ToLower() != "ıd" || name.ToLower() != "id"))
                {
                    continue;
                }
                object value = pi.GetValue(ent);
                cmd.Parameters.AddWithValue("@" + name, value);
            }
        }
Beispiel #5
0
        public static void ParametreOlustur <T>(SqlCommand cmd, KomutTip kt, T ent)
        {
            PropertyInfo[] propertys = typeof(T).GetProperties();

            foreach (PropertyInfo pi in propertys)
            {
                string name = pi.Name;

                #region MyRegion

                /*if (name.ToLower() == "ıd" || name.ToLower() == "id" && kt == KomutTip.INSERT)
                 * {
                 *  continue;
                 * }*/

                #endregion

                if (kt == KomutTip.DELETE && (name == "ID" || name == "TC" || name == "URUNKODU"))//  else if (kt == KomutTip.DELETE && (name.ToLower() != "tc"))
                {
                    object value = pi.GetValue(ent);

                    cmd.Parameters.AddWithValue("@" + name, value);
                }
                else if (kt == KomutTip.INSERT && name != "ID")
                {
                    object value = pi.GetValue(ent);

                    cmd.Parameters.AddWithValue("@" + name, value);
                }
                else if (kt == KomutTip.UPDATE && name != "BORCTARIHI" && name != "KAYITTARIHI")
                {
                    object value = pi.GetValue(ent);

                    cmd.Parameters.AddWithValue("@" + name, value);
                }
                else
                {
                    continue;
                }
            }
        }
        public static void ParametreOlustur <T>(SqlCommand cmd, KomutTip kt, T ent)
        {
            PropertyInfo[] propertiler = typeof(T).GetProperties();
            int            sayac       = 0;

            foreach (PropertyInfo pi in propertiler)
            {
                sayac++;
                string name = pi.Name;
                //Tablodaki ilk sütun Identity olmak zorunda.
                if (sayac == 1 && kt == KomutTip.Insert) //sayac==1 gelen ilk property'yi belirtiyor.
                {
                    continue;
                }
                else if (sayac != 1 && kt == KomutTip.Delete)
                {
                    continue;
                }
                object value = pi.GetValue(ent);
                cmd.Parameters.AddWithValue("@" + name, value);
            }
        }