Beispiel #1
0
        public static EKATEGORI Select(int _ID)
        {
            EKATEGORI item = null;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_Select", Baglanti.Con);

                com.CommandType = CommandType.StoredProcedure;

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }

                com.Parameters.AddWithValue("ID", _ID);
                SqlDataReader rdr = com.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        item.ID  = int.Parse(rdr["ID"].ToString());
                        item.ADI = rdr["ADI"].ToString();
                    }
                }
            }
            catch (Exception)
            {
                item = null;
            }

            return(item);
        }
Beispiel #2
0
        public static List <EKATEGORI> get_SubCatIdFonk(EKATEGORI item, int CatID)
        {
            List <EKATEGORI> liste = null;

            try
            {
                SqlCommand com = new SqlCommand("sayfalama_kategoriID", FCONNECTION.conn);
                com.CommandType = CommandType.StoredProcedure;

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }
                com.Parameters.AddWithValue("num", CatID);
                SqlDataReader rdr = com.ExecuteReader();

                if (rdr.HasRows)
                {
                    liste = new List <EKATEGORI>();
                    while (rdr.Read())
                    {
                        EKATEGORI item1 = new EKATEGORI();
                        item1.Name = rdr["Name"].ToString();
                        item1.ID   = Convert.ToInt32(rdr["ID"]);
                        liste.Add(item1);
                    }
                }
                com.Connection.Close();
                rdr.Close();
            }
            catch
            {
            }
            return(liste);
        }
Beispiel #3
0
        public static bool Update(EKATEGORI item)
        {
            bool sonuc = false;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_Update", Baglanti.Con);

                com.CommandType = CommandType.StoredProcedure;

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }
                com.Parameters.AddWithValue("ID", item.ID);
                com.Parameters.AddWithValue("ADI", item.ADI);
                sonuc = com.ExecuteNonQuery() > 0;
            }
            catch (Exception)
            {
                sonuc = false;
            }

            return(sonuc);
        }
Beispiel #4
0
        public static int Insert(EKATEGORI item)
        {
            int etkilenen = 0;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_Insert", Baglanti.Con);

                com.CommandType = CommandType.StoredProcedure;

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }

                com.Parameters.AddWithValue("ADI", item.ADI);
                etkilenen = com.ExecuteNonQuery();
            }
            catch (Exception)
            {
                etkilenen = -1;
            }

            return(etkilenen);
        }
Beispiel #5
0
        }//EndOfSelect()

        /// <summary>
        /// Kategori_SelectList 'ten liste döndürdük
        /// </summary>
        /// <param name="_ID"></param>
        /// <returns></returns>
        public static List <EKATEGORI> SelectList()
        {
            List <EKATEGORI> itemList = null;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_SelectList", Baglanti.Con);
                com.CommandType = CommandType.StoredProcedure;

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }

                SqlDataReader rdr = com.ExecuteReader();
                if (rdr.HasRows)
                {
                    itemList = new List <EKATEGORI>();
                    while (rdr.Read())
                    {
                        EKATEGORI item = new EKATEGORI();
                        item.ID  = int.Parse(rdr["ID"].ToString());
                        item.ADI = rdr["ADI"].ToString();
                        itemList.Add(item);
                    }
                }

                rdr.Close();
            }
            catch
            {
                itemList = null;
            }
            return(itemList);
        } //EndOfSelectList()
Beispiel #6
0
        }//EndOfInsert()

        public static bool Update(EKATEGORI item)
        {
            if (item.ID > 0 && item.ADI != null && item.ADI.Trim().Length > 0)
            {
                return(FKATEGORI.Update(item));
            }
            return(false);
        }//EndOfUpdate()
Beispiel #7
0
 public static int Insert(EKATEGORI item)
 {
     if (item.ADI != null && item.ADI.Trim().Length > 0)
     {
         return(FKATEGORI.Insert(item));
     }
     return(-1);
 }//EndOfInsert()
Beispiel #8
0
 public static bool Update(EKATEGORI item)
 {
     if (item.ID > 0 && item.ADI != null && item.ADI.Trim().Length > 0)// TRİM BOŞLKLARI KALDIRIYOR.
     {
         return(FKATEGORI.Update(item));
     }
     return(false);
 }
Beispiel #9
0
 public static int Insert(EKATEGORI item)
 {
     if (item.ADI != null && item.ADI.Trim().Length > 0)// TRİM BOŞLKLARI KALDIRIYOR.
     {
         return(FKATEGORI.Insert(item));
     }
     return(-1);
 }
        private void atama(int CatID)
        {
            EKATEGORI        get_SubCatId  = new EKATEGORI();
            List <EKATEGORI> get_SubCatId2 = BLLKATEGORI.get_SubCatIdFonk(get_SubCatId, CatID);

            SubCategoryID1   = get_SubCatId2[0].ID;
            SubCategoryName1 = get_SubCatId2[0].Name;

            SubCategoryID2   = get_SubCatId2[1].ID;
            SubCategoryName2 = get_SubCatId2[1].Name;
        }
Beispiel #11
0
        public static bool Update(EKATEGORI item)
        {
            bool sonuc = false;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_Update", Baglanti.Con);
                com.CommandType = CommandType.StoredProcedure;// ınsert'ümüz sqlimizde bir storedprcedure olduğu için bunu belirttik.

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }
                com.Parameters.AddWithValue("ID", item.ID);
                com.Parameters.AddWithValue("ADI", item.ADI);
                sonuc = com.ExecuteNonQuery() > 0;
            }
            catch
            {
                sonuc = false;
            }
            return(sonuc);
        }
Beispiel #12
0
        public static int Insert(EKATEGORI item)
        {
            int etkilenen = 0;

            try
            {
                SqlCommand com = new SqlCommand("KATEGORI_Insert", Baglanti.Con);
                com.CommandType = CommandType.StoredProcedure;// ınsert'ümüz sqlimizde bir storedprcedure olduğu için bunu belirttik.

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }

                com.Parameters.AddWithValue("ADI", item.ADI);
                etkilenen = com.ExecuteNonQuery();
            }
            catch
            {
                etkilenen = -1;
            }
            return(etkilenen);
        }
Beispiel #13
0
 public static List <EKATEGORI> get_SubCatIdFonk(EKATEGORI item, int CatID)
 {
     return(FKATEGORI.get_SubCatIdFonk(item, CatID));
 }