Files
zszq-trs/YLErpDAL/Modules/ClientModule/ClientBookCalendarService.cs
T
2024-05-09 14:06:26 +08:00

167 lines
4.5 KiB
C#

using BaseOUDAL;
namespace YLErp.Modules.ClientCashModule
{
/// <summary>
/// 客户预约服务
/// </summary>
public class ClientBookCalendarService : ClientBaseService
{
public ClientBookCalendarService(OptUserInfo userInfo) : base(userInfo)
{
}
/// <summary>
/// 查询book_calendar
/// </summary>
public SearchListResult<BookCalendar> SearchList(ClientBookCalendarReq req)
{
var query = DbContext.book_calendar.AsNoTracking().AsQueryable();
if (req.clientid != null)
{
query = query.Where(d => d.clientid == req.clientid);
}
if (!string.IsNullOrEmpty(req.clientname))
{
query = query.Where(d => d.clientname.Contains(req.clientname));
}
if (req.workid != null)
{
query = query.Where(d => d.workid == req.workid);
}
if (!string.IsNullOrEmpty(req.workname))
{
query = query.Where(d => d.workname.Contains(req.workname));
}
if (req.appointmenttimeStart != DateTime.MinValue)
{
query = query.Where(d => d.appointmenttime >= req.appointmenttimeStart);
}
if (req.appointmenttimeEnd != DateTime.MinValue)
{
DateTime appointmenttimeTemp = req.appointmenttimeEnd.AddDays(1);
query = query.Where(d => d.appointmenttime < appointmenttimeTemp);
}
if (!string.IsNullOrEmpty(req.appointmentdesc))
{
query = query.Where(d => d.appointmentdesc.Contains(req.appointmentdesc));
}
if (req.optid != null)
{
query = query.Where(d => d.OptId == req.optid);
}
if (!string.IsNullOrEmpty(req.optname))
{
query = query.Where(d => d.OptName.Contains(req.optname));
}
if (req.optdateStart != DateTime.MinValue)
{
query = query.Where(d => d.OptDate >= req.optdateStart);
}
if (req.optdateEnd != DateTime.MinValue)
{
DateTime optdateTemp = req.optdateEnd.AddDays(1);
query = query.Where(d => d.OptDate < optdateTemp);
}
if (!string.IsNullOrEmpty(req.state))
{
query = query.Where(d => d.state.Contains(req.state));
}
if (!string.IsNullOrEmpty(req.mark))
{
query = query.Where(d => d.mark.Contains(req.mark));
}
if (string.IsNullOrEmpty(req.sidx))
{
req.sidx = "id";
req.sord = "desc";
}
SearchListResult<BookCalendar> retListResult = query.ToSearchList(req);
return retListResult;
}
}
/// <summary>
/// 客户预约查询请求
/// </summary>
public class ClientBookCalendarReq : BaseSearchReq
{
/// <summary>
/// 客户人员
/// </summary>
public int? clientid { get; set; }
/// <summary>
/// 客户名称
/// </summary>
public string clientname { get; set; }
/// <summary>
/// 双录人员信息
/// </summary>
public int? workid { get; set; }
/// <summary>
/// 双录人员
/// </summary>
public string workname { get; set; }
/// <summary>
/// 预约时间
/// </summary>
public DateTime? appointmenttime { get; set; }
public DateTime appointmenttimeStart { get; set; }
public DateTime appointmenttimeEnd { get; set; }
/// <summary>
/// 预约时间描述
/// </summary>
public string appointmentdesc { get; set; }
/// <summary>
/// 操作人_optid
/// </summary>
public int? optid { get; set; }
/// <summary>
/// 操作人_optname
/// </summary>
public string optname { get; set; }
/// <summary>
/// 操作时间_createdate
/// </summary>
public DateTime? optdate { get; set; }
public DateTime optdateStart { get; set; }
public DateTime optdateEnd { get; set; }
/// <summary>
/// 状态
/// </summary>
public string state { get; set; }
/// <summary>
/// 备注
/// </summary>
public string mark { get; set; }
}
}