private void DeleteToolStripMenuItem_Click(object sender, EventArgs e) { VeritabaniIslemleri database = VeritabaniIslemleri.bagOlustur("SatisVeritabani"); database.dataUpdate("userAuthorization", "0", "MusteriBilgileriTablosu", "customerID=" + Id); dataRefresh(); }
/// <summary> /// elemanları güncellemeye yarayan metot Factory patern kullanıldı /// </summary> /// <param name="product"></param> /// <param name="path"></param> public void updateItem(Product product, string path) { Type sendedObjectType = product.GetType(); string productValues = product.Id + "#'" + product.Name.Replace("'", " ") + "'#" + product.Price.ToString().Replace(',', '.') + "#'" + path + "'#'" + (product.Description.Replace('\'', ' ')) + "'#" + product.Sale + "#"; if (sendedObjectType.Name == "Book") { dataBase.dataUpdate("productId,productName,productPrice,productImage,productDescription,productSale,productType", productValues + "1", "UrunlerTablosu", "productId=" + product.Id); //burada kaldık. updateBook((Book)product); } else if (sendedObjectType.Name == "MusicCD") { dataBase.dataUpdate("productId,productName,productPrice,productImage,productDescription,productSale,productType", productValues + "2", "UrunlerTablosu", "productId=" + product.Id); updateCd((MusicCD)product); } else if (sendedObjectType.Name == "Magazine") { dataBase.dataUpdate("productId,productName,productPrice,productImage,productDescription,productSale,productType", productValues + "3", "UrunlerTablosu", "ProductId=" + product.Id); updateMagazine((Magazine)product); } else { System.Windows.Forms.MessageBox.Show("INVALID TYPE"); } }
/// <summary> /// cd güncelleyen metot /// </summary> /// <param name="cd"></param> /// <param name="maxId"></param> public void updateCd(MusicCD cd, string maxId) { string cdValues = cd.Id + "#" + Convert.ToInt16(cd.Mcdtype) + "#'" + cd.Singer + "'"; dataBase.dataUpdate("productId,productType,productSinger", cdValues, "CdBilgileriTablosu", "productId=" + cd.Id); }
/// <summary> /// dergi güncelleyen metot /// </summary> /// <param name="magazine"></param> /// <param name="maxId"></param> public void updateMagazine(Magazine magazine, string maxId) { string magazineValues = magazine.Id + "#'" + magazine.Issue + "'#" + Convert.ToInt16(magazine.Mtype); dataBase.dataUpdate("productId,productIssue,productType", magazineValues, "MagazineBilgileriTablosu", "ProductId=" + magazine.Id); }
/// <summary> /// kitap güncelleyen metot /// </summary> /// <param name="book"></param> /// <param name="maxId"></param> public void updateBook(Book book, string maxId) { string bookValues = book.Id + "#'" + book.Author + "'#" + book.Isbn + "#'" + book.Publisher + "'#" + book.Page + "#'" + book.size + "'#" + Convert.ToInt16(book.type) + "#" + Convert.ToInt16(book.l_anguage); dataBase.dataUpdate("productId,productAuthor,isbn,publisher,page,size,type,language", bookValues, "kitapBilgileriTablosu", "productId=" + book.Id); }