public void ChangeRecord(RoomRecord data, int oldRoomIndex, DateTime oldCheckInDate, DateTime oldCheckOutDate, List <PayRecord> oldPayRecords) { if (oldRoomIndex != data.RoomIndex) { if (oldRoomIndex < Rooms.Count) { Rooms[oldRoomIndex].RemoveRecord(data); } Rooms[data.RoomIndex].AddRecord(data); } if (oldCheckInDate.GetDays() != data.CheckInDate.GetDays() || oldCheckOutDate.GetDays() != data.CheckOutDate.GetDays()) { _dataCollectHandler.ChangeDate(data, oldCheckInDate, oldCheckOutDate); } if (oldPayRecords != data.PayRecords) { _dataCollectHandler.ChangePayRecord(data, oldPayRecords); } _dataLoadHandler.ChangeRecord(data); }
public void AddData(RoomRecord roomRecord) { var endDays = roomRecord.CheckOutDate.GetDays(); var date = roomRecord.CheckInDate; while (date.GetDays() <= endDays) { var month = date.GetMonths(); if (month == CurMonth) { AddDay(date.Day); } date = date.AddDays(1); } var payRecords = roomRecord.PayRecords; foreach (var payRecord in payRecords) { if (payRecord.PayTime.GetMonths() == CurMonth) { TotalIncome += payRecord.PayNum; } } }
public void RemoveRecord(RoomRecord data) { _records.Remove(data); _id2Record.Remove(data.Id); _recordsData.RoomRecords.Remove(_recordsData.RoomRecords.Find(record => record.Id == data.Id)); SaveRecordsData(); }
private void AddMonthData(RoomRecord data, int month) { var monthData = _monthRoomRecord.GetOrCreateValue(month); if (!monthData.Contains(data)) { monthData.Add(data); } }
public void AddRecord(RoomRecord data) { data.RecordPhase = ERecordPhase.Valid; _records.Add(data); _id2Record.Add(data.Id, data); _recordsData.RoomRecords.Add(data.GetData()); _recordsData.RecordIndex++; SaveRecordsData(); }
public void RemoveRecord(RoomRecord data) { _records.Remove(data); var index = _unFinishRecords.IndexOf(data); if (index >= 0) { _unFinishRecords.RemoveAt(index); } }
public void ChangePayRecord(RoomRecord data, List <PayRecord> oldPayRecords) { _isDirty = true; foreach (var payRecord in oldPayRecords) { RemovePayRecord(payRecord); } foreach (var payRecord in data.PayRecords) { AddPayRecord(payRecord); } }
public void ChangeRecord(RoomRecord data) { for (int i = _recordsData.RoomRecords.Count - 1; i >= 0; i--) { var recordData = _recordsData.RoomRecords[i]; if (recordData.Id == data.Id) { data.GetData(_recordsData.RoomRecords[i]); SaveRecordsData(); return; } } }
public void RemoveRecord(RoomRecord data) { _isDirty = true; var startMonth = data.CheckInDate.GetMonths(); var endMonth = data.CheckOutDate.GetMonths(); for (int i = startMonth; i <= endMonth; i++) { _monthRoomRecord[i].Remove(data); } foreach (var payRecord in data.PayRecords) { RemovePayRecord(payRecord); } }
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); }
public void AddRecord(RoomRecord data) { _isDirty = true; var startMonth = data.CheckInDate.GetMonths(); var endMonth = data.CheckOutDate.GetMonths(); for (int i = startMonth; i <= endMonth; i++) { AddMonthData(data, i); } foreach (var payRecord in data.PayRecords) { AddPayRecord(payRecord); } }
protected virtual void RefreshView(object parameter) { _data = new RoomRecord(); _recordId.SetContent(SaleDataManager.Instance.RecordIndex.ToString()); _roomCtrl.SetOptions(_roomNames); _roomCtrl.SetCurVal(0); OnRoomValChanged(0); var now = DateTime.Now; _checkInCtrl.SetDate(now); _checkOutCtrl.SetDate(now.AddDays(1)); _roomerCtrl.SetContent(string.Empty); _roomerNumCtrl.SetContent(string.Empty); _stateCtrl.SetCurVal((int)ERoomerState.入住); RefreshPayInfo(); }
public void ChangeDate(RoomRecord data, DateTime oldCheckInDate, DateTime oldCheckOutDate) { _isDirty = true; var oldStartMonth = oldCheckInDate.GetMonths(); var oldEndMonth = oldCheckOutDate.GetMonths(); var newStartMonth = data.CheckInDate.GetMonths(); var newEndMonth = data.CheckOutDate.GetMonths(); if (oldStartMonth != newStartMonth || oldEndMonth != newEndMonth) { for (int i = oldStartMonth; i <= oldEndMonth; i++) { _monthRoomRecord[i].Remove(data); } for (int i = newStartMonth; i <= newEndMonth; i++) { AddMonthData(data, i); } } }
public void LoadRecordsData() { LogHelper.Debug("load sale data"); _recordsData = DataManager.Instance.LoadData <RecordsData>(_saveFilePath); if (_recordsData == null) { _recordsData = new RecordsData(); _recordsData.RecordIndex = 1; } _records.Clear(); _id2Record.Clear(); _recordsData.RoomRecords.Sort((p, q) => p.Id - q.Id); for (int i = 0; i < _recordsData.RoomRecords.Count; i++) { var record = new RoomRecord(_recordsData.RoomRecords[i]); foreach (var payRecord in record.PayRecords) { payRecord.RecordId = record.Id; } _records.Add(record); _id2Record.Add(record.Id, record); } }
protected override void OnOpen(object parameter) { base.OnOpen(parameter); _data = parameter as RoomRecord; RefreshView(); }
public void AddRoomRecord(RoomRecord data) { Rooms[data.RoomIndex].AddRecord(data); _dataCollectHandler.AddRecord(data); _dataLoadHandler.AddRecord(data); }
public void AddRecord(RoomRecord roomRecord) { _records.Add(roomRecord); _unFinishRecords.Add(roomRecord); }
public void RemoveRoomRecord(RoomRecord data) { _dataCollectHandler.RemoveRecord(data); _dataLoadHandler.RemoveRecord(data); }
public void Set(object data) { _record = data as RoomRecord; RefreshView(); }