Exemplo n.º 1
0
        public static EPICTURE resim_yolu(int a)
        {
            EPICTURE item = new EPICTURE();

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

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }
                com.Parameters.AddWithValue("ProductID", a);

                SqlDataReader rdr = com.ExecuteReader();

                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        item.PicDirectory = rdr["PicDirectory"].ToString();
                    }
                }

                com.Connection.Close();
                rdr.Close();
            }
            catch
            {
            }
            return(item);
        }
Exemplo n.º 2
0
        public static int AddPicture(EPICTURE item)
        {
            int satir = -1;

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

                if (com.Connection.State != ConnectionState.Open)
                {
                    com.Connection.Open();
                }
                com.Parameters.AddWithValue("ProductID", item.ProductID);
                com.Parameters.AddWithValue("PicDirectory", item.PicDirectory);
                satir = com.ExecuteNonQuery();

                com.Connection.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;
        }
        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;
        }
Exemplo n.º 6
0
 public static int AddPicture(EPICTURE item)
 {
     return(FPICTURE.AddPicture(item));
 }