Esempio n. 1
0
        /// <summary>
        /// <remarks>Ana ve alt kategorileri Linq ile alıp Menu ve MenuItem kullanır</remarks>
        /// </summary>
        public void LeftMenuHazirla()
        {
            try
            {
                Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
                var res = from c in p.UrunKategori
                          select new { Adi = c.Adi, ID = c.AnaKategoriID };

                foreach (var item in res.ToList())
                {
                    MenuItem Ana = new MenuItem();
                    Ana.Text = item.Adi;
                    Ana.NavigateUrl = @"MainPage.aspx?KatID=" + item.ID.ToString();
                    var res1 = from c in p.UrunKategori
                               join d in p.UrunAltKategori on c.AnaKategoriID equals d.AnaKategori
                               where c.AnaKategoriID == item.ID
                               select new { ID = c.AnaKategoriID, AltKatID = d.AltKategoriID, AltKatAdi = d.Adi };
                    foreach (var altkat in res1.ToList())
                    {
                        MenuItem Alt = new MenuItem();
                        Alt.Text = altkat.AltKatAdi;
                        Alt.NavigateUrl = @"UrunListesi.aspx?KatID=" + item.ID.ToString() + "&AltKatID=" + altkat.AltKatID.ToString();
                        Ana.ChildItems.Add(Alt);
                    }

                    Menu1.Items.Add(Ana);
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
Esempio n. 2
0
        protected void LinkButton_Delete_Click(object sender, EventArgs e)
        {
            Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
            LinkButton btn = sender as LinkButton;
            string err = string.Empty;
            try
            {
                var res = p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument);
                p.Sepet.Remove((Models.Sepet)res);
                p.SaveChanges();
            }
            catch (Exception ex)
            {
                err = ex.Message;
                throw;
            }
            finally
            {
                Models.PoliklinikEntities5 _p = new Models.PoliklinikEntities5();
                if (Session["s1"] != null)
                {
                    var k = (Models.Kullanicilar)Session["s1"];
                    SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == k.KullaniciAdi).ToList();
                }
                else
                    SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == null).ToList();

                SepetList.DataBind();
                Response.Redirect("/Sepetim.aspx");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// <remarks>Ana ve alt kategorileri Linq ile alıp Menu ve MenuItem kullanır</remarks>
        /// </summary>
        public void LeftMenuHazirla()
        {
            try
            {
                Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
                var res = from c in p.UrunKategori
                          select new { Adi = c.Adi, ID = c.AnaKategoriID };

                foreach (var item in res.ToList())
                {
                    MenuItem Ana = new MenuItem();
                    Ana.Text        = item.Adi;
                    Ana.NavigateUrl = @"MainPage.aspx?KatID=" + item.ID.ToString();
                    var res1 = from c in p.UrunKategori
                               join d in p.UrunAltKategori on c.AnaKategoriID equals d.AnaKategori
                               where c.AnaKategoriID == item.ID
                               select new { ID = c.AnaKategoriID, AltKatID = d.AltKategoriID, AltKatAdi = d.Adi };
                    foreach (var altkat in res1.ToList())
                    {
                        MenuItem Alt = new MenuItem();
                        Alt.Text        = altkat.AltKatAdi;
                        Alt.NavigateUrl = @"UrunListesi.aspx?KatID=" + item.ID.ToString() + "&AltKatID=" + altkat.AltKatID.ToString();
                        Ana.ChildItems.Add(Alt);
                    }

                    Menu1.Items.Add(Ana);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
0
        protected void LinkButton_Delete_Click(object sender, EventArgs e)
        {
            Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
            LinkButton btn = sender as LinkButton;
            string     err = string.Empty;

            try
            {
                var res = p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument);
                p.Sepet.Remove((Models.Sepet)res);
                p.SaveChanges();
            }
            catch (Exception ex)
            {
                err = ex.Message;
                throw;
            }
            finally
            {
                Models.PoliklinikEntities5 _p = new Models.PoliklinikEntities5();
                if (Session["s1"] != null)
                {
                    var k = (Models.Kullanicilar)Session["s1"];
                    SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == k.KullaniciAdi).ToList();
                }
                else
                {
                    SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                }

                SepetList.DataBind();
                Response.Redirect("/Sepetim.aspx");
            }
        }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Data.DataKatmani           dk       = new Data.DataKatmani();
            Models.PoliklinikEntities5 pContent = new Models.PoliklinikEntities5();

            try
            {
                var kul       = (Models.Kullanicilar)Session["s1"];
                var res       = kul == null ? (from c in pContent.Sepet where c.KullaniciAdi == null select c) : (from c in pContent.Sepet where c.KullaniciAdi == kul.KullaniciAdi select c);
                int SepetSayi = res.ToList().Count;
                SepetimLabel.Text = "Sepetim(" + SepetSayi.ToString() + ")";
                if (!IsPostBack)
                {
                    DataList1.DataSource = dk.UrunKatListe1(ref err);
                    DataList1.DataBind();
                    if (Menu2.Items.Count < 1)
                    {
                        MenuItem ana = new MenuItem()
                        {
                            Text = "Hesabım", NavigateUrl = ""
                        };
                        List <MenuItem> alt = new List <MenuItem>()
                        {
                            new MenuItem {
                                Text = "Siparişlerim", NavigateUrl = ""
                            },
                            new MenuItem {
                                Text = "Mesajlarım", NavigateUrl = ""
                            },
                            new MenuItem {
                                Text = "Puanlarım", NavigateUrl = ""
                            },
                            new MenuItem {
                                Text = "Hızlı Öde", NavigateUrl = ""
                            },
                            new MenuItem {
                                Text = "Üyelik Bilgilerim", NavigateUrl = ""
                            },
                            new MenuItem {
                                Text = "Adreslerim", NavigateUrl = ""
                            }
                        };
                        Menu2.Items.Add(ana);
                        for (int i = 0; i < alt.Count; i++)
                        {
                            Menu2.Items[0].ChildItems.Add(alt[i]);
                        }
                        ;
                    }
                }
            }
            catch (Exception ex)
            {
                err = ex.Message;
                throw;
            }
        }
Esempio n. 6
0
        protected void LinkButton_Update_Click(object sender, EventArgs e)
        {
            Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
            LinkButton btn = sender as LinkButton;
            var        kul = (Models.Kullanicilar)Session["s1"];
            string     err = string.Empty;

            if (ControlID.Count > 0)
            {
                try
                {
                    for (int i = 0; i < ControlID.Count; i++)
                    {
                        if (int.Parse(Request.Form[ControlID[i]]) > 0 && int.Parse(Request.Form[ControlID[i]]) < 100)
                        {
                            Models.Sepet s = new Models.Sepet();
                            s.UrunSiparisAdet = int.Parse(Request.Form[ControlID[i]]);
                            var res = kul == null?p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument && x.KullaniciAdi == null) : p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument && x.KullaniciAdi == kul.KullaniciAdi);

                            res.UrunSiparisAdet = s.UrunSiparisAdet;
                            int    last = btn.UniqueID.LastIndexOf("ctl0");
                            string find = btn.UniqueID.Substring(last, 5);
                            if (ControlID[i].Contains(find))
                            {
                                p.SaveChanges();
                            }
                        }
                    }
                }
                catch (OverflowException ex)
                {
                    err = ex.Message;
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }
                finally
                {
                    Models.PoliklinikEntities5 _p = new Models.PoliklinikEntities5();
                    if (Session["s1"] != null)
                    {
                        var k = (Models.Kullanicilar)Session["s1"];
                        SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == k.KullaniciAdi).ToList();
                    }
                    else
                    {
                        SepetList.DataSource = _p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                    }
                    SepetList.DataBind();
                }
            }
        }
Esempio n. 7
0
        protected void LinkButton_Update_Click(object sender, EventArgs e)
        {
            Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
            LinkButton btn = sender as LinkButton;
            var kul = (Models.Kullanicilar)Session["s1"];
            string err = string.Empty;
            if (ControlID.Count > 0)
            {
                try
                {

                    for (int i=0;i<ControlID.Count;i++){
                        if (int.Parse(Request.Form[ControlID[i]])>0&&int.Parse(Request.Form[ControlID[i]])<100)
                        {
                            Models.Sepet s = new Models.Sepet();
                            s.UrunSiparisAdet = int.Parse(Request.Form[ControlID[i]]);
                            var res = kul == null ? p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument && x.KullaniciAdi == null) : p.Sepet.First(x => x.UrunID.ToString() == btn.CommandArgument && x.KullaniciAdi == kul.KullaniciAdi);
                            res.UrunSiparisAdet = s.UrunSiparisAdet;
                            int last=btn.UniqueID.LastIndexOf("ctl0");
                            string find = btn.UniqueID.Substring(last, 5);
                            if (ControlID[i].Contains(find))
                            p.SaveChanges(); }
                    }
                }
                catch (OverflowException ex)
                {
                    err = ex.Message;

                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }
                finally
                {
                    Models.PoliklinikEntities5 _p = new Models.PoliklinikEntities5();
                    if (Session["s1"]!=null)
                    {
                        var k = (Models.Kullanicilar)Session["s1"];
                        SepetList.DataSource = _p.Sepet.Where(x=>x.KullaniciAdi==k.KullaniciAdi).ToList();
                    }
                    else
                    SepetList.DataSource = _p.Sepet.Where(x=>x.KullaniciAdi==null).ToList();
                    SepetList.DataBind();
                }
            }
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Data.DataKatmani dk = new Data.DataKatmani();
            Models.PoliklinikEntities5 pContent = new Models.PoliklinikEntities5();

            try
            {
                var kul = (Models.Kullanicilar)Session["s1"];
                var res = kul == null ? (from c in pContent.Sepet where c.KullaniciAdi==null select c) : (from c in pContent.Sepet where c.KullaniciAdi == kul.KullaniciAdi select c);
                int SepetSayi = res.ToList().Count;
                SepetimLabel.Text = "Sepetim(" + SepetSayi.ToString() + ")";
                if (!IsPostBack)
                {

                    DataList1.DataSource = dk.UrunKatListe1(ref err);
                    DataList1.DataBind();
                    if (Menu2.Items.Count < 1)
                    {
                        MenuItem ana = new MenuItem() { Text = "Hesabım", NavigateUrl = "" };
                        List<MenuItem> alt = new List<MenuItem>() {
                        new MenuItem{ Text = "Siparişlerim", NavigateUrl = "" },
                        new MenuItem{ Text = "Mesajlarım", NavigateUrl = "" },
                        new MenuItem{ Text = "Puanlarım", NavigateUrl = "" },
                        new MenuItem{ Text = "Hızlı Öde", NavigateUrl = "" },
                        new MenuItem{ Text = "Üyelik Bilgilerim", NavigateUrl = "" },
                        new MenuItem{ Text = "Adreslerim", NavigateUrl = "" }
                        };
                        Menu2.Items.Add(ana);
                        for (int i = 0; i < alt.Count; i++)
                        {
                            Menu2.Items[0].ChildItems.Add(alt[i]);
                        };
                    }
                }

            }
            catch (Exception ex)
            {
                err = ex.Message;
                throw;
            }
        }
Esempio n. 9
0
 protected void Sehir_SelectedIndexChanged(object sender, EventArgs e)
 {
     Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
         try
         {
             Ilce.Items.Clear();
             var res = p.il_ilce.Where(x => x.il == Sehir.SelectedItem.Text);
             foreach (var item in res.ToList())
             {
                 ListItem l = new ListItem();
                 l.Text = item.ilce;
                 l.Value = item.plaka.ToString();
                 Ilce.Items.Add(l);
             }
             Ilce.DataBind();
         }
         catch (Exception ex)
         {
             err = ex.Message;
             throw;
         }
 }
Esempio n. 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LeftMenuHazirla();
            if (Session["s1"] != null)
            {
                var kul = (Models.Kullanicilar)Session["s1"];
                //lblInfo1.Text = "Hoşgeldiniz " + kul.Adi + " " + kul.Soyadi;
            }


            #region !IsPostBack
            if (!IsPostBack)
            {
                Models.PoliklinikEntities5 pContent = new Models.PoliklinikEntities5();
                var res = from c in pContent.Sepet where c.SessionID == Session.SessionID select c;
                //int SepetSayi = res.ToList().Count;
                //SepetimLabel.Text = "Sepetim(" + SepetSayi.ToString() + ")";
                Data.DataKatmani dk = new Data.DataKatmani();
                try
                {
                    if (Request.QueryString["KatID"] == null)
                    {
                        DataList1.DataSource = dk.UrunListe(1, ref err1);
                        DataList1.DataBind();
                    }
                    else
                    {
                        DataList1.DataSource = dk.UrunListe(int.Parse(Request.QueryString["KatID"]), ref err1);
                        DataList1.DataBind();
                    }
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }
            }
            #endregion
        }
Esempio n. 11
0
 protected void Sehir_SelectedIndexChanged(object sender, EventArgs e)
 {
     Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
     try
     {
         Ilce.Items.Clear();
         var res = p.il_ilce.Where(x => x.il == Sehir.SelectedItem.Text);
         foreach (var item in res.ToList())
         {
             ListItem l = new ListItem();
             l.Text  = item.ilce;
             l.Value = item.plaka.ToString();
             Ilce.Items.Add(l);
         }
         Ilce.DataBind();
     }
     catch (Exception ex)
     {
         err = ex.Message;
         throw;
     }
 }
Esempio n. 12
0
 protected void Sehir_Init(object sender, EventArgs e)
 {
     Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
     if (Sehir.Items.Count < 1)
     {
         try
         {
             var res = p.il_ilce.GroupBy(x => x.il).Select(grp => grp.FirstOrDefault());
             foreach (var item in res.ToList())
             {
                 ListItem l = new ListItem();
                 l.Text  = item.il;
                 l.Value = item.plaka.ToString();
                 Sehir.Items.Add(l);
             }
         }
         catch (Exception ex)
         {
             err = ex.Message;
             throw;
         }
     }
 }
Esempio n. 13
0
 public static List <Data.DataKatmani.BulunanMetin> MetinAra(string Metin)
 {
     using (Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5())
     {
         List <Data.DataKatmani.BulunanMetin> sonucList = new List <Data.DataKatmani.BulunanMetin>();
         var S = p.sp_MetinAra(Metin).ToList();
         ContentPlaceHolder ContentHolder;
         _default           dd = new _default();
         ListBox            list;
         ContentHolder = (ContentPlaceHolder)dd.Master.FindControl("ContentPlaceHolder1");
         list          = ContentHolder.FindControlRecursive("listboxSearch") as ListBox;
         foreach (var item in S)
         {
             Data.DataKatmani.BulunanMetin sonuc = new Data.DataKatmani.BulunanMetin();
             sonuc.UrunAdi = item.UrunAdi;
             sonuc.UrunID  = item.UrunID;
             sonucList.Add(sonuc);
             list.Items.Add(new ListItem(sonuc.UrunAdi, sonuc.UrunID.ToString()));
         }
         //l.DataBind();
         return(sonucList);
     }
 }
Esempio n. 14
0
 public static List<Data.DataKatmani.BulunanMetin> MetinAra(string Metin)
 {
     using (Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5())
     {
         List<Data.DataKatmani.BulunanMetin> sonucList = new List<Data.DataKatmani.BulunanMetin>();
         var S = p.sp_MetinAra(Metin).ToList();
         ContentPlaceHolder ContentHolder;
         _default dd=new _default();
         ListBox list;
         ContentHolder = (ContentPlaceHolder) dd.Master.FindControl("ContentPlaceHolder1");
         list =  ContentHolder.FindControlRecursive("listboxSearch") as ListBox;
         foreach (var item in S)
         {
             Data.DataKatmani.BulunanMetin sonuc = new Data.DataKatmani.BulunanMetin();
             sonuc.UrunAdi = item.UrunAdi;
             sonuc.UrunID = item.UrunID;
             sonucList.Add(sonuc);
             list.Items.Add(new ListItem(sonuc.UrunAdi, sonuc.UrunID.ToString()));
         }
         //l.DataBind();
         return sonucList;
     }
 }
Esempio n. 15
0
        protected void Sehir_Init(object sender, EventArgs e)
        {
            Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
            if (Sehir.Items.Count < 1)
            {
                try
                {
                var res = p.il_ilce.GroupBy(x => x.il).Select(grp => grp.FirstOrDefault());
                foreach (var item in res.ToList())
                {
                    ListItem l = new ListItem();
                    l.Text = item.il;
                    l.Value = item.plaka.ToString();
                    Sehir.Items.Add(l);
                }
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }

            }
        }
Esempio n. 16
0
 protected void btnTamamla_Click(object sender, EventArgs e)
 {
     //Tamamla
     try
     {
         Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5();
         Models.Siparisler s_temp=new Models.Siparisler();
         var kul=Session["s1"] as Models.Kullanicilar;
         var resSepet = p.Sepet.Where(x => x.KullaniciAdi == kul.KullaniciAdi).ToList();
         int i=0;
         s_temp.SiparisNo = Guid.NewGuid();
         s_temp.Kargo_Adi = KontrolKargo.Text;
         s_temp.KartNo = KrediKartNo;
         s_temp.KullaniciAdi = kul.KullaniciAdi;
         s_temp.SiparisTarihi = DateTime.Now;
         s_temp.Taksit_Adet = TaksitSayisi==0?"Peşin":TaksitSayisi.ToString();
         s_temp.ToplamFiyat = GenelToplam;
         s_temp.UrunID1 = (Guid)resSepet[0].UrunID;
         s_temp.UrunID1_Adet = (byte)resSepet[0].UrunSiparisAdet;
         s_temp.UrunID1_Adi = resSepet[0].UrunAdi;
         s_temp.UrunID1_Fiyat = resSepet[0].UrunFiyat;
         #region for
         for(i=2;i<=resSepet.Count;i++)
         {
             switch (i)
             {
                 case 2:
                     s_temp.UrunID2 = (Guid)resSepet[i-1].UrunID;
                     s_temp.UrunID2_Adet = (byte)resSepet[i-1].UrunSiparisAdet;
                     s_temp.UrunID2_Adi = resSepet[i-1].UrunAdi;
                     s_temp.UrunID2_Fiyat = resSepet[i-1].UrunFiyat;
                     break;
                 case 3:
                     s_temp.UrunID3 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID3_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID3_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID3_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 4:
                     s_temp.UrunID4 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID4_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID4_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID4_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 5:
                     s_temp.UrunID5 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID5_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID5_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID5_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 6:
                     s_temp.UrunID6 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID6_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID6_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID6_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 7:
                     s_temp.UrunID7 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID7_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID7_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID7_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 8:
                     s_temp.UrunID8 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID8_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID8_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID8_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 9:
                     s_temp.UrunID9 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID9_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID9_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID9_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 case 10:
                     s_temp.UrunID10 = (Guid)resSepet[i - 1].UrunID;
                     s_temp.UrunID10_Adet = (byte)resSepet[i - 1].UrunSiparisAdet;
                     s_temp.UrunID10_Adi = resSepet[i - 1].UrunAdi;
                     s_temp.UrunID10_Fiyat = resSepet[i - 1].UrunFiyat;
                     break;
                 default:
                     break;
             }
         }
         #endregion
         p.Siparisler.Add(s_temp);
         p.SaveChanges();
         string script = "alert(\"Siparişiniz başarıyla kaydedildi.\")";
         ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
     }
     catch (Exception ex)
     {
         err=ex.Message;
         string script = "alert(\""+err+" hatası oluştu.\")";
         ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
         Response.Redirect("/default.aspx");
     }
     finally
     {
         txtAdres.Dispose();
         btnAdresGuncelle.Dispose();
         rKargo.Dispose();
         rOdeme.Dispose();
         txtKrediKartNo.Dispose();
         CardOwnertmp.Dispose();
         dlistAYtmp.Dispose();
         dlistYILtmp.Dispose();
         txtCVC2.Dispose();
         lblKontrolKargo.Dispose();
         lblKontrolGenelToplam.Dispose();
         p.Dispose();
         Response.Redirect("/default.aspx");
     }
 }
Esempio n. 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*Kullanıcı girişsiz Sepet Listelenir */
            if (Request.QueryString["SepetItemID"] == null)
            {
                goto End;
            }

            /*SepeteEkle çalışır */
            Models.PoliklinikEntities5 pContext = new Models.PoliklinikEntities5();
            Data.DataKatmani           dk       = new Data.DataKatmani();
            string            err    = string.Empty;
            List <Data.Sepet> _sepet = new List <Data.Sepet>();

            Data.Sepet   _sepetTemp = new Data.Sepet();
            Models.Sepet _s         = new Models.Sepet();
            Guid         SepetGuid  = Guid.Parse(Request.QueryString["SepetItemID"].ToString());

            Models.Kullanicilar kul = new Models.Kullanicilar();
            #region !IsPostBack
            if (!IsPostBack)
            {
                try
                {
                    var res = (from c in pContext.Urunler
                               where c.UrunID == SepetGuid
                               select new { SessionID = Session.SessionID, UrunID = c.UrunID, UrunAdi = c.UrunAdi, UrunSiparisAdet = 1, UrunFiyat = c.IndirimliFiyat, ToplamFiyat = c.IndirimliFiyat * 1, UrunResmi = c.Resim1, GuncellemeTarihi = DateTime.Now });

                    foreach (var item in res)
                    {
                        if (Session["s1"] != null)
                        {
                            kul = (Models.Kullanicilar)Session["s1"];
                            _sepetTemp.KullaniciAdi = kul.KullaniciAdi;
                        }
                        _sepetTemp.SessionID        = item.SessionID;
                        _sepetTemp.UrunID           = item.UrunID;
                        _sepetTemp.UrunAdi          = item.UrunAdi;
                        _sepetTemp.UrunSiparisAdet  = item.UrunSiparisAdet;
                        _sepetTemp.UrunFiyat        = item.UrunFiyat;
                        _sepetTemp.ToplamFiyat      = item.ToplamFiyat;
                        _sepetTemp.UrunResmi        = item.UrunResmi;
                        _sepetTemp.GuncellemeTarihi = item.GuncellemeTarihi;
                    }
                    dk.SepeteEkle(_sepetTemp, ref err);
                    _sepet = dk.SepetIcerik;
                    using (Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5())
                    {
                        try
                        {
                            var varmi1 = from c in p.Sepet
                                         where c.KullaniciAdi == null && c.UrunID == SepetGuid
                                         select c;
                            var varmi2 = from c in p.Sepet
                                         where c.KullaniciAdi != null && c.KullaniciAdi == _sepetTemp.KullaniciAdi && c.UrunID == SepetGuid
                                         select c;
                            if (Session["s1"] == null && varmi1.Count() < 1)
                            {
                                _s.KullaniciAdi    = _sepetTemp.KullaniciAdi;
                                _s.SessionID       = _sepetTemp.SessionID;
                                _s.UrunID          = _sepetTemp.UrunID;
                                _s.UrunAdi         = _sepetTemp.UrunAdi;
                                _s.UrunSiparisAdet = _sepetTemp.UrunSiparisAdet;
                                _s.UrunFiyat       = _sepetTemp.UrunFiyat;
                                //ToplamFiyat otomatik hesaplaniyor
                                _s.UrunResmi        = _sepetTemp.UrunResmi;
                                _s.GuncellemeTarihi = DateTime.Now;
                                p.Sepet.Add(_s);
                                p.SaveChanges();
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                                SepetList.DataBind();
                            }
                            else if (Session["s1"] != null && varmi2.Count() < 1)
                            {
                                _s.KullaniciAdi    = _sepetTemp.KullaniciAdi;
                                _s.SessionID       = _sepetTemp.SessionID;
                                _s.UrunID          = _sepetTemp.UrunID;
                                _s.UrunAdi         = _sepetTemp.UrunAdi;
                                _s.UrunSiparisAdet = _sepetTemp.UrunSiparisAdet;
                                _s.UrunFiyat       = _sepetTemp.UrunFiyat;
                                //ToplamFiyat otomatik hesaplaniyor
                                _s.UrunResmi        = _sepetTemp.UrunResmi;
                                _s.GuncellemeTarihi = DateTime.Now;
                                p.Sepet.Add(_s);
                                p.SaveChanges();
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == kul.KullaniciAdi).ToList();
                                SepetList.DataBind();
                            }
                            if (Session["s1"] == null && varmi1.Count() > 0)
                            {
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                                SepetList.DataBind();
                            }
                            else if (Session["s1"] != null && varmi2.Count() > 0)
                            {
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == kul.KullaniciAdi).ToList();
                                SepetList.DataBind();
                            }
                        }
                        catch (DbEntityValidationException ex)
                        {
                            foreach (var eve in ex.EntityValidationErrors)
                            {
                                Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                                  eve.Entry.Entity.GetType().Name, eve.Entry.State);
                                foreach (var ve in eve.ValidationErrors)
                                {
                                    Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                                      ve.PropertyName, ve.ErrorMessage);
                                }
                            }
                            throw;
                        }
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
            #endregion
            goto End1;

End:
            /*Kullanıcı girişsiz Sepet Listelenir */
            using (Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5())
            {
                var k = (Models.Kullanicilar)Session["s1"];
                SepetList.DataSource = Session["s1"] == null?p.Sepet.Where(x => x.KullaniciAdi == null).ToList() : p.Sepet.Where(x => x.KullaniciAdi == k.KullaniciAdi).ToList();

                SepetList.DataBind();
            }
            End1 :;
        }
Esempio n. 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            /*Kullanıcı girişsiz Sepet Listelenir */
            if (Request.QueryString["SepetItemID"]==null)
            goto End;

            /*SepeteEkle çalışır */
            Models.PoliklinikEntities5 pContext = new Models.PoliklinikEntities5();
            Data.DataKatmani dk = new Data.DataKatmani();
            string err=string.Empty;
            List<Data.Sepet> _sepet = new List<Data.Sepet>();
            Data.Sepet _sepetTemp = new Data.Sepet();
            Models.Sepet _s = new Models.Sepet();
            Guid SepetGuid = Guid.Parse(Request.QueryString["SepetItemID"].ToString());
            Models.Kullanicilar kul=new Models.Kullanicilar();
            #region !IsPostBack
            if (!IsPostBack)
            {
                try
                {

                    var res = (from c in pContext.Urunler
                               where c.UrunID==SepetGuid
                               select new { SessionID=Session.SessionID, UrunID=c.UrunID, UrunAdi = c.UrunAdi, UrunSiparisAdet = 1, UrunFiyat = c.IndirimliFiyat, ToplamFiyat=c.IndirimliFiyat*1, UrunResmi = c.Resim1, GuncellemeTarihi=DateTime.Now });

                    foreach (var item in res)
                    {
                        if (Session["s1"] != null)
                        {
                            kul = (Models.Kullanicilar)Session["s1"];
                            _sepetTemp.KullaniciAdi=kul.KullaniciAdi;
                        }
                        _sepetTemp.SessionID = item.SessionID;
                        _sepetTemp.UrunID = item.UrunID;
                        _sepetTemp.UrunAdi = item.UrunAdi;
                        _sepetTemp.UrunSiparisAdet = item.UrunSiparisAdet;
                        _sepetTemp.UrunFiyat = item.UrunFiyat;
                        _sepetTemp.ToplamFiyat = item.ToplamFiyat;
                        _sepetTemp.UrunResmi = item.UrunResmi;
                        _sepetTemp.GuncellemeTarihi = item.GuncellemeTarihi;
                    }
                    dk.SepeteEkle(_sepetTemp,ref err);
                    _sepet = dk.SepetIcerik;
                    using (Models.PoliklinikEntities5 p=new Models.PoliklinikEntities5())
                    {
                        try
                        {
                            var varmi1 = from c in p.Sepet
                                  where c.KullaniciAdi == null && c.UrunID == SepetGuid
                                  select c;
                            var varmi2 = from c in p.Sepet
                                         where c.KullaniciAdi!=null && c.KullaniciAdi==_sepetTemp.KullaniciAdi && c.UrunID == SepetGuid
                                         select c;
                            if (Session["s1"] == null && varmi1.Count()<1)
                            {
                            _s.KullaniciAdi = _sepetTemp.KullaniciAdi;
                            _s.SessionID = _sepetTemp.SessionID;
                            _s.UrunID = _sepetTemp.UrunID;
                            _s.UrunAdi = _sepetTemp.UrunAdi;
                            _s.UrunSiparisAdet = _sepetTemp.UrunSiparisAdet;
                            _s.UrunFiyat = _sepetTemp.UrunFiyat;
                            //ToplamFiyat otomatik hesaplaniyor
                            _s.UrunResmi = _sepetTemp.UrunResmi;
                            _s.GuncellemeTarihi = DateTime.Now;
                            p.Sepet.Add(_s);
                            p.SaveChanges();
                            SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                            SepetList.DataBind();
                            }
                            else if (Session["s1"] != null && varmi2.Count() < 1)
                            {
                                _s.KullaniciAdi = _sepetTemp.KullaniciAdi;
                                _s.SessionID = _sepetTemp.SessionID;
                                _s.UrunID = _sepetTemp.UrunID;
                                _s.UrunAdi = _sepetTemp.UrunAdi;
                                _s.UrunSiparisAdet = _sepetTemp.UrunSiparisAdet;
                                _s.UrunFiyat = _sepetTemp.UrunFiyat;
                                //ToplamFiyat otomatik hesaplaniyor
                                _s.UrunResmi = _sepetTemp.UrunResmi;
                                _s.GuncellemeTarihi = DateTime.Now;
                                p.Sepet.Add(_s);
                                p.SaveChanges();
                                SepetList.DataSource = p.Sepet.Where(x=>x.KullaniciAdi== kul.KullaniciAdi).ToList();
                                SepetList.DataBind();
                            }
                            if (Session["s1"] == null && varmi1.Count() >0)
                            {
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == null).ToList();
                                SepetList.DataBind();
                            }
                            else if (Session["s1"] != null && varmi2.Count() >0)
                            {
                                SepetList.DataSource = p.Sepet.Where(x => x.KullaniciAdi == kul.KullaniciAdi).ToList();
                                SepetList.DataBind();
                            }

                        }
                        catch (DbEntityValidationException ex)
                        {
                            foreach (var eve in ex.EntityValidationErrors)
                            {
                                Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                    eve.Entry.Entity.GetType().Name, eve.Entry.State);
                                foreach (var ve in eve.ValidationErrors)
                                {
                                    Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                        ve.PropertyName, ve.ErrorMessage);
                                }
                            }
                            throw;
                        }

                    }

                }
                catch (Exception)
                {

                    throw;
                }

            }
            #endregion
            goto End1;

            End:
            /*Kullanıcı girişsiz Sepet Listelenir */
            using (Models.PoliklinikEntities5 p = new Models.PoliklinikEntities5())
            {
                var k = (Models.Kullanicilar)Session["s1"];
                SepetList.DataSource = Session["s1"] == null ? p.Sepet.Where(x => x.KullaniciAdi == null).ToList() : p.Sepet.Where(x => x.KullaniciAdi == k.KullaniciAdi).ToList();
                SepetList.DataBind();
            }
            End1:;
        }
Esempio n. 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LeftMenuHazirla();
            if (Session["s1"] != null)
            {

                var kul = (Models.Kullanicilar)Session["s1"];
                //lblInfo1.Text = "Hoşgeldiniz " + kul.Adi + " " + kul.Soyadi;
            }

            #region !IsPostBack
            if (!IsPostBack)
            {
                Models.PoliklinikEntities5 pContent = new Models.PoliklinikEntities5();
                var res = from c in pContent.Sepet where c.SessionID == Session.SessionID select c;
                //int SepetSayi = res.ToList().Count;
                //SepetimLabel.Text = "Sepetim(" + SepetSayi.ToString() + ")";
                Data.DataKatmani dk = new Data.DataKatmani();
                try
                {

                    if (Request.QueryString["KatID"]== null)
                    {
                        DataList1.DataSource = dk.UrunListe(1, ref err1);
                        DataList1.DataBind();

                    }
                    else
                    {
                        DataList1.DataSource = dk.UrunListe(int.Parse(Request.QueryString["KatID"]), ref err1);
                        DataList1.DataBind();

                    }
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }

            }
            #endregion
        }
Esempio n. 20
0
        protected void btnTamamla_Click(object sender, EventArgs e)
        {
            //Tamamla
            try
            {
                Models.PoliklinikEntities5 p      = new Models.PoliklinikEntities5();
                Models.Siparisler          s_temp = new Models.Siparisler();
                var kul      = Session["s1"] as Models.Kullanicilar;
                var resSepet = p.Sepet.Where(x => x.KullaniciAdi == kul.KullaniciAdi).ToList();
                int i        = 0;
                s_temp.SiparisNo     = Guid.NewGuid();
                s_temp.Kargo_Adi     = KontrolKargo.Text;
                s_temp.KartNo        = KrediKartNo;
                s_temp.KullaniciAdi  = kul.KullaniciAdi;
                s_temp.SiparisTarihi = DateTime.Now;
                s_temp.Taksit_Adet   = TaksitSayisi == 0?"Peşin":TaksitSayisi.ToString();
                s_temp.ToplamFiyat   = GenelToplam;
                s_temp.UrunID1       = (Guid)resSepet[0].UrunID;
                s_temp.UrunID1_Adet  = (byte)resSepet[0].UrunSiparisAdet;
                s_temp.UrunID1_Adi   = resSepet[0].UrunAdi;
                s_temp.UrunID1_Fiyat = resSepet[0].UrunFiyat;
                #region for
                for (i = 2; i <= resSepet.Count; i++)
                {
                    switch (i)
                    {
                    case 2:
                        s_temp.UrunID2       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID2_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID2_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID2_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 3:
                        s_temp.UrunID3       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID3_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID3_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID3_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 4:
                        s_temp.UrunID4       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID4_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID4_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID4_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 5:
                        s_temp.UrunID5       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID5_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID5_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID5_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 6:
                        s_temp.UrunID6       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID6_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID6_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID6_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 7:
                        s_temp.UrunID7       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID7_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID7_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID7_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 8:
                        s_temp.UrunID8       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID8_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID8_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID8_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 9:
                        s_temp.UrunID9       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID9_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID9_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID9_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    case 10:
                        s_temp.UrunID10       = (Guid)resSepet[i - 1].UrunID;
                        s_temp.UrunID10_Adet  = (byte)resSepet[i - 1].UrunSiparisAdet;
                        s_temp.UrunID10_Adi   = resSepet[i - 1].UrunAdi;
                        s_temp.UrunID10_Fiyat = resSepet[i - 1].UrunFiyat;
                        break;

                    default:
                        break;
                    }
                }
                #endregion
                p.Siparisler.Add(s_temp);
                p.SaveChanges();
                string script = "alert(\"Siparişiniz başarıyla kaydedildi.\")";
                ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
            }
            catch (Exception ex)
            {
                err = ex.Message;
                string script = "alert(\"" + err + " hatası oluştu.\")";
                ScriptManager.RegisterStartupScript(this, GetType(), "ServerControlScript", script, true);
                Response.Redirect("/default.aspx");
            }
            finally
            {
                txtAdres.Dispose();
                btnAdresGuncelle.Dispose();
                rKargo.Dispose();
                rOdeme.Dispose();
                txtKrediKartNo.Dispose();
                CardOwnertmp.Dispose();
                dlistAYtmp.Dispose();
                dlistYILtmp.Dispose();
                txtCVC2.Dispose();
                lblKontrolKargo.Dispose();
                lblKontrolGenelToplam.Dispose();
                p.Dispose();
                Response.Redirect("/default.aspx");
            }
        }