// در بیسیک وجود دارد //using AutoMapper; //using Complex.Application.Utility; //using Complex.Common.Dto; //using Complex.Domain.Commons; //using Complex.Domain.Entities; //using Microsoft.EntityFrameworkCore; //using System; //using System.Collections.Generic; //using System.ComponentModel.DataAnnotations; //using System.Linq; //using System.Text; //using System.Threading.Tasks; //namespace Complex.Application.Services.Charge //{ // public class ChargeCycleService // { // /* // * ثبت آیتم مدیریت شارژ // * لیست ایتم های مدیریت شارژ // * ویرایش // */ // private readonly IComplexDBContext _complexDBContext; // private readonly IMapper _mapper; // public ChargeCycleService(IComplexDBContext complexDBContext, IMapper mapper) // { // _complexDBContext = complexDBContext; // _mapper = mapper; // } // public ResultDto InsertManageCharge(ChargeCycleDto chargeCycleDto) // { // var CCharge = new ChargeCycle // { // Amount = chargeCycleDto.Amount, // ComplexId = chargeCycleDto.ComplexId, // EncouragementAmount = chargeCycleDto.EncouragementAmount, // EncouragementDay = chargeCycleDto.EncouragementDay, // EndDate = chargeCycleDto.EndDate, // InsertTime = DateTime.Now, // StartDate = chargeCycleDto.StartDate, // Title = chargeCycleDto.Title, // }; // if (chargeCycleDto.UnitIds != null) // { // CCharge.UnitChargeTypes = new List(); // chargeCycleDto.UnitIds.ForEach(g => CCharge.UnitChargeTypes.Add(new UnitChargeType // { // ComplexId = chargeCycleDto.ComplexId, // ChargeTypeId = null, // UnitId = g // })); // } // _complexDBContext.ChargeCycles.Add(CCharge); // _complexDBContext.SaveChanges(); // return new ResultDto // { // IsSuccess = true, // Data = CCharge.Id // }; // } // public ResultDto> ChargeCyclsList(Guid ComplexId, DateTime? StartDate = null, DateTime? EndDate = null) // { // var ChargeCycleQuery = _complexDBContext.ChargeCycles.Include(c => c.UnitChargeTypes).ThenInclude(uc => uc.Unit).Where(c => c.ComplexId == ComplexId).AsQueryable(); // if (StartDate != null) // ChargeCycleQuery = ChargeCycleQuery.Where(c => c.StartDate >= StartDate); // if (EndDate != null) // ChargeCycleQuery = ChargeCycleQuery.Where(c => c.EndDate <= EndDate); // var ChargeCycleList = ChargeCycleQuery.ToList().Select(c => new ChargeCycleDto // { // ComplexId = c.ComplexId, // Amount = c.Amount, // EncouragementAmount = c.EncouragementAmount, // EncouragementDay = c.EncouragementDay, // EndDate = c.EndDate, // StartDate = c.StartDate, // Id = c.Id, // Title = c.Title, // UnitIds = c.UnitChargeTypes?.Select(u => u.UnitId).ToList(), // UnitNames = c.UnitChargeTypes?.Select(u => u.Unit.UnitId + "#" + u.Unit.UnitName).ToList(), // }).ToList(); // return new ResultDto> // { // IsSuccess = true, // RowCount= ChargeCycleList.Count, // Data= ChargeCycleList // }; // } // } // public class ChargeCycleDto // { // public Guid Id { get; set; } // public Guid ComplexId { set; get; } // public virtual ComplexEntity Complex { set; get; } // public string Title { set; get; } // public DateTime StartDate { set; get; } // public DateTime EndDate { set; get; } // public long Amount { set; get; } = 0; // /// // /// روز از ماه برای تشویقی // /// // public int EncouragementDay { set; get; } = 0; // /// // /// مبلغ اجاره با احتساب تشویقی // /// // public long EncouragementAmount { set; get; } = 0; // /// // /// اگر برای واحدهای خاصی بود // /// // public virtual List? UnitIds { set; get; } // public virtual List? UnitNames { set; get; } // } //}