コード例 #1
0
        public ActionResult Login2(CustomerLogin cus)
        {
            dm = new SeyahatIstanbulEntities();
            int durum = -2;
            try
            {
                Customer find = (from c in dm.Customer
                                 where c.chEmail == cus.chEmail
                                   && c.chPassword == cus.chPassword
                                 select c).FirstOrDefault();
                if (find != null)
                {
                    Session["kId"] = find.sqCustomerId;
                    Session["kAdSoyad"] = find.chName + " " + find.chSurname;
                    durum = 1;
                    return Json(durum, JsonRequestBehavior.AllowGet);
                }
                else
                {
                    durum = 0;
                    return Json(durum, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception)
            {

                return Json(durum, JsonRequestBehavior.AllowGet);
            }
        }
コード例 #2
0
        //private List<Images> loadImageList()
        //{
        //    dm = new SeyahatIstanbulEntities();

        //    //ViewBag.HomeList = (from ra in dm.RentApart
        //    //                     where ra.blStatus == true
        //    //                     select ra).ToList();


        //    List<Images> imageList_ = (from img in dm.Images
        //                               from ra in dm.RentApart
        //                               where
        //                                img.rfCategory == 2 // apart
        //                                && img.rfDestination == ra.sqRentApartId
        //                               select img).Distinct().ToList();

        //    ViewBag.ImageList = imageList_;
        //    return imageList_;
        //}
        private List<ApartList> loadApartList()
        {
            List<ApartList> apartList = new List<ApartList>();
            List<ApartList> sApartList = new List<ApartList>();
            dm = new SeyahatIstanbulEntities();
            var ApartList_ = (from ra in dm.RentApart
                              from c in dm.County
                              where ra.blStatus == true
                                 && ra.rfCountyId == c.sqCountyId
                              select new
                              {
                                  ApartId = ra.sqRentApartId,
                                  Roomsize = ra.dgRoomSize,
                                  Properties = ra.chProperties,
                                  Countyy = c.chCountyName,
                                  Desc = ra.chDesc,
                                  Adres = ra.chAddress,
                                  blSlider = ra.blDisplaySlider,
                                  imageRotute = ra.chImageName,
                              }).Distinct().ToList();

            foreach (var item in ApartList_)
            {
                List<Price> pList = (from p in dm.Price
                                     where p.rfCategoryId == 1
                                        && p.rfProductId == item.ApartId
                                        && p.blStatus == true
                                     select p).OrderBy(d => d.dgDay).ToList();

                ApartList Apart = new ApartList();

                Apart.dgApartId = item.ApartId;
                Apart.chAdress = item.Adres;
                Apart.dgRoomSize = Convert.ToInt32(item.Roomsize);
                Apart.chProperties = item.Properties;
                Apart.chDesc = item.Desc;
                Apart.chCounty = item.Countyy;
                Apart.chImageRoute_1 = item.imageRotute + "_1.jpg";
                Apart.chImageRoute_2 = item.imageRotute + "_2.jpg";
                Apart.chImageRoute_3 = item.imageRotute + "_3.jpg";
                Apart.chFulName = item.imageRotute;
                Apart.chPrice_1_7 = pList[0].dgValue.ToString();
                Apart.chPrice_8_15 = pList[1].dgValue.ToString() + " TL";
                Apart.chPrice_16_24 = pList[2].dgValue.ToString() + " TL";
                Apart.chPrice_25 = pList[3].dgValue.ToString() + " TL";
                Apart.imageList = (from img in dm.Images
                                           where img.rfCategory == 2 // apart
                                              && img.rfDestination == item.ApartId
                                           select img).Distinct().ToList();

                apartList.Add(Apart);
            }

            ViewBag.ApartList = apartList;

            return apartList;
        }
コード例 #3
0
        private List<TourList> loadTourList()
        {
            List<TourList> TourList = new List<TourList>();
            List<TourList> sTourList = new List<TourList>();
            dm = new SeyahatIstanbulEntities();
            var v_TourList = (from t in dm.Tour
                               where t.blStatus == true
                               select new
                               {
                                   TourId = t.sqTourId,
                                   fulName = t.chImageName,
                                   Place =t.chPlaces,
                                   Startplace =t.chStartPlace,
                                   EndPlace=t.chEndPlace,
                                   PeopleCount=t.chPersonCount,
                                   Desc =t.chDesc,
                                   ImageRoute = t.chImageName,
                                   blSlider = t.blDisplaySlider,
                                   property = t.chProperties
                               }).Distinct().ToList();

            foreach (var item in v_TourList)
            {
                List<Price> pList = (from p in dm.Price
                                     where p.rfCategoryId == 3
                                        && p.rfProductId == item.TourId
                                        && p.blStatus == true
                                     select p).OrderBy(d => d.dgDay).ToList();


                TourList Tours = new TourList();

                Tours.dgTourId = item.TourId;
                Tours.chFulName = item.fulName;
                Tours.chPlaces = item.Place;
                Tours.chStartPlace = item.Startplace;
                Tours.chEndPlace = item.EndPlace;
                Tours.dgPeopleCount = Convert.ToInt32(item.PeopleCount);
                Tours.chDesc = item.Desc;
                Tours.chImageRoute_1 = item.ImageRoute + "_1.jpg";
                Tours.chImageRoute_2 = item.ImageRoute + "_2.jpg";
                Tours.chImageRoute_3 = item.ImageRoute + "_3.jpg";
                Tours.chPrice_1_7 = pList[0].dgValue.ToString();
                Tours.chPrice_8_15 = pList[1].dgValue.ToString() + " TL";
                Tours.chPrice_16_24 = pList[2].dgValue.ToString() + " TL";
                Tours.chPrice_25 = pList[3].dgValue.ToString() + " TL";


                TourList.Add(Tours);
            }

            ViewBag.TourList = TourList;

            return TourList;
        }
コード例 #4
0
        public ActionResult Booking(HomePageModel data)
        {
            #region queryString kontrolü

            string catguid = Request.QueryString["cat"];
            string prod_ = Request.QueryString["prod"];

            ErrorLog error = new ErrorLog();
            dm = new SeyahatIstanbulEntities();

            if (Session["kId"] == null)
            {
                error.dgErrorCode = 1;
                error.chError = "Üye girişi yapılmadan rezarvasyon yapılmaya çalışılıyor";
                error.chPageName = "Booking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return RedirectToAction("Index", "Home");
            }
            else if (catguid == "" || prod_ == "")
            {
                error.dgErrorCode = 1;
                error.chError = "Doğru linkle giriş yapılmıyor";
                error.chPageName = "Booking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return RedirectToAction("Index", "Home");
            }

            #endregion

            #region category ve productId



            Category cat = (from c in dm.Category
                            where 1 == 1
                               && c.blStatus == true
                               && c.chGuid == catguid
                            select c).SingleOrDefault();

            if (cat == null)
                return RedirectToAction("Index", "Home");
            else
                return RedirectToAction(cat.chUrl, new { prod = prod_ });

            #endregion

        }
コード例 #5
0
        public ActionResult Vehicle()
        {
            string prod_ = Request.QueryString["prod"];
            ErrorLog error = new ErrorLog();
            dm = new SeyahatIstanbulEntities();

            if (Session["kId"] == null)
            {
                error.dgErrorCode = 1;
                error.chError = "Üye girişi yapılmadan rezarvasyon yapılmaya çalışılıyor";
                error.chPageName = "Vehicle/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return RedirectToAction("Index", "Home");
            }
            else if (prod_ == "")
            {
                error.dgErrorCode = 1;
                error.chError = "Doğru linkle giriş yapılmıyor";
                error.chPageName = "Booking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return RedirectToAction("Index", "Home");
            }
            int prod;
            try
            {
                prod = Convert.ToInt32(prod_);
            }
            catch (Exception)
            {

                throw;
            }

            SettingController set = new SettingController();
            List<VehicleList> vehicleList = set.loadVehicleList().Where(d => d.dgVehicleId == prod).ToList();

            ViewBag.Clock = set.ddClock();
            ViewBag.TabVehicleList = set.ddVehicleList();
            ViewBag.VehicleDeliveryPlace = set.ddVehicleDeliveryPlace();


            ViewBag.VehicleList = vehicleList;

            return View();
        }
コード例 #6
0
        public void loadTabVehicleList()
        {
            dm = new SeyahatIstanbulEntities();
            SelectList selectList = new SelectList((from m in dm.Model
                                                    from b in dm.Brand
                                                    from rv in dm.RentVehicle
                                                    where m.blStatus == true
                                                       && b.blStatus == true
                                                       && rv.blStatus == true
                                                       && b.sqBrandId == m.rfBrandId
                                                    select new { Value = m.sqModelId, Text = b.chValue + " " + m.chValue + " ( " + rv.chModelYear + " model ) " }).Distinct(), "Value", "Text");

            ViewBag.TabVehicleList = selectList;

        }
コード例 #7
0
        public void slider()
        {
            List<SliderList> sliderList = new List<SliderList>();
            dm = new SeyahatIstanbulEntities();
            var vehicleList_ = (from rv in dm.RentVehicle
                                from m in dm.Model
                                from b in dm.Brand
                                where rv.blStatus == true
                                  && rv.rfModelId == m.sqModelId
                                  && m.rfBrandId == b.sqBrandId
                                  && rv.blDisplaySlider == true
                                select new { imageRotute = rv.chImageName }).Distinct().ToList();

            int t = 0;
            for (int i = 0; i < 7; i++)
            {
                SliderList slider = new SliderList();
                switch (i)
                {
                    case 2:
                        slider.imageRoute_1 = "Content/img/RentApart/apart_4_1.jpg";
                        slider.imageRoute_2 = "Content/img/RentApart/apart_4_3.jpg";
                        break;
                    case 5:
                        slider.imageRoute_1 = "Content/img/Renttur/tur_1_1.jpg";
                        slider.imageRoute_2 = "Content/img/Renttur/tur_1_2.jpg";
                        break;
                    default:
                        slider.imageRoute_1 = "Content/img/RentVehicle/" + vehicleList_[t].imageRotute + "_1.jpg";
                        slider.imageRoute_2 = "Content/img/RentVehicle/" + vehicleList_[t].imageRotute + "_3.jpg";
                        t++;
                        break;
                }
                sliderList.Add(slider);
            }

            ViewBag.sliderList = sliderList;


        }
コード例 #8
0
        public ActionResult ForgotPassword(CustomerLogin cus)
        {
            int durum = 0;
            try
            {
                dm = new SeyahatIstanbulEntities();

                Customer customer = (from c in dm.Customer
                                 where c.chEmail == cus.chEmail
                                 select c).FirstOrDefault();
                if (customer !=null)
                {
                    MailMessage mail = new MailMessage();
                    mail.To.Add(cus.chEmail);
                    mail.From = new MailAddress("*****@*****.**");
                    mail.Subject = "Şifre Hatırlatma";
                    //string Body = @"<div> Sayın "+customer.chName+" "+customer.chSurname+", </br></br>"+ "Şifreniz : " +customer.chPassword +"</div>";
                    string Body = @"<!DOCTYPE html>
                                    <html>
                                    <head>
                                        <title></title>
                                        <meta http-equiv=content-type content=text/html;charset =iso-8859-9>
                                        <meta http-equiv=content-type content=text/html;charset =windows-1254>
                                    </head>"
                                    +"<body style=\"padding: 40px;\">"
                                        +"<div style=\"color: #494848; padding: 20px; font-size: 16px; font-family: Arial, Helvetica, sans-serif; width: 600px; height: 450px; border: #000000 solid 2px; border-radius: 4px; background-image: linear-gradient(to right, #c4baba 0%, #f7f9fb 100%);\">"
                                            +"<div style=\"height: 80px; width: 180px; margin-left:auto;margin-right:auto; border-radius:4px; background-repeat:no-repeat; background-image: url('ftp://seyahatistanbul.com/www/Content/img/logo/logo.fw.png')\"></div>"

                                            +"<div style=\" margin-left:-20px; font-family: Trebuchet MS; font-size: 18px; font-weight: bold; line-height: 40px; padding-left: 20px; border-radius: 4px; background-image: linear-gradient(to right, #2D5A84 0%, #5F9FD8 100%); width: 500px; height: 40px; color: #ffffff; \">Şifre Hatırlatma Talebi</div>"

                                            +"<p>Sayın "+customer.chName+ " " +customer.chSurname+" ,</p>"

                                            +"<p>"
                                                +"Şifreniz : "+customer.chPassword
                                            +"</p>"

                                            +"<div style=\"color:#808080\">"
                                                +"<p>"
                                                    +"Bu e-posta seyahatistanbul.com üzerinden şifre yardımı servisi tarafından gönderilmektedir."
                                                +"</p>"
                                                +"<p> Seyahat İstanbu'u tercih ettiğiniz için teşekkür ederiz.</p>"
                                                +"<p>"
                                                    +"<a style=\"color:#000000;\" href=\"http://www.seyahatistanbul.com/\"> www.seyahatistanbul.com</a>"
                                                +@"</p>
                                            </div>
                                        </div>
                                    </body>
                                    </html>";
                    mail.Body = Body;
                    mail.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = "mail.seyahatistanbul.com";
                    smtp.Port = 587;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials = new System.Net.NetworkCredential
                    ("*****@*****.**", "seyahatIstanbul34");
                    smtp.EnableSsl = false;
                    smtp.Send(mail);

                    return Json(durum, JsonRequestBehavior.AllowGet);

                }
                
            }
            catch (Exception ex)
            {

                durum = -2;
            }
            return Json(durum, JsonRequestBehavior.AllowGet);
        }
コード例 #9
0
        public SelectList ddApart()
        {
            dm = new SeyahatIstanbulEntities();

            SelectList selectList = new SelectList(from r in dm.RentApart
                                                   from c in dm.County
                                                   where r.blStatus == true
                                                      && r.rfCountyId == c.sqCountyId
                                                   select new { Value = r.sqRentApartId, Text = c.chCountyName + " - " + r.chAddress.Substring(0, 20) + "... ( " + r.chProperties + " )" }, "Value", "Text");

            return selectList;
        }
コード例 #10
0
        public void loadVehicleDeliveryPlace()
        {
            dm = new SeyahatIstanbulEntities();
            SelectList selectList = new SelectList(from d in dm.Address
                                                   where d.blStatus == true && d.rfAddressTypeId == 3
                                                   select new { Value = d.sqAddressId, Text = d.chValue }, "Value", "Text");

            ViewBag.VehicleDeliveryPlace = selectList;

        }
コード例 #11
0
        public void loadTour()
        {
            dm = new SeyahatIstanbulEntities();
            SelectList selectList = new SelectList(from d in dm.Tour
                                                   where d.blStatus == true
                                                   select new { Value = d.sqTourId, Text = d.chPlaces }, "Value", "Text");

            ViewBag.TabTourList = selectList;
        }
コード例 #12
0
        public List<TourList> loadTourList(int sqTourId)
        {
            List<TourList> tourList = new List<TourList>();
            dm = new SeyahatIstanbulEntities();

            var TourList_ = (from t in dm.Tour
                             where t.blStatus == true
                                && t.sqTourId == sqTourId
                             select new
                             {
                                 dgTourId = t.sqTourId,
                                 chFulName = t.chDesc,
                                 chPlaces = t.chPlaces,
                                 dgPeopleCount = t.chPersonCount,
                                 chStartPlace = t.chStartPlace,
                                 chEndPlace = t.chEndPlace,
                                 chDesc = t.chDesc,
                                 chImageRoute = t.chImageName
                             }).Distinct().ToList();

            foreach (var item in TourList_)
            {
                List<Price> pList = (from p in dm.Price
                                     where p.rfCategoryId == 1
                                        && p.rfProductId == item.dgTourId
                                        && p.blStatus == true
                                     select p).OrderBy(d => d.dgDay).ToList();

                TourList tour = new TourList();

                tour.dgTourId = item.dgTourId;
                tour.chPlaces = item.chPlaces;
                tour.dgPeopleCount = Convert.ToInt32(item.dgPeopleCount);
                tour.chStartPlace = item.chStartPlace;
                tour.chEndPlace = item.chEndPlace;
                tour.chDesc = item.chDesc;
                tour.chImageRoute_1 = item.chImageRoute + "_1.jpg";
                tour.chImageRoute_2 = item.chImageRoute + "_2.jpg";
                tour.chImageRoute_3 = item.chImageRoute + "_3.jpg";
                tour.chPrice_1_7 = pList[0].dgValue.ToString();
                tour.chPrice_8_15 = pList[1].dgValue.ToString() + " TL";
                tour.chPrice_16_24 = pList[2].dgValue.ToString() + " TL";
                tour.chPrice_25 = pList[3].dgValue.ToString() + " TL";

                tour.imageList = (from img in dm.Images
                                  where img.rfCategory == 2 // apart
                                     && img.rfDestination == item.dgTourId
                                  select img).Distinct().ToList();

                tourList.Add(tour);
            }

            return tourList;
        }
コード例 #13
0
        public ActionResult Register(Customer cus)
        {
            int durum = -2;
            //return Json(durum, JsonRequestBehavior.AllowGet);
            if (ModelState.IsValid)
            {
                try
                {
                    dm = new SeyahatIstanbulEntities();

                    var find = (from c in dm.Customer
                                where c.chEmail == cus.chEmail
                                select c).ToList();
                    if (find.Count != 0)
                    {
                        durum = -1;
                        return Json(durum, JsonRequestBehavior.AllowGet);
                    }
                    cus.cdCreator = "İnternet";
                    cus.dtCreated = DateTime.Now;
                    dm.Customer.Add(cus);
                    dm.SaveChanges();
                    durum = 1;
                    Session["kId"] = (from c in dm.Customer
                                      where c.chEmail == cus.chEmail
                                      select new { id = c.sqCustomerId }).FirstOrDefault().ToString();
                    Session["kAdSoyad"] = cus.chName + " " + cus.chSurname;
                }
                catch (Exception)
                {

                    durum = -2;
                }

                return Json(durum, JsonRequestBehavior.AllowGet);
            }
            return Json(durum, JsonRequestBehavior.AllowGet);
        }
コード例 #14
0
        public List<BookingList> loadVehicleList()
        {
            dm = new SeyahatIstanbulEntities();

            int kId = 1;//Convert.ToInt32(Session["kId"].ToString());
            int prodId;

            List<BookingList> bookingList = new List<BookingList>();
            BookingList booking;

            SettingController set = new SettingController();

            var procesesList = (from p in dm.Process
                                where 1 == 1
                                   && p.blStatus == true //yönetici tarafından silinmiş olabilir
                                   && (p.rfStatusId == 1 || p.rfStatusId == 2 || p.rfStatusId == 3)
                                   && p.dtStartDate >= DateTime.Now
                                   && p.rfCustomerId == kId
                                select p).ToList().OrderByDescending(d => d.dtStartDate);


            foreach (var item in procesesList)
            {
                #region Araç
                prodId = Convert.ToInt32(item.rfProductId);

                if (item.rfCategoryId == 1)
                {
                    List<VehicleList> vehicleList = set.loadVehicleList(prodId);
                    VehicleList vh = vehicleList[0];

                    string place1 = (from p in dm.Address
                                     where 1 == 1
                                        && p.rfAddressTypeId == 3 //araç teslim adresi
                                        && p.sqAddressId == item.rfDeliveryPlace_1
                                     select p.chValue).ToString();

                    string place2 = (from p in dm.Address
                                     where 1 == 1
                                        && p.rfAddressTypeId == 3 //araç teslim adresi
                                        && p.sqAddressId == item.rfDeliveryPlace_2
                                     select p.chValue).ToString();

                    string chDurum_ = (from ps in dm.ProcessStatus
                                       where 1 == 1
                                          && ps.sqProcessStatusId == item.rfStatusId
                                       select ps.chValue).ToString();

                    booking = new BookingList
                    {
                        rfCategoryId = 1,
                        rfProductId = vh.dgVehicleId,
                        sqProcessId = item.sqProcessId,
                        chImageName = "~/Content/img/RentVehicle/" + vh.chImageRoute_2,
                        chProductName = vh.chBrand + " " + vh.chModel + " " + vh.chModelYear,
                        dgTotalPrice = Convert.ToInt32(item.dgPrice),
                        chDeliveryPlace_1 = place1,
                        chDeliveryPlace_2 = place2,
                        dgDurum = Convert.ToInt32(item.rfStatusId),
                        chDurum = chDurum_,
                        dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14),
                        dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14),
                        dtCreated = Convert.ToDateTime(item.dtCreated),
                        imageList = vh.imageList

                    };

                    bookingList.Add(booking);




                }
                #endregion
                #region Apart
                if (item.rfCategoryId == 2)
                {
                    List<ApartList> apartList = set.loadApartList(prodId);

                    string chDurum_ = (from ps in dm.ProcessStatus
                                       where 1 == 1
                                          && ps.sqProcessStatusId == item.rfStatusId
                                       select ps.chValue).ToString();



                    foreach (var item2 in apartList)
                    {
                        booking = new BookingList
                        {
                            rfCategoryId = 2,
                            rfProductId = item2.dgApartId,
                            sqProcessId = item.sqProcessId,
                            chProductName = item2.chFulName,
                            dgTotalPrice = Convert.ToInt32(item.dgPrice),
                            chDeliveryPlace_1 = item2.chAdress,
                            dgDurum = Convert.ToInt32(item.rfStatusId),
                            chDurum = chDurum_,
                            dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14),
                            dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14),
                            dtCreated = Convert.ToDateTime(item.dtCreated)
                        };

                        bookingList.Add(booking);

                    }


                }
                #endregion
                #region Tour
                if (item.rfCategoryId == 3)
                {
                    List<TourList> tourList = set.loadTourList(prodId);

                    string chDurum_ = (from ps in dm.ProcessStatus
                                       where 1 == 1
                                          && ps.sqProcessStatusId == item.rfStatusId
                                       select ps.chValue).ToString();



                    foreach (var item2 in tourList)
                    {
                        booking = new BookingList
                        {
                            rfCategoryId = 2,
                            rfProductId = item2.dgTourId,
                            sqProcessId = item.sqProcessId,
                            chProductName = item2.chFulName,
                            dgTotalPrice = Convert.ToInt32(item.dgPrice),
                            chDeliveryPlace_1 = item2.chPlaces,
                            dgDurum = Convert.ToInt32(item.rfStatusId),
                            chDurum = chDurum_,
                            dtStartDate = Convert.ToDateTime(item.dtStartDate).ToString().Substring(0, 14),
                            dtEndDate = Convert.ToDateTime(item.dtEndDate).ToString().Substring(0, 14),
                            dtCreated = Convert.ToDateTime(item.dtCreated)
                        };

                        bookingList.Add(booking);

                    }


                }
                #endregion


            }


            return bookingList;

            //araçlar için yaptığı rezervayon


        }
コード例 #15
0
        public ActionResult TourBooking(HomePageModel data)
        {
            dm = new SeyahatIstanbulEntities();
            ErrorLog error = new ErrorLog();

            //kullanıcı kontrol
            if (Session["kId"] == null)
            {
                error.dgErrorCode = 1;
                error.chError = "Üye girişi yaplısınız";
                error.chPageName = "VehicleBooking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return Json(error, JsonRequestBehavior.AllowGet);
            }
            int cusId = Convert.ToInt32(Session["kId"]);

            #region ekrandan alınan bilgiler

            DateTime startDate = new DateTime();
            Int16 catId = 3;
            int prodId = 0;
            string c_1 = "";

            try
            {
                c_1 = data.tourCloock_1;
                startDate = Convert.ToDateTime(data.dtTourDate + " " + c_1);
                prodId = Convert.ToInt32(data.rfTourId);
            }
            catch (Exception)
            {
                error.dgErrorCode = 2;
                error.chError = "Alanlar boş geçilemez";
                error.chPageName = "TourBooking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return Json(error, JsonRequestBehavior.AllowGet);
            }
            #endregion
            #region bilgi kontrolleri
            if (startDate < DateTime.Now)
            {
                error.dgErrorCode = 3;
                error.chError = "Seçilen tarih şuan tarihten küçük olamaz";
                error.chPageName = "TourBooking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return Json(error, JsonRequestBehavior.AllowGet);
            }
            #endregion

            List<Process> processList = (from p in dm.Process
                                         where p.rfCustomerId == cusId
                                            && p.blStatus == true
                                            && (p.rfStatusId == 1 || p.rfStatusId == 2)
                                         select p).ToList();
            Customer customer = (from c in dm.Customer
                                 where c.sqCustomerId == cusId
                                 select c).SingleOrDefault();

            #region 1-> Müşteri krumsal değilse rezarvasyonda çakışan tarih var mı?
            List<Process> cakisanRezarvasyon = processList.Where(d => d.rfCategoryId == 3 && d.dtStartDate == startDate).ToList();

            if (cakisanRezarvasyon.Count() != 0 && customer.rfCustomerTypeId != 3)
            {
                error.dgErrorCode = 5;
                error.chError = "<p style=\"text-align:Justify;\"> Çakışan rezarvasyonunuz var.! <br /><br />" + String.Format("{0:dd.MM.yyyy}", cakisanRezarvasyon[0].dtStartDate) + " tarihinde yaptığınız rezarvasyonun ödemesini yaptıktan sonra başka rezarvasyon yapabilirsiniz </p> ";
                error.chPageName = "ApartBooking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return Json(error, JsonRequestBehavior.AllowGet);

            }
            #endregion
            #region 2-> 3'ten fazla rezarvayon var mı
            if (processList.Count() >= 3 && customer.rfCustomerTypeId != 3)
            {
                error.dgErrorCode = 6;
                error.chError = "Ödeme yapmadan 3 ten fazla rezarvasyon yapamazsınız";
                error.chPageName = "VehicleBooking/BookingController";
                error.dtCreated = DateTime.Now;
                error.chIpAddress = Request.UserHostAddress;
                dm.ErrorLog.Add(error);
                dm.SaveChanges();
                return Json(error, JsonRequestBehavior.AllowGet);
            }
            #endregion

            Price price = (from p in dm.Price
                           where p.rfCategoryId == catId
                              && p.rfProductId == prodId
                              && p.blStatus == true
                           select p).OrderByDescending(d => d.dtCreated).FirstOrDefault();//hatalı olarak iki fiyat olsda en son eklenen alınacak

            int totalPrice = Convert.ToInt32(price.dgValue);

            int processStatus;
            if (customer.rfCustomerTypeId == 1)
                processStatus = 1;
            else
                processStatus = 2;

            Process process = new Process()
            {
                rfCategoryId = catId,
                rfProductId = prodId,
                rfCustomerId = cusId,
                dtStartDate = Convert.ToDateTime(startDate.ToShortDateString() + " " + c_1),
                rfStatusId = processStatus,
                dgPrice = totalPrice,
                blStatus = true,
                dtCreated = DateTime.Now,
                cdCreator = "İnternet"
            };

            dm.Process.Add(process);
            dm.SaveChanges();

            error.dgErrorCode = 0;
            error.chError = "Kaydınız başarıyla oluşmuştur";
            error.chPageName = "VehicleBooking/BookingController";
            error.dtCreated = DateTime.Now;
            error.chIpAddress = Request.UserHostAddress;

            return Json(error, JsonRequestBehavior.AllowGet);

        }
コード例 #16
0
        public void bookingSettings()
        {
            dm = new SeyahatIstanbulEntities();

            CommonSettings sonControl = (from cs in dm.CommonSettings
                                 where 1 == 1
                                    && cs.blStatus == true
                                    && cs.chKey == "bookingControl"
                                 select cs).SingleOrDefault();

            DateTime dtSonControl = Convert.ToDateTime(sonControl.chValue);

            if (dtSonControl >=DateTime.Now.Date)
                return;

            DateTime bugun = DateTime.Now.Date;
            List<Process> pGecmisList = (from p in dm.Process
                                   where 1 == 1
                                      && p.blStatus == true
                                      && (p.rfStatusId == 1 || p.rfStatusId == 2 || p.rfStatusId == 3)
                                      &&  p.dtStartDate < bugun
                                   select p).ToList();

            foreach (var item in pGecmisList)
            {
                item.rfStatusId = 8;
                dm.SaveChanges();

                sonControl.chValue = bugun.ToString();
                dm.SaveChanges();
            }


        }
コード例 #17
0
        public SelectList ddTour()
        {
            dm = new SeyahatIstanbulEntities();
            SelectList selectList = new SelectList(from d in dm.Tour
                                                   where d.blStatus == true
                                                   select new { Value = d.sqTourId, Text = d.chPlaces }, "Value", "Text");

            return selectList;
        }
コード例 #18
0
        private List<VehicleList> loadVehicleList()
        {
            List<VehicleList> vehicleList = new List<VehicleList>();
            List<VehicleList> sVehicleList = new List<VehicleList>();
            dm = new SeyahatIstanbulEntities();
            var vehicleList_ = (from rv in dm.RentVehicle
                                from m in dm.Model
                                from b in dm.Brand
                                from gt in dm.GearType
                                from ft in dm.FuelType
                                where rv.blStatus == true
                                   && rv.rfModelId == m.sqModelId
                                   && m.rfBrandId == b.sqBrandId
                                   && gt.sqGearTypeId == rv.rfGearTypeId
                                   && ft.sqFuelTypeId == rv.rfFuelTypeId
                                select new
                                {
                                    vehicleId = rv.sqVehicleId,
                                    model = m.chValue,
                                    brand = b.chValue,
                                    gearType = gt.chValue,
                                    fuelType = ft.chValue,
                                    capacity = rv.qtCapacity,
                                    blSlider = rv.blDisplaySlider,
                                    imageRotute = rv.chImageName,
                                    modelYear = rv.chModelYear
                                }).Distinct().ToList();


            foreach (var item in vehicleList_)
            {
                List<Price> pList = (from p in dm.Price
                                     where p.rfCategoryId == 1
                                        && p.rfProductId == item.vehicleId
                                        && p.blStatus == true
                                     select p).OrderBy(d=>d.dgDay).ToList();

                Category cat = (from c in dm.Category
                                where c.sqCategoryId == 1
                                select c).SingleOrDefault();


                VehicleList vehicle = new VehicleList();

                vehicle.chCatGuid = cat.chGuid;
                vehicle.dgVehicleId = item.vehicleId;
                vehicle.chBrand = item.brand;
                vehicle.chModel = item.model;
                vehicle.chFuelType = item.fuelType;
                vehicle.chGearType = item.gearType;
                vehicle.chImageRoute_1 = item.imageRotute + "_1.jpg";
                vehicle.chImageRoute_2 = item.imageRotute + "_2.jpg";
                vehicle.chImageRoute_3 = item.imageRotute + "_3.jpg";
                vehicle.chFulName = item.brand + " " + item.model + " - " + item.modelYear;
                vehicle.chCapacity = item.capacity + " Kişilik";
                vehicle.chPrice_1_7 = pList[0].dgValue.ToString();
                vehicle.chPrice_8_15 = pList[1].dgValue.ToString() + " TL";
                vehicle.chPrice_16_24 = pList[2].dgValue.ToString() + " TL";
                vehicle.chPrice_25 = pList[3].dgValue.ToString() + " TL";


                vehicleList.Add(vehicle);
            }

            ViewBag.vehicleList = vehicleList;

            return vehicleList;

        }
コード例 #19
0
        public void loadApart()
        {
            dm = new SeyahatIstanbulEntities();
            SelectList selectList = new SelectList(from d in dm.RentApart
                                                   where d.blStatus == true
                                                   select new { Value = d.sqRentApartId, Text = d.chAddress }, "Value", "Text");

            ViewBag.ApartPlace = selectList;

            SelectList selectList2 = new SelectList(from d in dm.RentApart
                                                    where d.blStatus == true
                                                    select new { Value = d.sqRentApartId, Text = d.dgRoomSize }, "Value", "Text");
            ViewBag.RoomCount = selectList2;


            SelectList selectList3 = new SelectList(from r in dm.RentApart
                                                    from c in dm.County
                                                    where r.blStatus == true
                                                       && r.rfCountyId == c.sqCountyId
                                                    select new { Value = r.sqRentApartId, Text = c.chCountyName + " - " + r.chAddress.Substring(0,20) +"... ( "+ r.chProperties +" )"}, "Value", "Text");

            ViewBag.TabApartleList = selectList3;
        }