public static EPRODUCT urun_listele(int a) { EPRODUCT item = new EPRODUCT(); try { SqlCommand com = new SqlCommand("urun_list_satin", FCONNECTION.conn); com.CommandType = CommandType.StoredProcedure; if (com.Connection.State != ConnectionState.Open) { com.Connection.Open(); } com.Parameters.AddWithValue("ID", a); SqlDataReader rdr = com.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { item.Name = rdr["Name"].ToString(); item.Price = Convert.ToInt32(rdr["Price"]); } } com.Connection.Close(); rdr.Close(); } catch { } return(item); }
public static int AddItem(EPRODUCT item, ref int tempPicID) { int satir = -1; try { SqlCommand comm = new SqlCommand("URUN_EKLE", FCONNECTION.conn); comm.CommandType = CommandType.StoredProcedure; if (comm.Connection.State != ConnectionState.Open) { comm.Connection.Open(); } comm.Parameters.AddWithValue("Name", item.Name); comm.Parameters.AddWithValue("Price", item.Price); comm.Parameters.AddWithValue("SubCategoryID", item.SubCategoryID); comm.Parameters.AddWithValue("UsersID", item.UsersID); satir = comm.ExecuteNonQuery(); comm.Connection.Close(); SqlCommand com2 = new SqlCommand("get_UrunID", FCONNECTION.conn); com2.CommandType = CommandType.StoredProcedure; if (com2.Connection.State != ConnectionState.Open) { com2.Connection.Open(); } com2.Parameters.AddWithValue("Name", item.Name); com2.Parameters.AddWithValue("Price", item.Price); com2.Parameters.AddWithValue("SubCategoryID", item.SubCategoryID); com2.Parameters.AddWithValue("UsersID", item.UsersID); SqlDataReader rdr = com2.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { item.ID = Convert.ToInt32(rdr["ID"]); } } tempPicID = item.ID; com2.Connection.Close(); rdr.Close(); } catch { satir = -1; } return(satir); }
private void incele1_Click(object sender, EventArgs e) { TABLO.SelectedIndex = 1; //if(sol1sag2==1) EPICTURE resim1 = resim_yolu(temp_UrunID); UrunAlPic.ImageLocation = resim1.PicDirectory; urunID.Text = temp_UrunID.ToString(); UsersID.Text = TempUsersID.Text; tempurunID1.Text = temp_UrunID.ToString(); EPRODUCT deger = BLLPRODUCT.urun_listele(temp_UrunID);//sayfa no urun_ad.Text = deger.Name; urun_fiyat.Text = deger.Price.ToString(); EUSERS deger2 = BLLUSERS.kullanici_ismi(Convert.ToInt32(UsersID.Text)); urun_sahibi.Text = "(" + deger2.Username + ") " + deger2.Name + " " + deger2.Surname; }
private void sayfalandirma(int sayfano, int solSag) { int sayfanum = sayfano; if (solSag == 1) { solSag = 2 * CategoryID - 1; } else { solSag = 2 * CategoryID; } sayfanum = sayfanum + (sayfanum - 1) * 2; EPRODUCT deger = urun_yazdir(sayfanum, solSag);//sayfa no UrunAdiArabalar1.Text = deger.Name; UrunFiyatiArabalar1.Text = deger.Price.ToString(); int UrunId = Convert.ToInt32(deger.ID); temp_UrunID = Convert.ToInt32(deger.ID); TempUsersID.Text = deger.UsersID.ToString(); EPICTURE resim1 = resim_yolu(UrunId); picAraba1.ImageLocation = resim1.PicDirectory; EPRODUCT deger2 = urun_yazdir(sayfanum + 1, solSag); UrunAdiArabalar2.Text = deger2.Name; UrunFiyatiArabalar2.Text = deger2.Price.ToString(); int UrunId2 = Convert.ToInt32(deger2.ID); temp_UrunID2 = Convert.ToInt32(deger2.ID); TempUsersID2.Text = deger2.UsersID.ToString(); EPICTURE resim2 = resim_yolu(UrunId2); picAraba2.ImageLocation = resim2.PicDirectory; }
public static EPRODUCT urun_yazdir(int a, int altCatId) { EPRODUCT Urun1 = new EPRODUCT(); try { SqlCommand com = new SqlCommand("URUN_LISTELE", FCONNECTION.conn); com.CommandType = CommandType.StoredProcedure; if (com.Connection.State != ConnectionState.Open) { com.Connection.Open(); } com.Parameters.AddWithValue("Taban", a - 1); com.Parameters.AddWithValue("altCatId", altCatId); SqlDataReader rdr = com.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { Urun1.Name = rdr["Name"].ToString(); Urun1.Price = Convert.ToInt32(rdr["Price"]); Urun1.SubCategoryID = Convert.ToInt32(rdr["SubCategoryID"]); Urun1.ID = Convert.ToInt32(rdr["ID"]); Urun1.UsersID = Convert.ToInt32(rdr["UsersID"]); //Urun1.Sold = Convert.ToInt32(rdr["Sold"]); //Urun1.Onay = Convert.ToInt32(rdr["onay"]); } } com.Connection.Close(); rdr.Close(); } catch { } return(Urun1); }
private void Uruneklebuton_Click(object sender, EventArgs e) { if (tempPicNo != 0) { EPRODUCT item = new EPRODUCT(); item.Name = urunadi.Text; item.Price = Convert.ToInt32(urunfiyati.Text); //tam buraya item.SubCategoryID = Convert.ToInt32(altkategorilist.SelectedValue); item.UsersID = UserIDNo; if (BLLPRODUCT.AddItem(item, ref tempPicID) > 1) { MessageBox.Show("Urun eklendi."); } else { MessageBox.Show("Ekleme hatasi"); } string UsersID = UserIDNo.ToString(); string resimAdi1 = UsersID + "." + tempPicID.ToString() + "." + "1"; string resimAdi2 = UsersID + "." + tempPicID.ToString() + "." + "2"; string resimAdi3 = UsersID + "." + tempPicID.ToString() + "." + "3"; string filePath1 = Application.StartupPath + "\\scan\\" + resimAdi1 + ".jpg"; string filePath2 = Application.StartupPath + "\\scan\\" + resimAdi2 + ".jpg"; string filePath3 = Application.StartupPath + "\\scan\\" + resimAdi3 + ".jpg"; if (UrunEkleResim.Image != null) { EPICTURE item2 = new EPICTURE(); item2.ProductID = tempPicID; item2.PicDirectory = filePath1; BLLPICTURE.AddPicture(item2); } if (UrunEkleResim2.Image != null) { EPICTURE item2 = new EPICTURE(); item2.ProductID = tempPicID; item2.PicDirectory = filePath2; BLLPICTURE.AddPicture(item2); } if (UrunEkleResim3.Image != null) { EPICTURE item2 = new EPICTURE(); item2.ProductID = tempPicID; item2.PicDirectory = filePath3; BLLPICTURE.AddPicture(item2); } MessageBox.Show("1"); if (UrunEkleResim.Image != null) { UrunEkleResim.Image.Save(filePath1); } if (UrunEkleResim2.Image != null) { UrunEkleResim.Image.Save(filePath2); } if (UrunEkleResim3.Image != null) { UrunEkleResim.Image.Save(filePath3); } } TabloUst.SelectedIndex = 0; }
public static int AddItem(EPRODUCT item, ref int tempPicID) { return(FPRODUCT.AddItem(item, ref tempPicID)); }