/// <summary> /// Save and Update Counters /// </summary> /// <param name="counterDetails"></param> public void SaveAndUpdateCounters(CounterDTO counterDetails) { counter counterEntity = new counter(); AutoMapper.Mapper.Map(counterDetails, counterEntity); if (counterDetails.Counter_Id == 0) { ESalesUnityContainer.Container.Resolve<IGenericRepository<counter>>().Save(counterEntity); } else { ESalesUnityContainer.Container.Resolve<IGenericRepository<counter>>().Update(counterEntity); } }
private void Fixupcounter(counter previousValue) { if (previousValue != null && previousValue.bookings.Contains(this)) { previousValue.bookings.Remove(this); } if (counter != null) { if (!counter.bookings.Contains(this)) { counter.bookings.Add(this); } if (Booking_CounterId != counter.Counter_Id) { Booking_CounterId = counter.Counter_Id; } } else if (!_settingFK) { Booking_CounterId = null; } }
private void Fixupcounter(counter previousValue) { if (previousValue != null && previousValue.counterdetails.Contains(this)) { previousValue.counterdetails.Remove(this); } if (counter != null) { if (!counter.counterdetails.Contains(this)) { counter.counterdetails.Add(this); } if (CounterDetail_Counter_ID != counter.Counter_Id) { CounterDetail_Counter_ID = counter.Counter_Id; } } }
/// <summary> /// Get Counter Details By MacId /// </summary> /// <param name="macAddress">string:macAddress</param> /// <param name="userId">int32:userId</param> /// <param name="counterId">int32:counterId</param> /// <returns></returns> public CounterDTO GetCounterDetailsByMacId(string macAddress, int userId, int counterId) { CounterDTO counterDetails = new CounterDTO(); counter counterEntity = new counter(); if (userId > 0) { counterEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<counter>>() .GetSingle(item => item.Counter_IsDeleted == false && item.Counter_MAC_Id == macAddress && item.Counter_User_Id == userId); } else { if (counterId > 0) { counterEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<counter>>() .GetSingle(item => item.Counter_IsDeleted == false && item.Counter_MAC_Id == macAddress && item.Counter_Id != counterId); } else { counterEntity = ESalesUnityContainer.Container.Resolve<IGenericRepository<counter>>() .GetSingle(item => item.Counter_IsDeleted == false && item.Counter_MAC_Id == macAddress); } } AutoMapper.Mapper.Map(counterEntity, counterDetails); return counterDetails; }