using System; using System.Collections.Generic; using Pingchuan.BeijingSafeguard.DAL; using Pingchuan.BeijingSafeguard.Model; namespace Pingchuan.BeijingSafeguard.BLL { public class TaskBLL { public static void Add(int orgId, int userId, string taskId, string region, decimal longitude, decimal latitude, decimal height, decimal simulatedDuration, decimal simulatedInterval, DateTime releaseTime, int resultState, string resultMessage) { Task task = ToModel(orgId, userId, taskId, region, longitude, latitude, height, simulatedDuration, simulatedInterval, releaseTime, resultState, resultMessage); TaskDAL.Add(task); } public static List GetList(DateTime startTime, DateTime endTime) { return TaskDAL.GetList(startTime, endTime.AddDays(1)); } public static List GetList(int userId, string region, DateTime startTime, DateTime endTime, List tags) { return TaskDAL.GetList(userId, region, startTime, endTime, tags); } public static void Delete(string id) { TaskDAL.Delete(id); TagBLL.DeleteByTaskId(id); } public static List GetTaskIdByRegion(string region) { return TaskDAL.GetTaskIdByRegion(region); } public static Pagination Statistics(string typeCode, DateTime fromTime, DateTime toTime, int pageIndex, int pageSize) { toTime = toTime.AddDays(1); return TaskDAL.Statistics(typeCode, fromTime, toTime, pageIndex, pageSize); } public static Task ToModel(int orgId, int userId, string taskId, string region, decimal longitude, decimal latitude, decimal height, decimal simulatedDuration, decimal simulatedInterval, DateTime releaseTime, int resultState, string resultMessage) { return new Task { Id = taskId, OrgId = orgId, UserId = userId, Region = region, Longitude = longitude, Latitude = latitude, Height = height, SimulatedDuration = simulatedDuration, SimulatedInterval = simulatedInterval, ReleaseTime = releaseTime, CreateTime = DateTime.Now }; } } }