Esempio n. 1
0
        public ActionResult AddHotelComm(FormCollection f)
        {
            if (f != null)
            {
                try
                {
                    iPow.Infrastructure.Data.DataSys.Sys_HotelComm hc = new Infrastructure.Data.DataSys.Sys_HotelComm();
                    #region init

                    hc.AddTime = System.DateTime.Now;
                    //hc.CommID = Bll.DbSys.Db.Sys_HotelComm.Max(e => e.CommID) + 1;
                    if (f["Content"] != null)
                    {
                        hc.Content = f["Content"];
                    }
                    if (f["HotelID"] != null)
                    {
                        hc.HotelID = int.Parse(f["HotelID"].ToString());
                    }
                    hc.Ip = iPow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                    if (hc.Ip == "::1")
                    {
                        hc.Ip = "127.0.0.1";
                    }
                    if (f["Sroce"] != null)
                    {
                        hc.Point = int.Parse(f["Sroce"].ToString());
                    }
                    hc.UserID = 0;
                    if (f["UserName"] != null)
                    {
                        hc.UserName = f["UserName"].ToString();
                    }
                    #endregion
                    hotelCommRepository.Add(hc);
                    hotelCommRepository.Uow.Commit();
                    var hotelInfo = hotelPropertyInfoRepository.GetList(e => e.ID == hc.HotelID).FirstOrDefault();
                    hotelInfo.CommCount += 1;
                    hotelPropertyInfoRepository.Uow.Commit();
                    int total = 0;
                    List <iPow.Domain.Dto.Sys_HotelCommDto>      hcs    = hotelCommSysService.GetHotelCommPageListByHotelId(hc.HotelID, 1, 5, ref total);
                    PagedList <iPow.Domain.Dto.Sys_HotelCommDto> hcList = null;
                    if (hcs != null && hcs.Count() > 0)
                    {
                        hcList = new PagedList <iPow.Domain.Dto.Sys_HotelCommDto>(hcs, 1, commPageSize, total);
                    }
                    ViewBag.hotelid = hc.HotelID;
                    return(PartialView("HotelCommListPartial", hcList));
                }
                catch
                {
                    return(Json("", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("", JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public ActionResult AddHotelComm(FormCollection f)
        {
            if (f != null)
            {
                try
                {
                    Miaow.Infrastructure.Data.DataSys.Sys_HotelComm hc = new Infrastructure.Data.DataSys.Sys_HotelComm();
                    #region init

                    hc.AddTime = System.DateTime.Now;
                    //hc.CommID = Bll.DbSys.Db.Sys_HotelComm.Max(e => e.CommID) + 1;
                    if (f["Content"] != null)
                    {
                        hc.Content = f["Content"];
                    }
                    if (f["HotelID"] != null)
                    {
                        hc.HotelID = int.Parse(f["HotelID"].ToString());
                    }
                    hc.Ip = Miaow.Infrastructure.Crosscutting.Function.StringHelper.GetRealIP();
                    if (hc.Ip == "::1")
                    {
                        hc.Ip = "127.0.0.1";
                    }
                    if (f["Sroce"] != null)
                    {
                        hc.Point = int.Parse(f["Sroce"].ToString());
                    }
                    hc.UserID = 0;
                    if (f["UserName"] != null)
                    {
                        hc.UserName = f["UserName"].ToString();
                    }
                    #endregion
                    hotelCommRepository.Add(hc);
                    hotelCommRepository.Uow.Commit();
                    var hotelInfo = hotelPropertyInfoRepository.GetList(e => e.ID == hc.HotelID).FirstOrDefault();
                    hotelInfo.CommCount += 1;
                    hotelPropertyInfoRepository.Uow.Commit();
                    int total = 0;
                    List<Miaow.Domain.Dto.Sys_HotelCommDto> hcs = hotelCommSysService.GetHotelCommPageListByHotelId(hc.HotelID, 1, 5, ref total);
                    PagedList<Miaow.Domain.Dto.Sys_HotelCommDto> hcList = null;
                    if (hcs != null && hcs.Count() > 0)
                    {
                        hcList = new PagedList<Miaow.Domain.Dto.Sys_HotelCommDto>(hcs, 1, commPageSize, total);
                    }
                    ViewBag.hotelid = hc.HotelID;
                    return PartialView("HotelCommListPartial", hcList);
                }
                catch
                {
                    return Json("", JsonRequestBehavior.AllowGet);
                }
            }
            return Json("", JsonRequestBehavior.AllowGet);
        }