Example #1
0
    protected void rptView_ItemCommand(object source, RepeaterCommandEventArgs e)
    {   // ÜRÜNÜ DEPODAN KALDIRIR
        if (e.CommandName == "Delete")
        {
            int pID = Convert.ToInt32(e.CommandArgument); // Tıklanılan satırdaki ürünün productid'sini çeker.

            proxy = new ServiceReference1.ServiceClient();

            bool check = proxy.DeleteProduct(pID);
            rptView.DataSource = proxy.GetProduct();
            rptView.DataBind();
        }
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null) // Oturum hala açık mı diye kontrol ediyor.
        {
            Response.Redirect("Login.aspx");
        }
        proxy = new ServiceReference1.ServiceClient();

        if (!IsPostBack) //Sayfa ilk defa mı yüklendi yoksa yenilendi mi diye kontrol ediyor.
        {
            var result = proxy.GetProduct();
            rptProduct.DataSource = result.Where(x => x.stoch > 0).ToList();
            rptProduct.DataBind();
        }
    }
Example #3
0
    protected void btnFilter_Click(object sender, EventArgs e)
    {     // Kullanıcın  TextBox ile brand(marka) veya pname(ürün) üzerinde arama yaparak ürünlerin filtrelenmesini sağlar
        if (TextBox5.Text != "")
        { //TextBox'ın içi boş ise filtre yapmadan bütün ürünleri listeler
            proxy = new ServiceReference1.ServiceClient();

            rptView.DataSource = proxy.GetProductFilter(TextBox5.Text.ToString());
            rptView.DataBind();
        }
        else
        {
            rptView.DataSource = proxy.GetProduct();
            rptView.DataBind();
        }
    }
Example #4
0
    protected void rptProduct_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "AddHamper")  // Ekleme işlemi
        {
            try
            {
                proxy = new ServiceReference1.ServiceClient();

                int line  = (e.Item.ItemIndex);                                                                 // Tıkladığımız satırı çekiyoruz.
                int count = Convert.ToInt32(((rptProduct.Items[line].FindControl("txtAdet")) as TextBox).Text); // Kullanıcın seçtiği adeti algılıyoruz.
                if (count < 1 || count == 0)
                {
                    count = 1;
                }                                           // Eğer kişi kendi isteğiyle ürün adedini 1'in altında seçmesi durumunda; seçilen ürün adedi otomatik olarak 1 algılanır.

                ServiceReference1.hampers objcust =
                    new ServiceReference1.hampers()
                {
                    userid    = Convert.ToInt32(Session["UserID"]),
                    productid = Convert.ToInt32(e.CommandArgument),
                    quantity  = count,
                    date      = DateTime.Now
                };
                Boolean control = proxy.UpdateHampers(objcust);

                var result = proxy.GetProduct();
                rptProduct.DataSource = result.Where(x => x.stoch > 0).ToList();
                rptProduct.DataBind();
                //Pop-Up
                if (control == true)
                { // olumlu sonuç ürünün stoklarımızda mevcut olduğunu ve seçimin onaylandığını gösteriyor.
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", $"alert('Sepete {count} adet ürün eklendi.')", true);

                    proxy.WriteDebugLogInfo(DateTime.Now.ToString() + "  userid = " + Session["UserID"].ToString() + " , pid =" + Convert.ToInt32(e.CommandArgument) + "  üründen  " + count + "  adet sepete ekledi.");
                }
                else // stoklar yetersiz
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('İsteğinizi şuanda gerçekleştiremiyoruz.Lütfen seçtiğiniz ürünün adedini düşürünüz.')", true);
                }
            }
            catch (Exception)
            {
                Response.Write("Sepete Eklenemedi");
            }
        }
    }
Example #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Convert.ToInt32(Session["RoleID"]) != 1)
     {
         Response.Redirect("HomePage.aspx");
     }
     if (Session["User"] == null) // Oturum hala açık mı diye kontrol ediyor.
     {
         Response.Redirect("Login.aspx");
     }
     proxy = new ServiceReference1.ServiceClient();
     if (!IsPostBack) // Sayfa ilk defa mı yüklendi yoksa yenilendi mi diye kontrol ediyor.
     {
         rptView.DataSource = proxy.GetProduct();
         rptView.DataBind();
     }
 }
Example #6
0
    protected void btnUrunEkle_Click(object sender, EventArgs e)
    {                                    // YENİ ÜRÜN KAYDI YAPILIYOR
        if (UploadTest.HasFile == false) //  GÖRSEL SEÇİLMEDİ İSE HATA VERİYOR.
        {
            // No file uploaded!
            Label1.Text = "Ürün için uygun bir görsel giriniz.";
        }
        else
        {
            try
            {
                proxy = new ServiceReference1.ServiceClient();
                ServiceReference1.product objcust =                                 //EKLENECEK ÜRÜNÜ TANIMLIYOR
                                                    new ServiceReference1.product() //EKLENECEK ÜRÜNÜ TANIMLIYOR
                {                                                                   //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    pname   = TextBox1.Text,                                        //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    brand   = TextBox2.Text,                                        //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    comment = TextBox3.Text,                                        //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    price   = Convert.ToDouble(TextBox4.Text),                      //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    pimage  = UploadTest.FileName,                                  //EKLENECEK ÜRÜNÜ TANIMLIYOR
                    stoch   = Convert.ToInt32(TextBox6.Text)                        //EKLENECEK ÜRÜNÜ TANIMLIYOR
                };
                proxy.InsertProduct(objcust);                                       // ÜRÜNÜ EKLİYOR

                ClearTextBoxes(this);                                               // Sayfa içindeki TextBoxları temizliyor.
                rptView.DataSource = proxy.GetProduct();
                rptView.DataBind();
                Label1.Text = "Ürün depoya eklenmiştir.";
            }
            catch (Exception)
            {
                Label1.Text = "Ürün kaydı oluşturulamamıştır. Lütfen girmiş olduğunuz bilgileri kontrol ediniz.";
                //throw;
            }
        }
    }