ldj/Logical/LWorkPlan.cs

113 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using DeiNiu.wms.Data.Model;
using System.Data;
namespace DeiNiu.wms.Logical
{
[Serializable]
public class LWorkplan
{
Workplan _wpobj;
private WorkplanDetail _wdobj;
public LWorkplan()
{
Initialize();
}
public Workplan GetLWorkplan
{
get
{
return _wpobj;
}
}
public WorkplanDetail GetLWorkplanDetail
{
get
{
return _wdobj;
}
}
/// <summary>
/// get all data
/// </summary>
public DataSet GetAllData()
{
return _wpobj.Query();
}
/// <summary>
/// get all data
/// </summary>
public DataSet GetAllActiveData()
{
return _wpobj.QueryActived();
}
/// <summary>
/// 查看用户某日的工作计划是否存在存在则初始化Workplan
/// </summary>
/// <param name="empId"></param>
/// <param name="date"></param>
/// <param name="createNew">是否创建新的如果createNew=true,不存在记录则创建</param>
/// <returns></returns>
public bool CheckWorkplan(int empId,string date,bool createNew)
{
DataTable dt = _wpobj.getWorkplanByDate(empId, date);
if (dt.Rows.Count == 0 && createNew)
{
_wpobj = new Workplan();
_wpobj.wp_emp = empId;
_wpobj.wp_date = date;
_wpobj.Add();
_wdobj = new WorkplanDetail();
_wdobj.wpd_workplan = _wpobj.ID;
}
return dt.Rows.Count >0;
}
/*
private void leavetypeDsConstruct()
{
return;
}
*/
/// <summary>
/// get a record by id
/// </summary>
public void Initialize(int id)
{
_wdobj = id != 0 ? new WorkplanDetail(id) : new WorkplanDetail();
_wpobj = id != 0 ? new Workplan(_wdobj.wpd_workplan) : new Workplan();
}
/// <summary>
/// get a record by id 0
/// </summary>
public void Initialize()
{
Initialize(0);
}
/// <summary>
/// get a record by id 0
/// </summary>
public void InitializeDetail()
{
_wdobj = new WorkplanDetail();
}
public int getNexNumber(int WorkplanId)
{
return _wpobj.getNextNumber(WorkplanId);
}
}
}