public Model.RoomStatus Update(Model.RoomStatus entity)
        {
            Delete(entity.Id);
            Save(entity);

            return(entity);
        }
        public RoomStatusResult Find(long id)
        {
            Model.RoomStatus entity = Dao.Find(id);
            RoomStatusResult result = ResultConverter.Convert(entity);

            return(result);
        }
        public Model.RoomStatus Save(Model.RoomStatus entity)
        {
            RoomStatusDaoStorage.Rooms.Add(entity);
            RoomStatusDaoStorage.Dictionary.Add(entity.Id, entity);

            return(entity);
        }
        //public RoomStatusProcessor(IRoomStatusDao dao, IRoomStatusParamConverter paramConverter,
        //    IRoomStatusResultConverter resultConverter)
        //{
        //    this.Dao = dao;
        //    this.ParamConverter = paramConverter;
        //    this.ResultConverter = resultConverter;
        //}

        public RoomStatusResult Create(RoomStatusParam param)
        {
            Model.RoomStatus entity = ParamConverter.Convert(param, null);

            entity = Dao.Save(entity);

            return(ResultConverter.Convert(entity));
        }
예제 #5
0
        private void RptBind(string _strWhere, string _orderby)
        {
            _strWhere = "hotelid=" + hotelid + " " + _strWhere;

            txtKeywords.Text = this.keywords;
            DataSet ds = roomBll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow dr;

                ds.Tables[0].Columns.Add(new DataColumn("StatusStr", typeof(string)));
                int count = ds.Tables[0].Rows.Count;
                Model.RoomStatus status = Model.RoomStatus.None;
                for (int i = 0; i < count; i++)
                {
                    dr     = ds.Tables[0].Rows[i];
                    status = (Model.RoomStatus)Enum.Parse(typeof(Model.RoomStatus), dr.Field <int>("Status").ToString());

                    switch (status)
                    {
                    case Model.RoomStatus.Submit:
                        dr["StatusStr"] = "<span class=\"badge sbumit\">提交审核</span>";
                        break;

                    case Model.RoomStatus.Agree:
                        dr["StatusStr"] = "<span class=\"badge agree\">审核通过</span>";
                        break;

                    case Model.RoomStatus.Refuse:
                        dr["StatusStr"] = "<span class=\"badge refuse\">审核不通过</span>";
                        break;

                    case Model.RoomStatus.Publish:
                        dr["StatusStr"] = "<span class=\"badge publish\">已发布</span>";
                        break;

                    case Model.RoomStatus.SoldOut:
                        dr["StatusStr"] = "<span class=\"badge\">已下架</span>";
                        break;
                    }
                }
                ds.AcceptChanges();
            }
            this.rptList.DataSource = ds;
            this.rptList.DataBind();
            EnableOperate();

            //绑定页码
            txtPageNum.Text = this.pageSize.ToString();
            string pageUrl = Utils.CombUrlTxt("hotel_room.aspx", "action={0}&hotelid={1}&keywords={2}&page={3}", action, hotelid.ToString(), this.keywords, "__id__");

            PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8);
        }
예제 #6
0
        public RoomStatusResult Convert(Model.RoomStatus param)
        {
            RoomStatusResult result = new RoomStatusResult()
            {
                Id          = param.Id,
                Code        = param.Code,
                Name        = param.Name,
                Description = param.Description
            };

            return(result);
        }
        public void Update(List <RoomStatusParam> param)
        {
            //List<UniversityDemo.RoomStatus> entities = new List<UniversityDemo.RoomStatus>();

            foreach (var item in param)
            {
                Model.RoomStatus oldEntity = Dao.Find(item.Id);
                Model.RoomStatus newEntity = ParamConverter.Convert(item, null);

                Dao.Update(newEntity);
            }
        }
        public void Update(long id, RoomStatusParam param)
        {
            Model.RoomStatus oldEntity = Dao.Find(id);

            if (oldEntity != null)
            {
                Dao.Delete(oldEntity);
                Dao.Update(ParamConverter.Convert(param, null));
            }
            else
            {
                Console.WriteLine($"No entity with Id = {id}  was found");
            }
        }
        public Model.RoomStatus Convert(RoomStatusParam param, Model.RoomStatus oldEntity)
        {
            Model.RoomStatus entity = null;

            if (oldEntity != null)
            {
                entity = oldEntity;
            }
            else
            {
                entity = new Model.RoomStatus
                {
                    Code        = param.Code,
                    Id          = param.Id,
                    Description = param.Description,
                    Name        = param.Name
                };
            }

            return(entity);
        }
예제 #10
0
        public void ManageRoom(int roomid, Model.RoomStatus status, int operatorid, string operateName, string comment = "")
        {
            DAL.wx_hotel_room   roomDal = new DAL.wx_hotel_room();
            Model.wx_hotel_room model   = roomDal.GetModel(roomid);
            model.Status = status;

            using (TransactionScope scope = new TransactionScope())
            {
                roomDal.Update(model);

                Model.wx_hotel_room_manage manageInfo = new Model.wx_hotel_room_manage();
                manageInfo.RoomId      = model.id;
                manageInfo.Operator    = operatorid;
                manageInfo.OperateName = operateName;
                manageInfo.OperateTime = DateTime.Now;
                manageInfo.Comment     = comment;
                _dal.Add(manageInfo);

                scope.Complete();
            }
        }
예제 #11
0
        static RoomStatusDaoStorage()
        {
            Model.RoomStatus room1 = new Model.RoomStatus()
            {
            };

            Model.RoomStatus room2 = new Model.RoomStatus()
            {
            };

            Model.RoomStatus room3 = new Model.RoomStatus()
            {
            };

            Rooms.Add(room1);
            Rooms.Add(room2);
            Rooms.Add(room3);

            Dictionary.Add(room1.Id, room1);
            Dictionary.Add(room2.Id, room2);
            Dictionary.Add(room3.Id, room3);
        }
 public void Delete(long id)
 {
     Model.RoomStatus entity = Find(id);
     Delete(entity);
 }
 public void Delete(Model.RoomStatus entity)
 {
     RoomStatusDaoStorage.Rooms.Remove(entity);
     RoomStatusDaoStorage.Dictionary.Remove(entity.Id);
 }