日期:2014-05-17 浏览次数:20548 次
List<Department> temp = deptBranch.Intersect(deptList).ToList();
if (deptBranch.Intersect(deptList).ToList().Count() >= 2)
continue;
public static bool AddTask(Task task,int[] deptArr=null)
{
try
{
using (var db = new WEBVODEntities())
{
string loginName = CurrentProject.GetCurrentUser().LoginName;
//添加-Task-对象
task.TimeCreate = DateTime.Now;
task.ManCreate = loginName;
task.LoginName = loginName;
task.Guid = Guid.NewGuid().ToString();
db.Task.AddObject(task);
//添加-部门-任务
if (deptArr != null && (task.TypeId == Constants.TaskType_Global || task.TypeId == Constants.TaskType_Local))
{
List<Department> deptList = db.Department.Where(a => deptArr.Contains(a.Id)).OrderBy(a=>a.Level).ToList(); //级别高的排前边
//添加-TaskDept-对象
foreach (var dept in deptList)