Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Data.DataKatmani dk = new Data.DataKatmani();
         try
         {
             DataList3.DataSource = dk.UrunListe(int.Parse(Request.QueryString["AltKatID"]), ref err1);
             DataList3.DataBind();
         }
         catch (Exception ex)
         {
             err = ex.Message;
             throw;
         }
     }
 }
Ejemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Data.DataKatmani dk = new Data.DataKatmani();
         try
         {
             Repeater1.DataSource = dk.UrunKatListe1(ref err);
             Repeater1.DataBind();
         }
         catch (Exception ex)
         {
             err = ex.Message;
             throw;
         }
     }
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data.DataKatmani dk=new Data.DataKatmani();
                try
                {
                    Repeater1.DataSource = dk.UrunKatListe1(ref err);
                    Repeater1.DataBind();
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                    throw;
                }

            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Data.DataKatmani dk = new Data.DataKatmani();
                try
                {

                    DataList3.DataSource = dk.UrunListe(int.Parse(Request.QueryString["AltKatID"]),ref err1);
                    DataList3.DataBind();
                }
                catch (Exception ex)
                {
                    err = ex.Message;
                   throw;
                }

            }
        }
Ejemplo n.º 6
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;
            }
        }
Ejemplo n.º 7
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
        }
Ejemplo n.º 8
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
        }
Ejemplo n.º 9
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:;
        }
Ejemplo n.º 10
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 :;
        }