예제 #1
0
        public AjaxMessage SetThemeTitle(int imgId, int hotelId)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";

            //前封面图片
            CommonImages image = _imgService.GetTitleImg(hotelId);

            if (image != null)
            {
                image.State = 0;
                _imgService.Update(image);
            }

            //封面图片
            CommonImages uimage = _imgService.GetByID(imgId);

            uimage.State = 1;
            int result = _imgService.Update(uimage);

            if (result > 0)
            {
                //修改酒店封面图片
                FD_Hotel hotel = _hotelService.GetByID(hotelId);
                hotel.HotelThemeImage = uimage.ImgUrl;
                _hotelService.Update(hotel);
                ajax.IsSuccess = true;
                ajax.Message   = "设置成功";
            }

            return(ajax);
        }
예제 #2
0
        public AjaxMessage InsertHotel(FD_Hotel hotel)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";
            if (hotel != null)
            {
                bool isExists = _hotelService.IsExists(hotel.HotelName);
                if (isExists == false)          //酒店不存在  就新增
                {
                    hotel.CreateDate = DateTime.Now;
                    hotel.Letter     = PinYin.GetFirstLetter(hotel.HotelName.ToString());
                    hotel.Status     = (byte)SysStatus.Enable;

                    int result = _hotelService.Insert(hotel);
                    if (result > 0)
                    {
                        ajax.IsSuccess = true;
                        ajax.Message   = "添加成功";
                    }
                }
                else
                {
                    ajax.Message = "酒店名称已经存在";
                }
            }

            return(ajax);
        }
예제 #3
0
        public AjaxMessage SetSingleStatus(string hotelId)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";

            try
            {
                if (!string.IsNullOrEmpty(hotelId))
                {
                    FD_Hotel m_hotel = _hotelService.GetByID(hotelId.ToInt32());
                    if (m_hotel != null)
                    {
                        if (m_hotel.Status == (byte)SysStatus.Enable)
                        {
                            m_hotel.Status = (byte)SysStatus.Disable;
                            ajax.Message   = "禁用成功";
                        }
                        else
                        {
                            m_hotel.Status = (byte)SysStatus.Enable;
                            ajax.Message   = "启用成功";
                        }

                        int result = _hotelService.Update(m_hotel);
                        if (result > 0)
                        {
                            ajax.IsSuccess = true;
                        }
                        else
                        {
                            ajax.Message = "系统异常";
                        }
                    }
                    else
                    {
                        ajax.Message = "没有找到酒店";
                    }
                }
            }
            catch (Exception e)
            {
                ajax.Message = e.Message;
            }

            return(ajax);
        }
예제 #4
0
        public AjaxMessage UpdateHotel(FD_Hotel hotel)
        {
            AjaxMessage ajax = new AjaxMessage();

            ajax.IsSuccess = false;
            ajax.Message   = "";

            bool isExists = _hotelService.UpdateisExists(hotel.HotelID, hotel.HotelName);

            if (isExists == false)
            {
                var m_hotel = _hotelService.GetByID(hotel.HotelID);
                m_hotel.HotelName    = hotel.HotelName;
                m_hotel.Area         = hotel.Area;
                m_hotel.Address      = hotel.Address;
                m_hotel.HotelType    = hotel.HotelType;
                m_hotel.Phone        = hotel.Phone;
                m_hotel.DeskCount    = hotel.DeskCount;
                m_hotel.Start        = hotel.Start;
                m_hotel.End          = hotel.End;
                m_hotel.Sort         = hotel.Sort;
                m_hotel.Label        = hotel.Label;
                m_hotel.LabelContent = hotel.LabelContent;
                m_hotel.Description  = hotel.Description;

                m_hotel.Letter = PinYin.GetFirstLetter(hotel.HotelName.ToString());

                int result = _hotelService.Update(m_hotel);
                if (result > 0)
                {
                    ajax.IsSuccess = true;
                    ajax.Message   = "修改成功";
                }
            }
            else
            {
                ajax.Message = "酒店名称已经存在";
            }


            return(ajax);
        }