Ejemplo n.º 1
0
 /// <summary>
 /// 查询酒店的所有房间
 /// </summary>
 /// <returns></returns>
 public static List <RoomMessage> HotelRoom()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(db.RoomMessage.ToList());
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询上线后以地址随机推荐的酒店
        /// </summary>
        /// <param name="HotelNum"></param>
        /// <returns></returns>
        public static List <HotelManag> GetALL(int HotelNum)
        {
            List <HotelManag> list = new List <HotelManag>();

            //ArrayList list = new ArrayList();
            using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
            {
                int num = 0;
                // db.Configuration.ProxyCreationEnabled = false;
                var dbApplicationList = db.HotelManag.GroupBy(x => x.HotelCity).Select(x => new { key = x.Key }).ToList();

                foreach (var item in dbApplicationList)
                {
                    var _dbApplicationList = item.key;


                    var distinctPeople = db.HotelManag.Include("HotelPhoto")
                                         .Where(t => t.HotelCity == _dbApplicationList && t.HotelRatify == true).ToList().FirstOrDefault();
                    if (distinctPeople == null)
                    {
                        continue;
                    }
                    list.Add(distinctPeople);
                    if (num >= HotelNum)
                    {
                        break;
                    }
                    num++;
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 查询所有的床型
 /// </summary>
 /// <returns></returns>
 public static List <Mattres> Select1()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(db.Mattres.ToList());
     }
 }
Ejemplo n.º 4
0
        public JsonResult GetEchartsHotelTypeOrder()
        {
            using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
            {
                var all = db.Order.Include("HotelManag").GroupBy(r => r.HotelManag.HotelType).Select(s => new { Name = s.Key, ID = s.Count() });

                //声明两个动态数据,存储循环出来的数据
                ArrayList xAxisData = new ArrayList();
                ArrayList yAxisData = new ArrayList();


                //循环list将数据循环存储在动态数组中
                foreach (var item in all)
                {
                    xAxisData.Add(item.Name);
                    yAxisData.Add(item.ID);
                }

                var resultPicorder = new { Sex = xAxisData, Num = yAxisData };
                return(Json(resultPicorder, JsonRequestBehavior.AllowGet));

                //2、不循环添加数据直接数据Json化数据
                //var all = db.Student.GroupBy(s => new { s.StuSex }).Select(s => new { Name = s.Key.StuSex, ID = s.Count() }).ToList();
                //return Json(new { data = all }, JsonRequestBehavior.AllowGet);
            }
        }
Ejemplo n.º 5
0
        public static List <Order> Selectorderdate(int pageindex, int pagesize, out int pagecount, string b, int HotelID)
        {
            using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
            {
                var orders = db.Order.Include("HotelManag").Include("RoomMessage").Where(s => s.HotelID == HotelID);
                var df     = DateTime.Now.Date;

                if (b == "今日订单")
                {
                    DateTime bd       = DateTime.Parse(df.ToString());
                    var      students = orders.Where(s => s.Ordertime > bd).ToList();
                    pagecount = (int)Math.Ceiling(students.Count() * 1.0 / pagesize);
                    return(students.OrderByDescending(s => s.Ordertime).Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList());
                }
                else if (b == "今日到店")
                {
                    var students = orders.Where(t => t.ArrivalDate == df).ToList();
                    pagecount = (int)Math.Ceiling(students.Count() * 1.0 / pagesize);
                    return(students.OrderByDescending(s => s.Ordertime).Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList());
                }


                else if (b == "待办事项")
                {
                    var students = orders.Where(t => t.OrderState == "退款").ToList();
                    pagecount = (int)Math.Ceiling(students.Count() * 1.0 / pagesize);
                    return(students.OrderByDescending(s => s.Ordertime).Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList());
                }


                pagecount = (int)Math.Ceiling(orders.Count() * 1.0 / pagesize);                                    //获取总数量
                return(orders.OrderBy(s => s.Ordertime).Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList()); //分页数据
            }
        }
Ejemplo n.º 6
0
 public IHttpActionResult GetEvaluate()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(Ok(db.UserEvaluate.Include("UserMessage").ToList()));
     }
 }
Ejemplo n.º 7
0
 internal static Order GetOrder(string order, int UsertID)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(db.Order.Include("UserMessage").Include("HotelManag").Include("RoomMessage").Where(t => t.OrderNumber == order && t.UserID == UsertID).ToList().FirstOrDefault());
     }
 }
Ejemplo n.º 8
0
        public ActionResult HotelOrderdtld(int id)
        {
            SmartRentalSystemEntities db = new SmartRentalSystemEntities();
            var orderdtld = db.view_OrderHotelPhotos.Find(id);

            return(View(orderdtld));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 查询所有的酒店
 /// </summary>
 /// <returns></returns>
 public static List <HotelManag> Select3()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(db.HotelManag.ToList());
     }
 }
Ejemplo n.º 10
0
        public JsonResult GetDecryptionString(UserMessage userMessage)
        {
            Session.Timeout = 720;
            var decryptionResult = LoginService.Decryption(userMessage.UserPhone, userMessage.UserPwd);

            if (int.Parse(decryptionResult.ToString()) == 1) //超级管理员
            {
                Session["SuperAdmin"] = userMessage.UserPhone;
                return(Json(new { succeed = 200, roestr = "/Hotel/Index" }, JsonRequestBehavior.AllowGet));
            }
            else if (int.Parse(decryptionResult.ToString()) == 0) //密码错误
            {
                return(Json(new { succeed = 404, roestr = "密码错误" }, JsonRequestBehavior.AllowGet));
            }
            else if (int.Parse(decryptionResult.ToString()) == -1) // 普通管理员
            {
                SmartRentalSystemEntities db = new SmartRentalSystemEntities();

                if (BLL.LoginService.DecryptionHotelID(userMessage.UserPhone) == null)
                {
                    return(Json(new { succeed = 200, roestr = "/GHotelHome/Main" }, JsonRequestBehavior.AllowGet));
                }



                Session["GeneralManager"] = userMessage.UserPhone;
                Session["HotelID"]        = BLL.LoginService.DecryptionHotelID(userMessage.UserPhone);
                return(Json(new { succeed = 200, roestr = "/GHotelHome/MainIndex" }, JsonRequestBehavior.AllowGet));
            }
            else //不是管理员
            {
                return(Json(new { succeed = 404, roestr = "没有权限" }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 查询所有的房型
 /// </summary>
 /// <returns></returns>
 public static List <RoomType> Select2()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         return(db.RoomType.ToList());
     }
 }
Ejemplo n.º 12
0
 public IHttpActionResult HotelselectName(string selectName)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var Hotel = db.HotelManag.Where(t => t.HotelName == selectName).ToList().FirstOrDefault();
         return(Ok(Hotel));
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 搜索栏模糊查询
 /// </summary>
 /// <param name="search"></param>
 internal static object Hunt(string search)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.HotelManag.Where(t => t.HotelName.Contains(search) && t.HotelRatify == true).ToList();
         return(aa);
     }
 }
Ejemplo n.º 14
0
 public IHttpActionResult Order(int UserId)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var Order = db.view_OrderHotelPhotos.OrderByDescending(t => t.Ordertime).Where(t => t.UserID == UserId).ToList();
         return(Ok(Order));
     }
 }
Ejemplo n.º 15
0
 public static UserMessage Personal(int UserId)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.UserMessage.Where(t => t.UserID == UserId).ToList().FirstOrDefault();
         return(aa);
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 /// 查询某个酒店
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static HotelManag All(int id)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.HotelManag.Include("HotelPhoto").Where(t => t.HotelID == id).FirstOrDefault();
         return(aa);
     }
 }
Ejemplo n.º 17
0
 internal static object Allroom(int roomId)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.RoomMessage.Include("RoomType").Include("RoomPhoto").Where(t => t.RoomID == roomId).ToList().FirstOrDefault();
         return(aa);
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// 所有房间信息
 /// </summary>
 /// <param name="id">酒店Id</param>
 /// <returns></returns>
 public static List <RoomMessage> GllDetails(int id)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.RoomMessage.Include("RoomType").Include("RoomPhoto").Where(t => t.HotelID == id && t.Roomstate != false).ToList();
         return(aa);
     }
 }
Ejemplo n.º 19
0
 public static int insertOrder(Order order)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         db.Order.Add(order);
         return(db.SaveChanges());
     }
 }
Ejemplo n.º 20
0
 public IHttpActionResult resultSearch(string name)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var Hotelname = db.HotelManag.Include("HotelPhoto").Where(t => t.HotelCity.Contains(name) && t.HotelRatify == true).ToList();
         return(Ok(Hotelname));
     }
 }
Ejemplo n.º 21
0
 public IHttpActionResult informationOrder(int UserId)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var count = db.Order.Where(t => t.UserID == UserId).Count();
         return(Ok(count));
     }
 }
Ejemplo n.º 22
0
 /// <summary>
 /// 查询上线后推荐的的酒店
 /// </summary>
 /// <returns></returns>
 public static List <HotelManag> Getrecommend()
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         db.Configuration.ProxyCreationEnabled = false;
         var aa = db.HotelManag.Include("HotelPhoto").Where(t => t.HotelRatify == true).OrderBy(t => t.Hotelrecommen).ToList();
         return(aa);
     }
 }
Ejemplo n.º 23
0
 public IHttpActionResult Orderreimburse(int UserId)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa    = DateTime.Now.Date;
         var Order = db.view_OrderHotelPhotos.OrderByDescending(t => t.Ordertime).Where(t => t.UserID == UserId && t.OrderState == "已退款").ToList();
         return(Ok(Order));
     }
 }
Ejemplo n.º 24
0
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="pageindex">页码</param>
        /// <param name="pagesize">一页的数量</param>
        /// <returns></returns>
        public static List <Order> Select(int pageindex, int pagesize, out int pagecount, int HotelID)
        {
            using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
            {
                var orders = db.Order.Include("HotelManag").Include("RoomMessage").Where(s => s.HotelID == HotelID);

                pagecount = (int)Math.Ceiling(orders.Count() * 1.0 / pagesize);
                return(orders.OrderByDescending(s => s.ArrivalDate).Skip(pagesize * (pageindex - 1)).Take(pagesize).ToList());
            }
        }
Ejemplo n.º 25
0
 public IHttpActionResult message(dynamic data)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var Url  = "/images/" + data.data.imgURL;
         var id   = data.data.id;
         var user = db.UserMessage.Find(id.Value);
         user.HeadPhoto       = Url;
         db.Entry(user).State = EntityState.Modified;
         return(Ok(db.SaveChanges() > 0));
     }
 }
Ejemplo n.º 26
0
 internal static object Updata(UserMessage user)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         var aa = db.UserMessage.Where(t => t.UserID == user.UserID).ToList().FirstOrDefault();
         aa.UserName        = user.UserName;
         aa.Birthday        = user.Birthday;
         aa.sex             = user.sex;
         db.Entry(aa).State = EntityState.Modified;
         return(db.SaveChanges());
     }
 }
Ejemplo n.º 27
0
        public ActionResult AdminOrder(int?OrderID, string OrderState, string ab, string text1, int pageindex = 1, int pagesize = 8)
        {
            Session["order"] = 45;

            SmartRentalSystemEntities db = new SmartRentalSystemEntities();
            var sss = ab; var bbb = text1;

            if (ab != null && ab != "")
            {
                Session["se"] = ab; Session["ts"] = text1;
            }
            if (sss == null && bbb == null)
            {
                var order = db.Order.Include("RoomMessage").Where(t => t.OrderID == OrderID).FirstOrDefault();
                order.OrderState = OrderState;
                var or = db.Order.Find(OrderID); var roms = db.RoomMessage.Find(order.RoomID);
                if (OrderState == "已退款" && roms.RoomCount < roms.RoomRemain)
                {
                    roms.RoomCount = roms.RoomCount + order.Ordercount;
                    if (roms.RoomCount > roms.RoomRemain)
                    {
                        roms.RoomCount = roms.RoomRemain;//保证能售房间数量和店长修改的房间数量一样;
                    }
                    db.SaveChanges();
                }
                or.OrderState = OrderState;
                db.SaveChanges();
            }
            else if (sss == "所有订单")
            {
                return(RedirectToAction("AdminOrder"));
            }
            else
            {
                //int countss = 5;
                var student = BLL.ServiceAdmin.YAdminManageServise.GetStudentByPaging1(pageindex, pagesize, out int pagecount, sss, bbb);
                //Session["order"] = 1;
                ViewBag.pageindex = pageindex;
                ViewBag.pagecount = pagecount;
                ViewBag.pagesize  = pagesize;
                //if (pagesize % 5 == 0)
                //{
                //    ViewBag.countss = pagesize;
                //}
                //else
                //{
                //    ViewBag.countss = countss;
                //}
                return(View(student));
            }
            return(RedirectToAction("AdminOrder"));
        }
Ejemplo n.º 28
0
 public IHttpActionResult Evaluate(int userId, int Evaluate)
 {
     using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
     {
         UserBrowse browse = new UserBrowse();
         browse.HotelID    = Evaluate;
         browse.UserID     = userId;
         browse.BrowseTime = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm"));
         db.UserBrowse.Add(browse);
         db.SaveChanges();
     }
     return(Ok(200));
 }
Ejemplo n.º 29
0
        public ActionResult HotelOrder(string OrderState, string ab, string text1, int pageindex = 1, int pagesize = 8)
        {
            Session["order"] = 45;
            var HotelIDss = int.Parse(Session["HotelID"].ToString()); /*Session["HotelID"];*///获取酒店HotelID
            SmartRentalSystemEntities db = new SmartRentalSystemEntities();
            var sss = ab; var bbb = text1;

            if (ab != null && ab != "")
            {
                Session["se"] = ab; Session["ts"] = text1;
            }
            if (sss == null && bbb == null)
            {
                var student = BLL.ServiceAdmin.GHotelManageService.Selectorderdate(pageindex, pagesize, out int pagecount, OrderState, HotelIDss);
                //Session["order"] = 1;
                ViewBag.pageindex = pageindex;
                ViewBag.pagecount = pagecount;
                ViewBag.pagesize  = pagesize;
                //if (pagesize % 5 == 0)
                //{
                //    ViewBag.countss = pagesize;
                //}
                //else
                //{
                //    ViewBag.countss = countss;
                //}
                return(View(student));
            }
            else if (sss == "所有订单")
            {
                return(RedirectToAction("HotelOrder"));
            }
            else
            {
                //int countss = 5;
                var student = BLL.ServiceAdmin.GHotelManageService.GetStudentByPaging1(pageindex, pagesize, out int pagecount, sss, bbb, HotelIDss);
                //Session["order"] = 1;
                ViewBag.pageindex = pageindex;
                ViewBag.pagecount = pagecount;
                ViewBag.pagesize  = pagesize;
                //if (pagesize % 5 == 0)
                //{
                //    ViewBag.countss = pagesize;
                //}
                //else
                //{
                //    ViewBag.countss = countss;
                //}
                return(View(student));
            }
        }
Ejemplo n.º 30
0
        //酒店月销量和房间销量图
        public JsonResult GetEchartsyear(string datesyear)
        {
            var HotelIDss = int.Parse(Session["HotelID"].ToString()); /*Session["HotelID"];*///获取酒店HotelID

            using (SmartRentalSystemEntities db = new SmartRentalSystemEntities())
            {
                var all = db.view_HotelDatemonthmoney.Where(v => v.HotelID == HotelIDss && v.datemoneytime.Contains(datesyear)).Select(s => new { Name = s.datemoneytime, ID = s.summoney }).OrderBy(s => s.Name);

                //声明两个动态数据,存储循环出来的数据
                ArrayList xAxisData = new ArrayList();
                ArrayList yAxisData = new ArrayList();

                string    st2 = null;
                string[]  st3 = new string[32];
                decimal[] sum = new decimal[32];
                //循环list将数据循环存储在动态数组中
                foreach (var item in all)
                {
                    st2 = item.Name.Split('-')[1];


                    st3[int.Parse(st2)] = st2;
                    sum[int.Parse(st2)] = (decimal)item.ID;
                }
                for (int i = 1; i <= 12; i++)
                {
                    string ni = i.ToString();
                    if (i < 10)
                    {
                        ni = "0" + i.ToString();
                    }
                    if (st3[i] != null && st3[i] == ni)
                    {
                        xAxisData.Add(i.ToString());
                        yAxisData.Add(sum[i]);
                    }
                    else
                    {
                        xAxisData.Add(i.ToString());
                        yAxisData.Add(0);
                    }
                }
                var resultsd = new { Sex = xAxisData, Num = yAxisData };
                return(Json(resultsd, JsonRequestBehavior.AllowGet));

                //2、不循环添加数据直接数据Json化数据
                //var all = db.Student.GroupBy(s => new { s.StuSex }).Select(s => new { Name = s.Key.StuSex, ID = s.Count() }).ToList();
                //return Json(new { data = all }, JsonRequestBehavior.AllowGet);
            }
        }