Beispiel #1
0
 private void YearValChanged(string arg0)
 {
     if (string.IsNullOrEmpty(arg0) || !SaleTools.CheckYearValid(int.Parse(arg0)))
     {
         _cachedView.Year.text = _dateTime.Year.ToString();
     }
 }
Beispiel #2
0
        public Room GetRoomData()
        {
            if (_isDirty)
            {
                _room.SetData(_cachedView.NameInputField.text, SaleTools.SafeIntParse(_cachedView.PriceInputField.text));
            }

            return(_room);
        }
Beispiel #3
0
        public PayRecord GetData()
        {
            if (_isDirty)
            {
                _payRecord.PayTime = DateTime.Now;
                _payRecord.PayNum  = SaleTools.SafeIntParse(_cachedView.ContentInputField.text);
                _payRecord.PayType = SaleDataManager.Instance.PayTypes[_cachedView.Dropdown.value];
                _payRecord.PayDesc = _cachedView.PayTypeField.text;
                _isDirty           = false;
            }

            return(_payRecord);
        }
Beispiel #4
0
        public bool CheckDateConflict(RoomRecord checkRecord, DateTime checkInData, DateTime checkOutDate)
        {
            foreach (var record in _unFinishRecords)
            {
                if (record == checkRecord)
                {
                    continue;
                }
                if (SaleTools.IsConflict(checkInData, checkOutDate, record.CheckInDate, record.CheckOutDate))
                {
                    return(true);
                }
            }

            return(false);
        }
        protected virtual void SaveData()
        {
            _data.Id           = SaleDataManager.Instance.RecordIndex;
            _data.CreateDate   = DateTime.Now;
            _data.CheckInDate  = _checkInCtrl.GetDateTime();
            _data.CheckOutDate = _checkOutCtrl.GetDateTime();
            _data.RoomIndex    = _roomCtrl.GetVal();
            _data.RoommerName  = _roomerCtrl.GetContent();
            _data.RoommerNum   = _roomerNumCtrl.GetContent();
            _data.State        = (ERoomerState)_stateCtrl.GetVal();
            _data.Price        = SaleTools.SafeIntParse(_priceCtrl.GetContent());
            if (_data.ChangePayRecords != null)
            {
                _data.PayRecords       = _data.ChangePayRecords;
                _data.ChangePayRecords = null;
            }

            SaleDataManager.Instance.AddRoomRecord(_data);
            Messenger.Broadcast(EMessengerType.OnRoomRecordChanged);
        }
Beispiel #6
0
        protected override void SaveData()
        {
            var oldRoomIndex    = _data.RoomIndex;
            var oldCheckInDate  = _data.CheckInDate;
            var oldCheckOutDate = _data.CheckOutDate;
            var oldPayRecprds   = _data.PayRecords;

            _data.CheckInDate  = _checkInCtrl.GetDateTime();
            _data.CheckOutDate = _checkOutCtrl.GetDateTime();
            _data.RoomIndex    = _roomCtrl.GetVal();
            _data.RoommerName  = _roomerCtrl.GetContent();
            _data.RoommerNum   = _roomerNumCtrl.GetContent();
            _data.State        = (ERoomerState)_stateCtrl.GetVal();
            _data.Price        = SaleTools.SafeIntParse(_priceCtrl.GetContent());
            if (_data.ChangePayRecords != null)
            {
                _data.PayRecords       = _data.ChangePayRecords;
                _data.ChangePayRecords = null;
            }
            SaleDataManager.Instance.ChangeRecord(_data, oldRoomIndex, oldCheckInDate, oldCheckOutDate, oldPayRecprds);
            Messenger.Broadcast(EMessengerType.OnRoomRecordChanged);
        }
Beispiel #7
0
 public DateTime GetDateTime()
 {
     return(new DateTime(SaleTools.SafeIntParse(_cachedView.Year.text), SaleTools.SafeIntParse(_cachedView.Month.text),
                         SaleTools.SafeIntParse(_cachedView.Day.text), SaleTools.SafeIntParse(_cachedView.Hour.text),
                         SaleTools.SafeIntParse(_cachedView.Minute.text), 0));
 }