Esempio n. 1
0
        //用户ID所有的酒店
        public  List<hotel_info> getHotlList(string iuId)
        {
           // uId = "test1";
            //c = new help.HotelInfoHelp().getUId();
           // uId=
            using (db = new HotelDBContent())
            {
                var member =(from m in db.Merchant_infos where m.mobliephone == uId select m).SingleOrDefault();
                //if (member != null)
                //{
                    if (member.admin)
                    {
                        return (from h in db.hotel where h.u_id == uId && h.h_state == true select h).ToList();
                    }
                    else
                    {
                        {

                            string[] str = string.IsNullOrEmpty(member.limitHotelId) ? new string[] { "1" } : member.limitHotelId.Split(',');
                            int[] strHotelId = new int[str.Length];
                            for (int i = 0; i < str.Length; i++)
                            {
                                strHotelId[i] = Convert.ToInt32(str[i]);
                            }
                            return (from h in db.hotel where h.u_id == uId && h.h_state == true && strHotelId.Contains(h.hotel_id) select h).ToList();
                        }

                    }
                //}
                  
            }
        }
Esempio n. 2
0
        public ActionResult CreateUser(Merchant_info merchant_info)
        {
            merchant_info.status = true;
            using (db = new HotelDBContent())
            {
                if (merchant_info.id > 0)
                {
                     //if(merchant_info.password=="******")

                    merchant_info.updateUser(merchant_info);
                }
                else
                {
                    if (ModelState.IsValid)
                    {
                        merchant_info.password = new help.HotelInfoHelp().Md5(merchant_info.password); merchant_info.ctime = DateTime.Now; merchant_info.status = true; merchant_info.guid = Guid.NewGuid().ToString(); merchant_info.operator_id = new help.HotelInfoHelp().getUId(); merchant_info.status = true;
                        //using (db=new HotelDBContent())
                        //{
                        db.Merchant_infos.Add(merchant_info);
                        result = db.SaveChanges() > 0 ? 1 : 0;
                        //}

                    }
                }
            }
           

            return View("MyUser", getData());
        }
Esempio n. 3
0
        //酒店的房型列表
        public static List<hotel_room_info> getRooms(int hotelId)
        {

            using(db = new HotelDBContent())
            {
              return (from r in db.rooms where r.hotel_id == hotelId select r).ToList();
            }

        }
Esempio n. 4
0
 public int validateSASUser(string tel)
 {
     using (db = new HotelDBContent())
     {
         if ((from u in db.Merchant_infos where u.tel == tel select u.tel).Count() > 0)
             return 1;
         else
             return 0;
     }
 }
Esempio n. 5
0
 //验证房型是否存在
 public int IsOk(string hotelId, string text)
 {
     int hotel_id = Convert.ToInt32(hotelId);
     using (db = new HotelDBContent())
     {
         if ((from h in db.rooms where h.h_r_name_cn == text && h.hotel_id == hotel_id select h).Count() > 0)
             return 0;
         else
             return 1;
     }
 }
Esempio n. 6
0
 /// <summary>
 /// 电话
 /// </summary>
 /// <param name="tel"></param>
 /// <returns></returns>
 public int isOkTel(string text)
 {
   // int hotel_id = Convert.ToInt32(hotelId);
     using (db = new HotelDBContent())
     {
         if ((from m in db.Merchant_infos where m.tel== text  select m).Count() > 0)
             return 0;
         else
             return 1;
     }
 }
Esempio n. 7
0
 /// <summary>
 /// 验证房型是否存在
 /// </summary>
 /// <param name="text"></param>
 /// <param name="hotelId"></param>
 /// <returns></returns>
 public int isOkRoom(string text,string hotelId)
 {
     int hotel_id = Convert.ToInt32(hotelId);
     string strRooms = string.Empty;
     using (db = new HotelDBContent())
     {
         if ((from r in db.rooms where r.h_r_name_cn == text.Trim() && r.hotel_id == hotel_id select r).Count() > 0)
             return 0;
         else
             return 1;
       
     }
 
 }
Esempio n. 8
0
            ////get all Theme
            //public static SelectList AllTheme()
            //{
            //    List<SelectListItem> list = new List<SelectListItem>();
            //    khotel_theme_infoDBContent db = new khotel_theme_infoDBContent();
            //    var themes = db.Themes.ToList();
            //    foreach (var t in themes)
            //    {
            //        list.Add(new SelectListItem() { Text = t.hotel_theme_title, Value = t.hotel_theme_id.ToString() });


            //    }
            //    SelectList item = new SelectList(list, "Value", "Text");
            //    return item;
            //}
            //get all Theme
            public static Dictionary<int,string> AllTheme()
            {
                Dictionary<int, string> list = new Dictionary<int, string>();
                //Array array = new Array();

                HotelDBContent db = new HotelDBContent();
                var themes = db.themes.ToList();
               
               
                foreach (var t in themes)
                {
                    list.Add(t.hotel_theme_id, t.hotel_theme_title); ;


                }
                
                return list;
            }
Esempio n. 9
0
        public static Dictionary<int, string> allCategory()
        {
            Dictionary<int, string> list = new Dictionary<int, string>();
            //Array array = new Array();

            HotelDBContent db = new HotelDBContent();
            var themes = db.curents.ToList();


            foreach (var t in themes)
            {
                list.Add(t._t_id, t._t_name); ;


            }
            return list;
 
        }
Esempio n. 10
0
        public ActionResult LoginSubmit(Merchant_info merchant_info)
        {
            string code = Session["code"]!=null?Session["code"].ToString():"";
            if (code == merchant_info.guid)
            {
                using (db = new HotelDBContent())
                {
                    Merchant_info mer = (from m in db.Merchant_infos where m.mobliephone == merchant_info.tel &&m.status==true select m).SingleOrDefault();
                    if (mer != null)
                    {
                      //  new help.HotelInfoHelp().Md5(merchant_info.password);
                        //  if (mer.password == merchant_info.password)
                        if (mer.password == new help.HotelInfoHelp().Md5(merchant_info.password))
                        {

                            string limit = string.Empty;
                            Session["menu"] = new help.HotelInfoHelp().GetLimit(mer, out limit); Session["limit"] = limit; Session["limitHotelId"] = mer.limitHotelId;

                            Session["userName"] = mer.name;
                            Session["uid"] = mer.mobliephone;
                            Session.Remove("code");
                            return RedirectToAction("index", "home");
                        }
                        else
                        {
                            ViewBag.LoginInfo = "用户名或者密码错误";
                        }
                    }
                    else
                    {
                        ViewBag.LoginInfo = "用户名或者密码错误";
                    }
                    
                }
            }else
                ViewBag.LoginInfo = "验证码错误,请输入正确的验证码";
            Session.Remove("code");
            ViewBag.userName = merchant_info.tel; ViewBag.pass = merchant_info.password;
            return View("signLogin");;
        }
Esempio n. 11
0
        /// <summary>
        /// 查找房型
        /// </summary>
        /// <param name="text"></param>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public string qureyRoom(string text, string hotelId)
        {
            //text = "IW1号测试房";
            int hotel_id=0;int.TryParse(hotelId,out hotel_id); 
            string strRooms = string.Empty;

            if (string.IsNullOrEmpty(text))
                return strRooms;
            using (db = new HotelDBContent())
            {
               //var ff=(from o in db.hotel where o.hotel_id == hotel_id select o.h_name_cn).FirstOrDefault();
                var f = (from helong in db.hotel where ((from o in db.hotel where o.hotel_id == hotel_id select o.h_name_cn).FirstOrDefault()).Contains(helong.h_name_cn) where helong.source_id == 4 select helong).FirstOrDefault();
                if (f != null)
                {
                    var room = from o in db.rooms where o.h_r_name_cn.Contains(text.Trim()) && o.hotel_id == f.hotel_id select o;
                    foreach (var r in room)
                    {
                        strRooms += string.Format("{0},{1}", r.h_r_name_cn, r.room_id) + "|";
                    }
                }

            }
            return strRooms;
        }
Esempio n. 12
0
        //删除担保
        public ActionResult deleteG(string id)
        {
            int gId;
            int.TryParse(id, out gId);
            GuaranteeRule guran = null;
            using (db = new HotelDBContent())
            {
                var gu = (from g in db.gu where g.id == gId select g).SingleOrDefault();

                db.gu.Remove(gu);
                if (db.SaveChanges() > 0)
                    ViewBag.sign = 1;
                else
                    ViewBag.sign = 0;
                guran = gu;
                ViewBag.Id = gu.hotel_id;
                GetData(gu.hotel_id.ToString());
                setName();
            }
             guran.id = 0;
            return View("MyGuarantee", guran);
        }
Esempio n. 13
0
        //}
        /// <summary>
        /// 查询酒店
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public string queryHotel(string text)
        {
        
            string strResult = string.Empty;
            using (db = new HotelDBContent())
            {

                var result = from h in db.hotel join b in db.citys on h.h_city equals b.City_id where h.h_name_cn.Contains(text.Trim()) && h.source_id == 4 select new { name = h.h_name_cn, city = b.City_name, f = h.source_id };
                foreach (var r in result)
                {

                    strResult += string.Format("{0}[{1}])", r.name, r.city) + "|";
                }
            }
           
            return strResult;

        }
Esempio n. 14
0
        ///// <summary>
        ///// 验证酒店名是否存在
        ///// </summary>
        ///// <param name="text"></param>
        ///// <returns></returns>
        //public int IsOkHotel(string text)
        //{
        //    using (db = new HotelDBContent())
        //    {
        //        if ((from h in db.hotel where h.h_name_cn == text select h).Count() > 0 || (from h in new HotelDBContent("").hotel where h.h_name_cn == text select h).Count() > 0)
        //            return 0;
        //        else
        //            return 1;
        //    }

        //}
        /// <summary>
        /// 验证酒店名是否存在
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public int IsOkHotel(string text)
        {
            string strResult = string.Empty;
            using (db = new HotelDBContent())
            {
               
                if((from h in db.hotel where  h.h_name_cn==text.Trim() && h.source_id==5 && h.h_state==true select h).Count()>0)
                return 0;
                else
                return 1;
               
            }
           

        }
Esempio n. 15
0
        public void ProcessRequest(HttpContext context)
        {
            HotelDBContent db = new HotelDBContent();
            string NewsFilePath = HttpContext.Current.Server.MapPath("\\") + "UploadFiles\\TitleImage\\";
            string AdminFilePath = HttpContext.Current.Server.MapPath("\\") + "admin\\UploadFiles\\TitleImage\\";
            context.Response.ContentType = "text/html";
            HttpFileCollection files = context.Request.Files;              // From中获取文件对象
            string tag = Guid.NewGuid().ToString();
            int roomId=Convert.ToInt32(context.Request.Form[0]);
            List<Image> list1 = new List<Image>();
            string count="..";
            if (files.Count > 0)
            {
                string path = "";
                string fileD = "../";
                if (!Directory.Exists(AdminFilePath))
                    Directory.CreateDirectory(AdminFilePath);
                if (!Directory.Exists(NewsFilePath))
                    Directory.CreateDirectory(NewsFilePath);
                //路径字符串
                Random rnd = new Random();
                for (int i = 0; i < files.Count; i++)
                {
                    #region
                    HttpPostedFile file = files[i];
                    //得到文件对象
                    if (file.ContentLength > 0)
                    {
                        int size = file.ContentLength;
                        string fileName = file.FileName;
                        Stream stream = file.InputStream;
                        System.Drawing.Image image = System.Drawing.Image.FromStream(stream);
                        int w = image.Width;
                        int h = image.Height;
                        string extension = Path.GetExtension(fileName);
                        int num = rnd.Next(5000, 10000);                            //文件名称
                        ////  path = ;
                        ////保存文件。
                        string fileI = "UploadFiles\\TitleImage\\" + num.ToString() + extension;

                        string thumbImgPath = context.Server.MapPath("/") + fileI;
                        //string AdminthumbImgPath = context.Server.MapPath("/") + "admin/" + fileI;
                        ////thumbImg.Save();
                        //file.SaveAs(thumbImgPath);
                        //file.SaveAs(AdminthumbImgPath);
                        //filePath = context.Server.MapPath(filePath + "/" + fileName);
                        ////将上传来的 文件数据 保存在 对应的 物理路径上   
                        //hpFile.SaveAs(filePath);
                        
                        string showImagePath = "..\\" + fileI;
                        //string showImagePath = string.Empty; ;
                        // && w > 500 && h > 300
                        string fileName1, message, oPath=string.Empty, tPath = string.Empty;
                        string d = DateTime.Now.ToString("yyyy-MM");
                        
                        if (!new help.ImgHelper().MoreImgUpload(file, out fileName1, out message, ThumbImages_SavePath, OriginalImages_SavePath, ThumbImages_Height, ThumbImages_Wight, Images_Height, Images_Wight, ThumbImages_Size, out oPath, out tPath))
                        {
                            return;
                        }
                        string realOpath = ThumbImages_SavePath + d + "/" + "T_" + fileName1;
                        string realTpath = ThumbImages_SavePath + d + "/" + "T_" + fileName1;
                        if (size < maxSize && w >= 500 && h >= 300 )
                        {
                            
                          //  string message=
                         
                                hotel_room_picture_info pic = new hotel_room_picture_info();

                                pic.h_r_p_pic_original_url = realOpath;
                                pic.h_r_p_pic_thumb_url = realTpath;
                                pic.souce_id = Convert.ToInt32(help.StringHelper.appSettings("source_id"));
                                pic.State = false;
                                pic.room_id = roomId;
                             
                                pic.h_r_p_tag = tag;
                                pic.h_r_p_time = DateTime.Now;

                                db.roomImages.Add(pic);
                                db.SaveChanges();
                            

                        }
                        else
                        {
                            Image IM = new Image();
                            IM.oURL = count + realOpath;
                            IM.tURL = count + realTpath; ;
                            message = string.Empty;
                            if (size > maxSize)
                                message = "图片大小小于10M";
                            if (w < 500 ||h < 300)
                            {
                                if (message == string.Empty)
                                    message += "图片像素宽大于500px,高大于300px";
                                else
                                    message += ",图片像素宽大于500px,高大于300px";
                            }
                            IM.Message = message;
                            IM.PID = 0;
                            list1.Add(IM);
                        }


                    }
                    #endregion
                }
                //  List<hotel_picture_info> list = (from p in db.room where p.h_p_tag ==tag select new { p.h_p_pic_original_url, p.h_p_id }).ToList();
                var pics = from p in db.roomImages where p.h_r_p_tag == tag   select new   {  p.h_r_p_id, p.h_r_p_pic_original_url, p.h_r_p_pic_thumb_url, p.h_r_p_title };
                foreach (var item in pics)
                {
                    Image pic = new Image();
                    pic.oURL = ".." + item.h_r_p_pic_original_url;
                    pic.tURL = ".." + item.h_r_p_pic_thumb_url;
                    pic.Message ="";
                    pic.PID = item.h_r_p_id;
                    list1.Add(pic);
                }

                string str = JsonConvert.SerializeObject(list1, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Ignore });
                context.Response.Write(str);
                //context.Response.Write(showImagePath + "$" + "1089023");            //返回文件存储后的路径,用于回显。
                //context.Response.End();

            }
        }
Esempio n. 16
0
        //修改房价
        public int uPrice(string id, string roomId, string startDate, string EndDate, string value)
        {

            int Id, room_id, count = 0; decimal price;  decimal.TryParse(value, out price); int.TryParse(id, out Id);  int.TryParse(roomId, out room_id); DateTime.TryParse(startDate, out start);  DateTime.TryParse(EndDate, out end);
            hotel_room_RP_price_info p = new hotel_room_RP_price_info();
            using (db = new HotelDBContent())
            {
                count = (from r in db.rooms where r.hotel_id == Id && r.room_id == room_id select r).Count();
            }
            if (count > 0)
             result = new Hotel_room_RP_price_batch().InsertPriceBatch(new hotel_room_RP_price_info() { hotel_id = Id, room_id = room_id, room_rp_start_time = start, room_rp_end_time = end, room_rp_price = price }) == true && DBhelp.CallProc(room_id, "proc_hotel_room_RP_price_batch_roomid") == true ? 1 : 0;
            //  result = new Hotel_room_RP_price_batch().InsertPriceBatch(new hotel_room_RP_price_info() { hotel_id = Id, room_id = room_id, room_rp_start_time = start, room_rp_end_time = end, room_rp_price = price }) == true && DBhelp.CallProc(room_id, "proc_hotel_room_RP_price_batch_roomid") == true ? 1 : 0;
              
            return result;
           // return View("MyPrix", getData(id, startDate, EndDate));
        }
Esempio n. 17
0
 //删除公寓
 public int delApart(string hotelId)
 {
     try
     {
         
         int.TryParse(hotelId, out hotel_id); string u_id = new HotelInfoHelp().getUId();
         using (db = new HotelDBContent())
         {
             ((from h in db.hotel where h.hotel_id == hotel_id && h.source_id == 5 && h.u_id == u_id select h).SingleOrDefault()).h_state=false;
             result = db.SaveChanges() > 0 ? 1 : 0;
        }
     }
     catch (Exception)
     {
         result = 0;
     }
     return result;
 }
Esempio n. 18
0
        public ActionResult Create(GuaranteeRule guaranteerule)
        {

            setName();
            using (db = new HotelDBContent())
            {
                if (guaranteerule.id > 0)
                {

                    db.Entry(guaranteerule).State = EntityState.Modified;
                }
                else
                {
                    Hotel_room_RP_info ratePlan = new Hotel_room_RP_info();
                    ratePlan.hotel_id = guaranteerule.hotel_id;
                    ratePlan.h_room_rp_name_cn = "标准价";
                    int ratePlanId = help.HotelInfoHelp.getRatePlanId(ratePlan);
                    // var rp=(from r in db.rps where r.hotel_id==guaranteerule.hotel_id && r.h_room_rp_state==true && r.h_room_rp_name_cn=="标准价"select r.h_room_rp_id).SingleOrDefault();

                    guaranteerule.h_room_rp_id = ratePlanId;
                    if (ModelState.IsValid)
                    {
                        db.gu.Add(guaranteerule);


                    }
                    db.SaveChanges();
                }
               
            }
            GetData(guaranteerule.hotel_id.ToString());
          
            return View("MyGuarantee", new GuaranteeRule() { GuaranteeType = "FirstNightCost",ChangeRule=1 });
        }
Esempio n. 19
0
        //所有促销类型
        public static List<DrrModes> getDrrModeList(string uId)
        {

            using (db = new HotelDBContent())
            {
                return (from h in db.drrmodes select h).ToList();
            }
           
        }
Esempio n. 20
0
 /// <summary>
 /// 得到RatePlanId
 /// </summary>
 /// <param name="rp"></param>
 /// <returns></returns>
 public static int getRatePlanId(Hotel_room_RP_info rp)
 {
     int ratePlanId = 0;
     rp.RatePlanId = Guid.NewGuid().ToString();
     rp.h_room_rp_is_to_store_pay = true;
     rp.h_room_rp_check_in = "00:00:00";
     rp.h_room_rp_check_out = "23:59:00";
     rp.h_room_rp_least_day = 1;
     rp.h_room_rp_longest_day = 365;
     rp.h_room_rp_ctime = DateTime.Now;
    // rp.h_room_rp_name_cn = "";
     using (HotelDBContent db = new HotelDBContent())
     {
         var tempRp = (from r in db.rps where r.h_room_rp_name_cn == rp.h_room_rp_name_cn && r.hotel_id == rp.hotel_id select r).SingleOrDefault();
         if (tempRp != null)
         {
             ratePlanId = tempRp.h_room_rp_id; ;
         }
         else
         {
             db.rps.Add(rp);
             db.SaveChanges();
             //取rpId
             ratePlanId = (from r in db.rps where r.RatePlanId == rp.RatePlanId select r.h_room_rp_id).SingleOrDefault();
        
         }
     }
 
     return ratePlanId;
 }
Esempio n. 21
0
 ///// <summary>
 ///// 验证酒店名是否存在
 ///// </summary>
 ///// <param name="text"></param>
 ///// <returns></returns>
 //public int IsOk(string text)
 //{
 //    using (db = new HotelDBContent())
 //    {
 //        if ((from h in db.hotel where h.h_name_cn == text select h).Count() > 0 || (from h in new HotelDBContent("").hotel where h.h_name_cn == text select h).Count() > 0)
 //            return 0;
 //        else
 //            return 1;
 //    }
 
 //}
 /// <summary>
 /// 模糊查询公寓
 /// </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 public ActionResult FindHotel(string text)
 {
   //  Response.Write(text);
    hotel_info hotel=null;
     using (db = new HotelDBContent())
     {
      //   hotel = (from h in db.hotel where h.h_name_cn == text.Trim() && h.source_id == 4 select new { h=h.h_name_cn,name=h.h_city});
         hotel = (from h in db.hotel where h.h_name_cn == text.Trim() && h.source_id == 4 select h).FirstOrDefault();
         if (hotel != null)
         {
             hotel.hotel_id = 0;
             //var tempHotel=(from h1 in db.hotel where h1.h_name_cn==text.Trim() && h1.source_id==5 select h1).Count();
             // ViewBag.exit = tempHotel > 0 ? 1 : 0;
             hotel.h_province = (from c in db.citys where c.City_id == hotel.h_city select c.Province_id).SingleOrDefault();
             string[] serveice = hotel.GeneralAmenities.Split('、');
             string[] temp = new string[serveice.Length];
             for (int i = 0; i < serveice.Length; i++)
             {
                 temp[i] = serveice[i];
             }
             var GeneraIds = from g in db.general where temp.Contains(g.Title) select g.Id;
             string GIds = string.Empty;
             foreach (var item in GeneraIds)
             {
                 if (string.IsNullOrEmpty(GIds))
                     GIds += item;
                 else
                     GIds += "," + item;
             }
             hotel.GeneralAmenities = GIds;
             hotel.IntroEditor = hotel.IntroEditor.TrimEnd();
             var tempRoom = ((from o in db.hotel where o.h_name_cn == text.Trim() && o.source_id == 5 && o.h_state == true select o).Count());
             ViewBag.exit = tempRoom > 0 ? 0 : 1;
         }
     }
     getHelpData();
     if(hotel!=null)
         return View("Create", hotel);
     else
     return View("Create",new hotel_info());
 }
Esempio n. 22
0
        /// <summary>
        /// //匹配房型
        /// </summary>
        /// <param name="roomId"></param>
        /// <param name="name"></param>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public ActionResult selectedRoom(string roomId, string hotelId)
        {
            int room_id = 0; int.TryParse(roomId, out room_id);//   int hotel_id = Convert.ToInt32(hotelId);
            int hotel_Id = 0; int.TryParse(hotelId, out hotel_Id);
            hotel_room_info room = new hotel_room_info();
            using (db = new HotelDBContent())
            {

                room = (from r in db.rooms where r.room_id == room_id select r).SingleOrDefault();
                room.room_id = 0; room.hotel_id = 0;
                string tempBed = string.Empty;
                if (!string.IsNullOrEmpty(room.h_r_bed_type))
                {
                   string []beds= room.h_r_bed_type.Split(',');
                   for (int i = 0; i < beds.Length; i++)
                   {
                       tempBed += beds[i].Contains("|") ? beds[i] : beds[i] + "|" + 1+",";
                   }
                }
                room.h_r_bed_type = tempBed.LastIndexOf(",") != -1 ? tempBed.Substring(0, tempBed.Length - 1) : tempBed;
                var tempRoom = ((from o in db.rooms where o.h_r_name_cn == room.h_r_name_cn.Trim() && o.hotel_id == hotel_Id select o).Count());
                ViewBag.exit = tempRoom > 0 ? 0 : 1;

            }
            helpdata(hotel_Id);
            if(room!=null)
             return View("MyRoom", room);
            else
              return View("MyRoom", new hotel_room_info());
        }
Esempio n. 23
0
        /// <summary>
        /// //匹配房型
        /// </summary>
        /// <param name="roomId"></param>
        /// <param name="name"></param>
        /// <param name="hotelId"></param>
        /// <returns></returns>
        public ActionResult selectedRoom(string roomId, string name, string hotelId)
        {
            int room_id = 0; int.TryParse(roomId, out room_id);//   int hotel_id = Convert.ToInt32(hotelId);
            int hotel_Id = 0; int.TryParse(hotelId, out hotel_Id);
            hotel_room_info room = new hotel_room_info();
            using (db = new HotelDBContent())
            {

                room = (from r in db.rooms where r.room_id == room_id select r).SingleOrDefault();
                //var tempRoom = ((from o in db.rooms where o.h_r_name_cn == name.Trim() && o.hotel_id == hotel_Id select o).Count());
                //ViewBag.exit = tempRoom > 0 ? 1 : 0;

            }

            helpData(hotel_Id);
            if (room != null)
                return View("MyRoom", room);
            else
                return View("MyRoom", new hotel_room_info());
        }
Esempio n. 24
0
        public ActionResult CreateHotel(hotel_info hotel_info)
        {
               
            try
            {
               
                //hotel_info.u_id = new HotelInfoHelp().getUId();
                hotel_info.source_id = Convert.ToInt32(help.StringHelper.appSettings("source_id")); ;
                hotel_info.h_id = Guid.NewGuid().ToString();
                hotel_info.h_state = true;
                hotel_info.h_utime = DateTime.Now;
                hotel_info.CheckState = 2;
                hotel_info.h_ctime = DateTime.Now;
                hotel_info.decorateTime = hotel_info.decorateTime == Convert.ToDateTime("0001/1/1 0:00:00") || hotel_info.decorateTime ==null? Convert.ToDateTime("1900-01") : hotel_info.decorateTime;
                hotel_info.h_opening_time = hotel_info.h_opening_time == Convert.ToDateTime("0001/1/1 0:00:00") ? Convert.ToDateTime("1900-01") : hotel_info.h_opening_time;
                //hotel_info.h_room_count = hotel_info.h_room_count == 0 ? 1 : hotel_info.h_room_count;
                hotel_info.u_id = hotel_info.h_mobile_phone;
                using(db=new HotelDBContent())
                {
                   if (hotel_info.hotel_id > 0)
                   {
                       db.Entry(hotel_info).State = EntityState.Modified;
                       
                    
                   }
                   else
                   {

                       var errors = ModelState.Values.SelectMany(v => v.Errors);
                       //if (ModelState.IsValid)
                       //{
                           db.hotel.Add(hotel_info);
                          // result = db.SaveChanges() > 0 ? 1 : 0;
                        
                           var f = (from h in db.hotel where h.h_name_cn == hotel_info.h_name_cn && h.source_id == 4 select h).FirstOrDefault(); 
                           if (f != null)
                               f.h_state = false; //把对应艺龙的酒店干掉
                             
                           // return RedirectToAction("Room/Create/"+ddh.hotel_id);
                       //}
                   }
                   result = db.SaveChanges() > 0 ? 1 : 0;
                   if (result > 0)
                   {
                       var ddh = db.hotel.Select(h => new { h.hotel_id, h.h_id }).Single(h => h.h_id == hotel_info.h_id);
                       return RedirectToAction("room", "AddHotel", new { hotelId = ddh.hotel_id });
                   }

                }    


            }
         
            catch (Exception e)
            {
                throw e;
                help.DBhelp.log("新建公寓基本信息"+e.ToString());
             
            }
            ViewBag.sign = result; getHelpData();
            return View("Create", hotel_info);
        }
Esempio n. 25
0
        public List<GuaranteeRule> GuraranteeList(int hotelId)
        {
            //用户ID所有的酒店
              HotelDBContent db = new HotelDBContent();

              return (from h in db.gu where h.hotel_id == hotelId select h).ToList();

        }
Esempio n. 26
0
 //修改房态
 public int uStatus(string id, string roomId, string startDate, string EndDate, string CanSell, string status)
 {
     int result = 0;
     int Id, room_id, count = 0; int Rstatus; int RCanSell; int.TryParse(status, out Rstatus); int.TryParse(CanSell, out RCanSell); int.TryParse(id, out Id); int.TryParse(roomId, out room_id); DateTime.TryParse(startDate, out start); DateTime.TryParse(EndDate, out end);
     using (db = new HotelDBContent())
     {
         count = (from r in db.rooms where r.hotel_id == Id && r.room_id == room_id select r).Count();
     }
     if (count > 0)
         result = new RoomStatus_batch().insertStatuBatch(new RoomStatus_batch() { hotel_id = Id, room_id = room_id, r_s_time = start, EndDate = end, eBeds = RCanSell,r_s_status = Rstatus==1?true:false}) == true && DBhelp.CallProc(room_id, "proc_hotel_room_ebeds_batch_roomid") == true ? 1 : 0;
   
        // result = new RoomStatus_batch().insertStatuBatch(new RoomStatus_batch() { hotel_id = Id, room_id = room_id, r_s_time = start, EndDate = end, eBeds = RCanSell }) == true?1 : 0;
    
   return result;
 }
Esempio n. 27
0
 //验证房型是否存在
 public int IsOk(string id, string text)
 {
     int drrId; int.TryParse(id, out drrId);
     using (db = new HotelDBContent())
     {
         if ((from h in db.drrs where h.DrrName == text && h.hotel_id == drrId select h).Count() > 0)
             return 0;
         else
             return 1;
     }
 }
Esempio n. 28
0
        public List<Gift> GiftList(int hotelId )
        {
            HotelDBContent db = new HotelDBContent();
            string uId = "test1";
           
            //用户ID所有的酒店
           
            return (from h in db.gifts where h.hotel_id==hotelId select h).ToList();

        }