예제 #1
0
        public JsonResult GetRoomInfo(int roomid)
        {
            AjaxModel result = new AjaxModel();

            try
            {
                var room = (from rom in entity.HostelRooms where rom.Id == roomid select rom).FirstOrDefault();
                if (room == null)
                {
                    result.Success = false;
                    result.Message = "Room info may be deleted or its mays be not empty.";
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                var           bedscount = (from ur in entity.User_Rooms where ur.RoomId == roomid select ur).Count();
                RoomInfoModel model     = new RoomInfoModel();
                model.Id           = roomid;
                model.NoOfBeds     = room.NoOfBeds;
                model.Floor        = room.Floor;
                model.Description  = room.Description;
                model.RoomChangres = room.RoomChangres;
                model.RoomNo       = room.RoomNo;
                model.VacantBeds   = room.NoOfBeds - bedscount;

                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                result.Success = false;
                result.Message = ex.Message;
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
        }
        public string Save(RoomInfoModel roomInfo)
        {
            int rowEffect = roomInfoGateway.Save(roomInfo);

            if (rowEffect > 0)
            {
                return("Save Successful");
            }
            else
            {
                return("Save Faild");
            }
        }
예제 #3
0
        public ActionResult Save(RoomInfoModel roomInfo)
        {
            ViewBag.categorys = roomInfoManager.GetAllCategory();
            if (roomInfoManager.IsRoomExists(roomInfo.RoomNo) != true)
            {
                ViewBag.message = roomInfoManager.Save(roomInfo);
            }
            else
            {
                ViewBag.message = "Room Already Exists";
            }

            return(View());
        }
예제 #4
0
        public int Save(RoomInfoModel roomInfo)
        {
            query = "INSERT INTO RoomInfoTable VALUES (@RoomNo,@CategoryId,@Description)";

            Command = new SqlCommand(query, Connection);

            Command.Parameters.AddWithValue("@RoomNo", roomInfo.RoomNo);
            Command.Parameters.AddWithValue("@CategoryId", roomInfo.CategoryId);
            Command.Parameters.AddWithValue("@Description", roomInfo.Description);

            Connection.Open();

            int rowEffect = Command.ExecuteNonQuery();

            Connection.Close();

            return(rowEffect);
        }
예제 #5
0
        public static List <RoomInfoModel> sel_kaifang()
        {
            List <RoomInfoModel> list = new List <RoomInfoModel>();
            DataTable            dt   = SqlHelper.DBQuery("sel_kaifang");

            foreach (DataRow row in dt.Rows)
            {
                RoomInfoModel model = new RoomInfoModel()
                {
                    RTypeID  = Convert.ToInt32(row["RTypeID"]),
                    RooType  = Convert.ToString(row["RooType"]),
                    RooID    = Convert.ToInt32(row["RooID"]),
                    Rooname  = Convert.ToString(row["Rooname"]),
                    RooPrice = Convert.ToInt32(row["RooPrice"]),
                    IsRoo    = Convert.ToBoolean(row["IsRoo"])
                };
                list.Add(model);
            }
            return(list);
        }
예제 #6
0
파일: LBH-DAL.cs 프로젝트: Yangshen888/JDGL
        public List <RoomInfoModel> getfang()
        {
            string               sql    = "select * from[JDGL].[dbo].[RoomInfo]";
            SqlDataReader        reader = SqlHelper.QueryReader(sql);
            List <RoomInfoModel> users  = new List <RoomInfoModel>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    RoomInfoModel model = new RoomInfoModel();
                    model.RooID    = Convert.ToInt32(reader["RooID"]);
                    model.RTypeID  = Convert.ToInt32(reader["RTypeID"]);
                    model.Rooname  = reader["Rooname"].ToString();
                    model.RooPrice = Convert.ToInt32(reader["RooPrice"]);
                    model.IsRoo    = Convert.ToBoolean(reader["IsRoo"]);
                    users.Add(model);
                }
            }
            return(users);
        }
예제 #7
0
        public PartialViewResult Faculty(Guid facultyId)
        {
            var model = new List <RoomInfoModel>();
            var org   = Db.Organisers.SingleOrDefault(o => o.Id == facultyId);

            if (org != null)
            {
                // Alle Räume, auf die der Veranstalter Zugriff hat
                var roomService = new MyStik.TimeTable.Web.Services.RoomService();
                var rooms       = roomService.GetRooms(org.Id, true);


                // Für jeden Raum den Status besorgen
                foreach (var room in rooms)
                {
                    var info = new RoomInfoModel
                    {
                        Room        = room,
                        CurrentDate = roomService.GetCurrentDate(room),
                        NeedInternalConfirmation = roomService.NeedInternalConfirmation(room, org.ShortName)
                    };

                    // Nächste Belegung nur dann notwendig, wenn Raum aktuell frei ist
                    if (info.CurrentDate == null)
                    {
                        info.NextDate = roomService.GetNextDate(room);
                    }

                    model.Add(info);
                }

                model = model.OrderBy(r => r.Room.Number).ToList();

                ViewBag.Organiser = org;
                ViewBag.UserRight = GetUserRight(User.Identity.Name, org.ShortName);
            }

            return(PartialView("_FacultyRoomList", model));
        }
예제 #8
0
        /// <summary>
        /// 计算
        /// </summary>
        private void Calc()
        {
            Room room = Resources.GetRes().Rooms.Where(x => x.RoomId == RoomId).FirstOrDefault();


            if (this.order.StartTime != null && this.order.EndTime != null)
            {
                TimeSpan total   = (DateTime.ParseExact(order.EndTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture) - DateTime.ParseExact(order.StartTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture));
                TimeSpan balance = (DateTime.Now - DateTime.ParseExact(order.EndTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture));


                if (room.IsPayByTime == 1)
                {
                    krplTotalTimeValue.Text = string.Format("{0}:{1}", (int)total.TotalHours, total.Minutes);
                }
                else if (room.IsPayByTime == 2)
                {
                    krplTotalTimeValue.Text = string.Format("{0}/{1}:{2}", (int)total.TotalDays, total.Hours, total.Minutes);
                }

                // 如果剩余时间已经超出了, 默认0:0显示
                if (DateTime.Now < DateTime.ParseExact(order.EndTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture))
                {
                    if (room.IsPayByTime == 1)
                    {
                        krplRemainingTimeValue.Text = string.Format("{0}:{1}", (int)balance.TotalHours, balance.Minutes);
                    }
                    else if (room.IsPayByTime == 2)
                    {
                        krplRemainingTimeValue.Text = string.Format("{0}/{1}:{2}", (int)balance.TotalDays, balance.Hours, balance.Minutes);
                    }
                }
                else
                {
                    krplRemainingTimeValue.Text = "0:0";
                }
            }
            else
            {
                TimeSpan total = (DateTime.Now - DateTime.ParseExact(order.AddTime.ToString(), "yyyyMMddHHmmss", System.Globalization.CultureInfo.InvariantCulture));



                if (room.IsPayByTime == 2)
                {
                    krplTotalTimeValue.Text = string.Format("{0}/{1}:{2}", (int)total.TotalDays, total.Hours, total.Minutes);
                }
                else
                {
                    krplTotalTimeValue.Text = string.Format("{0}:{1}", (int)total.TotalHours, total.Minutes);
                }

                krplRemainingTimeValue.Text = "0:0";
            }


            this.krplTotalPriceValue.Text = order.TotalPrice.ToString();



            order.PaidPrice = Math.Round(tempPayList.Where(x => x.State != 2 && null != x.BalanceId).Sum(x => x.OriginalPrice), 2);

            order.MemberPaidPrice = Math.Round(tempPayList.Where(x => x.State != 2 && null != x.MemberId).Sum(x => x.OriginalPrice), 2);



            this.krplMemberPaidPriceValue.Text = order.MemberPaidPrice.ToString();
            this.krplPaidPriceValue.Text       = (order.PaidPrice).ToString();

            this.krplTotalPaidPriceValue.Text = (order.TotalPaidPrice = Math.Round(order.MemberPaidPrice + order.PaidPrice, 2)).ToString();



            double balancePrice = Math.Round(order.TotalPaidPrice - order.TotalPrice, 2);

            // 客户给的钱减去原价, 剩余说明 有钱需要退回
            if (balancePrice > 0)
            {
                this.krplKeepPriceValue.StateCommon.ShortText.Color1   = Color.Blue;
                this.krplBorrowPriceValue.StateCommon.ShortText.Color1 = Color.Empty;

                this.krplKeepPriceValue.Text   = (order.KeepPrice = balancePrice).ToString();
                this.krplBorrowPriceValue.Text = (order.BorrowPrice = 0).ToString();
            }
            else if (balancePrice < 0)
            {
                this.krplKeepPriceValue.StateCommon.ShortText.Color1   = Color.Empty;
                this.krplBorrowPriceValue.StateCommon.ShortText.Color1 = Color.Red;

                this.krplBorrowPriceValue.Text = (order.BorrowPrice = balancePrice).ToString();
                this.krplKeepPriceValue.Text   = (order.KeepPrice = 0).ToString();
            }
            else if (balancePrice == 0)
            {
                this.krplBorrowPriceValue.StateCommon.ShortText.Color1 = Color.Empty;
                this.krplKeepPriceValue.StateCommon.ShortText.Color1   = Color.Empty;

                this.krplBorrowPriceValue.Text = (order.BorrowPrice = 0).ToString();
                this.krplKeepPriceValue.Text   = (order.KeepPrice = 0).ToString();
            }

            // 显示客显(实际客户需要支付的赊账)
            Common.GetCommon().OpenPriceMonitor(order.BorrowPrice.ToString());
            // 刷新第二屏幕
            if (FullScreenMonitor.Instance._isInitialized)
            {
                RoomInfoModel roomInfo = new RoomInfoModel();
                roomInfo.RoomNo    = krplRoomNoValue.Text;
                roomInfo.RoomPrice = order.RoomPrice;
                roomInfo.TotalTime = krplTotalTimeValue.Text;
                FullScreenMonitor.Instance.RefreshSecondMonitorList(new Res.View.Models.BillModel(order, null, details, roomInfo, true));
            }
        }
예제 #9
0
 private GameModelLocator()
 {
     GameModel = new BattleModel();
     RoomModel = new RoomInfoModel();
 }