first commit
This commit is contained in:
118
Complex.Application/Services/Charge/ChargeCycleService.cs
Normal file
118
Complex.Application/Services/Charge/ChargeCycleService.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
// در بیسیک وجود دارد
|
||||
|
||||
|
||||
//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<Guid> 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<UnitChargeType>();
|
||||
// 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<Guid>
|
||||
// {
|
||||
// IsSuccess = true,
|
||||
// Data = CCharge.Id
|
||||
// };
|
||||
// }
|
||||
// public ResultDto<List<ChargeCycleDto>> 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<List<ChargeCycleDto>>
|
||||
// {
|
||||
// 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;
|
||||
// /// <summary>
|
||||
// /// روز از ماه برای تشویقی
|
||||
// /// </summary>
|
||||
// public int EncouragementDay { set; get; } = 0;
|
||||
// /// <summary>
|
||||
// /// مبلغ اجاره با احتساب تشویقی
|
||||
// /// </summary>
|
||||
// public long EncouragementAmount { set; get; } = 0;
|
||||
// /// <summary>
|
||||
// /// اگر برای واحدهای خاصی بود
|
||||
// /// </summary>
|
||||
// public virtual List<Guid>? UnitIds { set; get; }
|
||||
// public virtual List<string>? UnitNames { set; get; }
|
||||
// }
|
||||
//}
|
||||
Reference in New Issue
Block a user