using BaseOUDAL;
namespace YLErp.Modules.ClientCashModule
{
///
/// 客户预约服务
///
public class ClientBookCalendarService : ClientBaseService
{
public ClientBookCalendarService(OptUserInfo userInfo) : base(userInfo)
{
}
///
/// 查询book_calendar
///
public SearchListResult 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 retListResult = query.ToSearchList(req);
return retListResult;
}
}
///
/// 客户预约查询请求
///
public class ClientBookCalendarReq : BaseSearchReq
{
///
/// 客户人员
///
public int? clientid { get; set; }
///
/// 客户名称
///
public string clientname { get; set; }
///
/// 双录人员信息
///
public int? workid { get; set; }
///
/// 双录人员
///
public string workname { get; set; }
///
/// 预约时间
///
public DateTime? appointmenttime { get; set; }
public DateTime appointmenttimeStart { get; set; }
public DateTime appointmenttimeEnd { get; set; }
///
/// 预约时间描述
///
public string appointmentdesc { get; set; }
///
/// 操作人_optid
///
public int? optid { get; set; }
///
/// 操作人_optname
///
public string optname { get; set; }
///
/// 操作时间_createdate
///
public DateTime? optdate { get; set; }
public DateTime optdateStart { get; set; }
public DateTime optdateEnd { get; set; }
///
/// 状态
///
public string state { get; set; }
///
/// 备注
///
public string mark { get; set; }
}
}