Beispiel #1
0
        public ResultModel <TaskModel> AddTaskInfo(TaskModel model)
        {
            try
            {
                model.createtime = DateTime.Now;
                model.status     = Constants.TASKSTATUS_INIT;

                int taskid = taskDal.AddTask(model);
                model.taskid = taskid;

                foreach (LocationModel item in model.locations)
                {
                    item.taskid = model.taskid;

                    locationDal.AddLocation(item);
                }

                ResultModel <TaskModel> result = new ResultModel <TaskModel>();
                result.code    = Constants.SUCCESS_CODE;
                result.message = "新增成功";

                return(result);
            }
            catch (Exception ex)
            {
                ResultModel <TaskModel> result = new ResultModel <TaskModel>();
                result.code    = Constants.ERROR_CODE;
                result.message = ex.Message;

                return(result);
            }
        }
Beispiel #2
0
        public static string AddDrive(DTO.DriveDTO drive)
        {
            Loction fromL = new Loction()
            {
                locationFormat = drive.fromLocationFormat,
                locationLat    = drive.fromLocationLat,
                locationLng    = drive.fromLocationLng
            };
            Loction FrLo = LocationDAL.AddLocation(fromL);
            Loction toL  = new Loction()
            {
                locationFormat = drive.toLocationFormat,
                locationLat    = drive.toLocationLat,
                locationLng    = drive.toLocationLng
            };
            Loction ToLo = LocationDAL.AddLocation(toL);

            Drive d = DriveConverter.convertDtoToDALDrive(drive);

            d.fromLocation = FrLo.locationId;
            d.toLocation   = ToLo.locationId;

            return(DAL.DriveDAL.AddDrive(d));
        }