public override int Save(Category instance) { int sonuc = 0; SqlProvider provider = new SqlProvider("Pr_CategoryInsert", true); provider.AddParameter("@CategoryName", instance.CategoryName); provider.AddParameter("@Description", instance.Description); sonuc = provider.ExecuteNonQuery(); return(sonuc); }
public override int Save(Product instance) { int sonuc = 0; SqlProvider provider = new SqlProvider("Pr_ProductInsert", true); provider.AddParameter("@ProductName", instance.ProductName); provider.AddParameter("@CategoryID", instance.CategoryID); provider.AddParameter("@UnitPrice", instance.UnitPrice); provider.AddParameter("@UnitsInStock", instance.UnitsInStock); sonuc = provider.ExecuteNonQuery(); return(sonuc); }
public override List <Product> Search(string search) { SqlProvider provider = new SqlProvider("Pr_ProductSearch", true); provider.AddParameter("@ProductName", search); SqlDataReader reader = provider.ExecuteReader(); List <Product> productList = new List <Product>(); if (reader.HasRows) { while (reader.Read()) { Product product = new Product() { ProductID = Convert.ToInt32(reader["ProductID"].ToString()), ProductName = reader["ProductName"].ToString(), CategoryID = Convert.ToInt32(reader["CategoryID"].ToString()), UnitPrice = Convert.ToDecimal(reader["UnitPrice"].ToString()), UnitsInStock = Convert.ToInt32(reader["UnitsInStock"].ToString()) }; productList.Add(product); } } reader.Close(); return(productList); }
public override List <Category> Search(string search) { SqlProvider provider = new SqlProvider("Pr_CategorySearch", true); provider.AddParameter("@CategoryName", search); SqlDataReader reader = provider.ExecuteReader(); List <Category> categoryList = new List <Category>(); if (reader.HasRows) { while (reader.Read()) { Category category = new Category() { CategoryID = Convert.ToInt32(reader["CategoryID"]), CategoryName = reader["CategoryName"].ToString(), Description = reader["Description"].ToString() }; categoryList.Add(category); } } reader.Close(); return(categoryList); }
public override int Delete(object instanceId) { int sonuc = 0; SqlProvider provider = new SqlProvider("Pr_ProductDelete", true); provider.AddParameter("@ProductID", instanceId); sonuc = provider.ExecuteNonQuery(); return(sonuc); }
public int Exist() { try { _sqlProvider = new SqlProvider("SELECT URETIMTALEPID FROM URETIMTALEP WHERE TARIH = @TARIH AND DEPOID = @DEPOID ", false); _sqlProvider.AddParameter("TARIH", Tarih); _sqlProvider.AddParameter("DEPOID", Depoid); int n = Convert.ToInt32(_sqlProvider.ExecuteScalar()); if (n != 0) { UretimTalepid = n; } return(n); } catch (Exception) { return(0); } }
public int Insert() { UretimTalepid = SiraNo.SiraNoVer("URETIMTALEP"); _sqlProvider = new SqlProvider("INSERT INTO URETIMTALEP (URETIMTALEPID,DURUM,TARIH,TESLIMTARIHI,DEPOID,YETKILI,ACIKLAMA) VALUES (@URETIMTALEPID,@DURUM,@TARIH,@TESLIMTARIHI,@DEPOID,@YETKILI,@ACIKLAMA) ", false); _sqlProvider.AddParameter("URETIMTALEPID", UretimTalepid); _sqlProvider.AddParameter("DURUM", Durum); _sqlProvider.AddParameter("TARIH", Tarih); _sqlProvider.AddParameter("TESLIMTARIHI", TeslimTarihi); _sqlProvider.AddParameter("DEPOID", Depoid); _sqlProvider.AddParameter("YETKILI", Yetkili); _sqlProvider.AddParameter("ACIKLAMA", Aciklama); _sqlProvider.ExecuteNonQuery(); return(UretimTalepid); }
public string Insert() { try { _sqlProvider = new SqlProvider("INSERT INTO URETIMTALEPISL (URETIMTALEPID,STOKID,BIRIM,MIKTAR,DEPOMIKTAR,MINMIKTAR,TAVMIKTAR,PRCMIKTAR,KULMIKTAR,ACIKLAMA,BARKOD) VALUES (@URETIMTALEPID,@STOKID,@BIRIM,@MIKTAR,@DEPOMIKTAR,@MINMIKTAR,@TAVMIKTAR,@PRCMIKTAR,@KULMIKTAR,@ACIKLAMA,@BARKOD) ", false); _sqlProvider.AddParameter("URETIMTALEPID", UretimTalepid); _sqlProvider.AddParameter("STOKID", Stokid); _sqlProvider.AddParameter("BIRIM", Birim); _sqlProvider.AddParameter("MIKTAR", Miktar); _sqlProvider.AddParameter("DEPOMIKTAR", DepoMiktar); _sqlProvider.AddParameter("MINMIKTAR", MinMiktar); _sqlProvider.AddParameter("TAVMIKTAR", TavMiktar); _sqlProvider.AddParameter("PRCMIKTAR", PrcMiktar); _sqlProvider.AddParameter("KULMIKTAR", KulMiktar); _sqlProvider.AddParameter("ACIKLAMA", Aciklama); _sqlProvider.AddParameter("BARKOD", Barkod); _sqlProvider.ExecuteNonQuery(); return("OK"); } catch (Exception e) { return(e.InnerException.Message); } }