async protected void btnModificar_Click(object sender, EventArgs e)
        {
            if (ValidarModificar())
            {
                Models.Hotel hotelModificado = new Models.Hotel();
                Models.Hotel hotel           = new Models.Hotel()
                {
                    HOT_CODIGO    = Convert.ToInt32(txtCodigo.Text),
                    HOT_NOMBRE    = txtNombre.Text,
                    HOT_EMAIL     = txtEmail.Text,
                    HOT_DIRECCION = txtDireccion.Text,
                    HOT_CATEGORIA = drpCategoria.SelectedValue.ToString(),
                    HOT_TELEFONO  = txtTelefono.Text
                };

                hotelModificado =
                    await hotelManager.Actualizar(hotel, VG.usuarioActual.CadenaToken);

                if (hotelModificado != null)
                {
                    lblStatus.Text    = "Hotel modificado correctamente";
                    lblStatus.Visible = true;
                    InicializarControles();
                }
                else
                {
                    lblStatus.Text      = "Hubo un error al modificar el hotel";
                    lblStatus.ForeColor = Color.Maroon;
                    lblStatus.Visible   = true;
                }
            }
        }
Ejemplo n.º 2
0
        // POST: api/hotels
        public IHttpActionResult Add([FromBody] Models.Hotel hotel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Data is not valid."));
            }

            return(Ok(_hotelManager.CreateHotel(hotel)));
        }
Ejemplo n.º 3
0
        public void OnGet()
        {
            RoleId = HttpContext.Session.GetInt32(Constants.UserRoleId).Value;
            int hotelId = HttpContext.Session.GetInt32(Constants.CurrentHotel).Value;

            using (var connection = new MySqlConnection(_configuration.GetConnectionString("Default")))
            {
                Hotel = connection.QuerySingleOrDefault <Models.Hotel>("SELECT * FROM Hotel where HotelID = @HotelId;", new { HotelId = hotelId });

                Rooms = connection.Query <Models.Room>("SELECT DISTINCT BedSize, BedCount, Description FROM Room where Hotel_HotelID = @HotelId;", new { HotelId = hotelId });
            }
        }
Ejemplo n.º 4
0
        public async Task <Models.Hotel> GetHotelByIdAsync(int id)
        {
            UriBuilder builder = new UriBuilder(AppSettings.HotelsEndpoint);

            builder.AppendToPath($"Hotels/{id}");

            string uri = builder.ToString();

            Models.Hotel hotel = await _requestService.GetAsync <Models.Hotel>(uri);

            return(hotel);
        }
        private async void OnSelectHotelAsync(Models.Hotel item)
        {
            if (item != null)
            {
                var navigationParameter = new Dictionary <string, object>
                {
                    { "hotel", item },
                    { "from", From },
                    { "until", Until },
                };

                await NavigationService.NavigateToAsync <BookingHotelViewModel>(navigationParameter);
            }
        }
Ejemplo n.º 6
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Hotel = await _context.Hotel.FirstOrDefaultAsync(m => m.Id == id);

            if (Hotel == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public void OnGet()
        {
            RoleId = HttpContext.Session.GetInt32(Constants.UserRoleId).Value;
            int hotelId = HttpContext.Session.GetInt32(Constants.CurrentHotel).Value;
            int userId  = HttpContext.Session.GetInt32(Constants.UserId).Value;

            using (var connection = new MySqlConnection(_configuration.GetConnectionString("Default")))
            {
                Hotel          = connection.QuerySingleOrDefault <Models.Hotel>("SELECT * FROM Hotel where HotelID = @HotelId;", new { HotelId = hotelId });
                MyReservations = connection.Query(@"
                    SELECT * 
                    FROM Reservation res, Room r 
                    WHERE r.Hotel_HotelID = @HotelId AND res.Room_RoomID = r.RoomID AND res.User_UserID = @UserID 
                    ORDER BY res.StartDate ASC", new { HotelId = hotelId, UserId = userId });
            }
        }
Ejemplo n.º 8
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Hotel = await _context.Hotel.FindAsync(id);

            if (Hotel != null)
            {
                _context.Hotel.Remove(Hotel);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Ejemplo n.º 9
0
        //GET all hotels
        public List <Models.Hotel> GetHotels()
        {
            List <Models.Hotel> hotels = new List <Models.Hotel>();
            var result = context.Hotels.ToList();

            if (result != null)
            {
                foreach (var hotel in result)
                {
                    Models.Hotel model = new Models.Hotel();
                    model.Address       = hotel.Address;
                    model.City          = hotel.City;
                    model.ContactNo     = hotel.ContactNo;
                    model.ContactPerson = hotel.ContactPerson;
                    model.CreatedBy     = hotel.CreatedBy;
                    model.CreatedDate   = hotel.CreatedDate;
                    model.facebook      = hotel.facebook;
                    model.IsActive      = hotel.IsActive;
                    model.Name          = hotel.Name;
                    model.PinCode       = hotel.PinCode;
                    model.Twitter       = hotel.Twitter;
                    model.UpdatedBy     = hotel.UpdatedBy;
                    model.UpdatedDate   = hotel.UpdatedDate;
                    model.Website       = hotel.Website;
                    model.Id            = hotel.Id;
                    model.Rooms         = new List <Models.Room>();
                    foreach (var item in hotel.Rooms)
                    {
                        Models.Room rooms = new Models.Room();
                        rooms.HotelId     = item.HotelId;
                        rooms.Name        = item.Name;
                        rooms.Category    = item.Category;
                        rooms.Price       = item.Price;
                        rooms.IsActive    = item.IsActive;
                        rooms.CreatedBy   = item.CreatedBy;
                        rooms.CreatedDate = DateTime.Today;
                        rooms.UpdatedBy   = item.UpdatedBy;
                        rooms.UpdatedDate = DateTime.Today;
                        model.Rooms.Add(rooms);
                    }
                    hotels.Add(model);
                }
            }
            return(hotels.OrderBy(x => x.Name).ToList());
        }
Ejemplo n.º 10
0
        private Models.Hotel ParseHotel(System.Data.DataRow row)
        {
            var hot = new Models.Hotel();
            hot.Category = row["hot_categoria"].ToString();
            hot.Code = int.Parse(row["hot_codigo"].ToString());
            hot.Description = row["hot_descripcion"].ToString();
            hot.Latitude = row["hot_latitud"].ToString();
            hot.Longitude = row["hot_longitud"].ToString();
            hot.Image = row["hot_imagen"].ToString();
            hot.Name = row["hot_nombre"].ToString();
            hot.Price = new Models.Price();
            hot.Price.Board = row["hpm_regimen"].ToString();
            hot.Price.CheckIn = DateTime.Parse(row["hpm_fechaEntrada"].ToString());
            hot.Price.Nigths = int.Parse(row["HPM_noches"].ToString());
            hot.Price.Pvp = decimal.Parse(row["HPM_pvp"].ToString());

            return hot;
        }
Ejemplo n.º 11
0
        protected async void grdHoteles_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Label lblCode = (Label)grdHoteles.Rows[e.RowIndex].Cells[0].FindControl("lblCodigoHotel");

            string hotNombre    = (grdHoteles.Rows[e.RowIndex].FindControl("txtHotNombre") as TextBox).Text.Trim();
            string hotEmail     = (grdHoteles.Rows[e.RowIndex].FindControl("txtHotEmail") as TextBox).Text.Trim();
            string hotDireccion = (grdHoteles.Rows[e.RowIndex].FindControl("txtHotDireccion") as TextBox).Text.Trim();
            string hotCategoria = (grdHoteles.Rows[e.RowIndex].FindControl("drpCategoriaEdit") as DropDownList).Text;
            string hotTelefono  = (grdHoteles.Rows[e.RowIndex].FindControl("txtHotTelefono") as TextBox).Text.Trim();

            if (ValidarModificar(hotNombre, hotEmail, hotDireccion, hotCategoria, hotTelefono))
            {
                Models.Hotel hotelModificado = new Models.Hotel();
                Models.Hotel hotel           = new Models.Hotel()
                {
                    HOT_CODIGO    = Convert.ToInt32(lblCode.Text),
                    HOT_NOMBRE    = hotNombre,
                    HOT_EMAIL     = hotEmail,
                    HOT_DIRECCION = hotDireccion,
                    HOT_CATEGORIA = hotCategoria,
                    HOT_TELEFONO  = hotTelefono
                };

                hotelModificado =
                    await hotelManager.Actualizar(hotel, VG.usuarioActual.CadenaToken);

                if (hotelModificado != null)
                {
                    //ScriptManager.RegisterStartupScript(this, this.GetType(), "ModalView", "<script>$(function() { $('#successModal').modal('show'); });</script>", false);
                    lblStatus.Text    = "Hotel modificado correctamente";
                    lblStatus.Visible = true;
                    InicializarControles();
                }
                else
                {
                    lblStatus.Text      = "Hubo un error al modificar el hotel";
                    lblStatus.ForeColor = Color.Maroon;
                    lblStatus.Visible   = true;
                }

                grdHoteles.EditIndex = -1;
                InicializarControles();
            }
        }
Ejemplo n.º 12
0
        private void Save_Click(object sender, RoutedEventArgs e)
        {
            HotelsData hotelsData = new HotelsData();

            int.TryParse(textBoxTankCount.Text, out int count);
            int.TryParse(textBoxTankSize.Text, out int size);

            Hotels.Models.Hotel hotel = new Models.Hotel()
            {
                Name       = textBoxName.Text,
                TanksCount = count,
                TankSize   = size,
                Mobile     = textBoxMobile.Text,
                Address    = textBoxAdress.Text
            };

            hotelsData.AddHotel(hotel);

            MessageBox.Show("تم الحفظ");
        }
Ejemplo n.º 13
0
        // POST hotels
        public Models.Hotel AddHotel(Models.Hotel hotel)
        {
            Database.Hotel model = new Database.Hotel();
            model.Address       = hotel.Address;
            model.City          = hotel.City;
            model.ContactNo     = hotel.ContactNo;
            model.ContactPerson = hotel.ContactPerson;
            model.CreatedBy     = hotel.CreatedBy;
            model.CreatedDate   = hotel.CreatedDate;
            model.facebook      = hotel.facebook;
            model.IsActive      = hotel.IsActive;
            model.Name          = hotel.Name;
            model.PinCode       = hotel.PinCode;
            model.Twitter       = hotel.Twitter;
            model.UpdatedBy     = hotel.UpdatedBy;
            model.UpdatedDate   = hotel.UpdatedDate;
            model.Website       = hotel.Website;
            model.Rooms         = new List <Database.Room>();
            foreach (var item in hotel.Rooms)
            {
                Database.Room rooms = new Database.Room();
                // rooms.HotelId = item.HotelId;
                rooms.Name        = item.Name;
                rooms.Category    = item.Category;
                rooms.Price       = item.Price;
                rooms.IsActive    = item.IsActive;
                rooms.CreatedBy   = item.CreatedBy;
                rooms.CreatedDate = DateTime.Today;
                rooms.UpdatedBy   = item.UpdatedBy;
                rooms.UpdatedDate = DateTime.Today;
                model.Rooms.Add(rooms);
            }
            var result = context.Hotels.Add(model);

            context.SaveChanges();
            return(hotel);
        }
Ejemplo n.º 14
0
 public void Add(Models.Hotel h)
 {
     hrep.Add(h);
     Save();
 }
Ejemplo n.º 15
0
        public Collection <tcm.Hotel> GetHotels()
        {
            var fetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='tc_hotel'>
                                <attribute name='tc_masterhotelid' />
                                <attribute name='tc_hotelid' />
                                <order attribute='tc_masterhotelid' descending='false' />
                                <link-entity name='tc_location' from='tc_locationid' to='tc_locationid' visible='false' link-type='outer' alias='a'>
                                  <attribute name='tc_regionid' />
                                </link-entity>
                              </entity>
                            </fetch>";


            var    hotels       = new Collection <tcm.Hotel>();
            int    pageNumber   = 1;
            string pagingCookie = null;

            int fetchCount = 10000;

            while (true)
            {
                string xml = CreateXml(fetchXml, pagingCookie, pageNumber, fetchCount);

                FetchExpression exp     = new FetchExpression(xml);
                var             records = orgService.RetrieveMultiple(exp);
                if (records == null || records.Entities.Count == 0)
                {
                    return(null);
                }
                foreach (var item in records.Entities)
                {
                    var h = new Models.Hotel
                    {
                        Code = item["tc_masterhotelid"].ToString(),
                        Id   = item.Id.ToString()
                    };
                    if (item.Contains("a.tc_regionid"))
                    {
                        var alias = item["a.tc_regionid"];
                        if (alias != null)
                        {
                            var aliasValue = ((AliasedValue)alias).Value;
                            if (aliasValue != null)
                            {
                                h.DestinationId = ((EntityReference)aliasValue).Id.ToString();
                            }
                        }
                    }
                    hotels.Add(h);
                }
                ;

                if (records.MoreRecords)
                {
                    pageNumber++;
                    pagingCookie = records.PagingCookie;
                }
                else
                {
                    break;
                }
            }

            return(hotels);
        }
Ejemplo n.º 16
0
 public void Add(Models.Hotel h)
 {
     entities.Hotels.Add(h);
 }
Ejemplo n.º 17
0
 public void Delete(Models.Hotel h)
 {
     entities.Hotels.Remove(h);
 }
Ejemplo n.º 18
0
 public void Delete(Models.Hotel h)
 {
     hrep.Delete(h);
     Save();
 }
Ejemplo n.º 19
0
        public ActionResult Index(string id)
        {
            string key           = HotelCloud.Common.HCRequest.GetString("key");
            string hotelWeixinid = string.Empty;
            string userWeixinid  = string.Empty;

            if (!string.IsNullOrEmpty(key) && key.Contains("@"))
            {
                List <string> list = key.Split('@').ToList();
                hotelWeixinid = list[0];
                userWeixinid  = list[1];
                hotel3g.Models.Cookies.SetCookies("userWeixinNO", userWeixinid, 30, hotelWeixinid);
                ViewData["hotelWeixinid"] = hotelWeixinid;
                ViewData["userWeixinid"]  = userWeixinid;
                ViewData["generatesign"]  = WeiXin.Common.ValidateSignProduct.GenerateSign(hotelWeixinid, userWeixinid);
            }
            int hid = Convert.ToInt32(id);

            ViewData["hid"] = hid;
            string firstimgurl        = null;
            string MemberCardRuleJson = ActionController.getMemberCardIntegralRule(userWeixinid, hotelWeixinid);

            ViewData["MemberCardRuleJson"] = MemberCardRuleJson;
            Hashtable MemberCardRuleJsonobj = Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(MemberCardRuleJson);
            Hashtable ruletable             = Newtonsoft.Json.JsonConvert.DeserializeObject <Hashtable>(MemberCardRuleJsonobj["rule"].ToString());
            double    graderate             = WeiXinPublic.ConvertHelper.ToDouble(ruletable["GradeRate"]);

            ViewData["graderate"] = graderate;

            double reduce = WeiXinPublic.ConvertHelper.ToDouble(ruletable["Reduce"]);

            ViewData["reduce"] = reduce;

            int couponType = WeiXinPublic.ConvertHelper.ToInt(ruletable["CouponType"]);

            ViewData["couponType"] = couponType;

            string gradeName = WeiXinPublic.ConvertHelper.ToString(ruletable["GradeName"]);

            ViewData["gradeName"] = gradeName;

            DateTime indate  = DateTime.Now.Date;
            DateTime outdate = DateTime.Now.AddDays(1).Date;

            if (!string.IsNullOrEmpty(HCRequest.GetString("indate")) && !string.IsNullOrEmpty(HCRequest.GetString("outdate")))
            {
                if (HCRequest.getDate("outdate").Date <= DateTime.Now.Date.AddMonths(2))
                {
                    indate  = HCRequest.getDate("indate");
                    outdate = HCRequest.getDate("outdate");
                }
            }


            ViewData["indate"]  = indate;
            ViewData["outdate"] = outdate;


            ViewData["ratejson"] = ActionController.getratejson(hid, indate, outdate, hotelWeixinid, graderate, out firstimgurl, reduce, couponType);
            Models.Hotel hotel = ActionController.gethotelinfo(hid, hotelWeixinid);
            ViewData["hotel"]       = hotel;
            ViewData["firstimgurl"] = firstimgurl;


            //string commentopen = string.Empty;
            //string membershow = string.Empty;
            //string dingfangmember = string.Empty;

            //string sql = "select comment,showmemberprice,dingfang_MemberOnly from WeiXinNO with (nolock) where weixinId=@weixinId  ";
            //DataTable db_open = SQLHelper.Get_DataTable(sql, SQLHelper.GetCon(), new Dictionary<string, DBParam>()
            //        {{"weixinId",new DBParam(){ParamValue=hotelWeixinid}},

            //    });

            //if (db_open.Rows.Count > 0)
            //{
            //    commentopen = db_open.Rows[0]["comment"].ToString();
            //    membershow = db_open.Rows[0]["showmemberprice"].ToString();
            //    dingfangmember = db_open.Rows[0]["dingfang_MemberOnly"].ToString();
            //}

            //ViewData["commentopen"] = commentopen;
            //ViewData["membershow"] = membershow;
            //ViewData["dingfangmember"] = dingfangmember;


            ModuleAuthorityResponse ModuleAuthority = hotel3g.Models.DAL.AuthorityHelper.ModuleAuthority(hotelWeixinid);

            ViewData["commentopen"]    = ModuleAuthority.comment;
            ViewData["membershow"]     = ModuleAuthority.membership_price;
            ViewData["dingfangmember"] = ModuleAuthority.membership_room;

            //控制弹窗
            ViewData["memberbasics"] = ModuleAuthority.module_memberbasics;

            BaseHotelCommentInfo baseHotelCommentInfo = new BaseHotelCommentInfo();

            if (ModuleAuthority.comment == 1)
            {
                Comment comment = new Comment();
                baseHotelCommentInfo = comment.GetBaseInfo(hid);
            }
            ViewData["baseHotelCommentInfo"] = baseHotelCommentInfo;



            var memberCardCustomList = new List <Models.Home.MemberCardCustom>();
            var memberinfo           = new Repository.MemberInfo();

            if (ModuleAuthority.membership_price == 1)
            {
                memberinfo = hotel3g.Repository.MemberHelper.GetMemberInfo(hotelWeixinid);
                if (memberinfo == null)
                {
                    memberinfo = new Repository.MemberInfo();
                }
            }

            int ismember = Convert.ToBoolean(MemberCardRuleJsonobj["becomeMember"].ToString()) ? 0 : 1;

            if (ismember == 0 || ModuleAuthority.membership_price == 1)
            {
                int       customcount   = 0;
                DataTable db_CardCustom = MemberCardCustom.GetMemberCardCustomList(hotelWeixinid, out customcount, 1, 50, "", "");
                memberCardCustomList = DataTableToEntity.GetEntities <Models.Home.MemberCardCustom>(db_CardCustom).ToList();
            }


            ViewData["customlist"] = memberCardCustomList;
            ViewData["memberinfo"] = memberinfo;



            return(View());
        }