WYB
2021-03-22 91b8cdad021ab052e4991f3d41834a6f0ddc36b8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
 
using JiepeiWMS.IServices;
using JiepeiWMS.Model.Models;
using JiepeiWMS.Services.BASE;
using JiepeiWMS.IRepository.Base;
using JiepeiWMS.Repository.Base;
using System.Threading.Tasks;
 
namespace JiepeiWMS.Services
{
    public class DepartmentServices : BaseServices<Department>, IDepartmentServices
    {
        private readonly IBaseRepository<Department> _dal;
        public DepartmentServices(IBaseRepository<Department> dal)
        {
            this._dal = dal;
            base.BaseDal = dal;
        }
 
        /// <summary>
        /// 移动到指定位置
        /// </summary>
        /// <param name="Model">被移动模型</param>
        /// <param name="MoveId">目标模型的Id</param>
        /// <returns>错误信息</returns>
        public async Task<string> Move(Department Model, int MoveId)
        {
            await _dal._TreeAutoSetValues(MoveId, Model);
            return string.Empty;
        }
 
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="Model">模型</param>
        /// <returns>主键</returns>
        public async Task<int> AddInfo(Department Model)
        {
            Model.Id = await BaseDal.Add(Model);
            await BaseDal._TreeAutoSetValues(Model);
            await BaseDal.Update(Model);
            return Model.Id;
        }
 
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="Model">模型</param>
        /// <returns>主键</returns>
        public async Task<string> EditInfo(Department Model)
        {
            await BaseDal._TreeAutoSetValues(Model);
            await BaseDal.Update(Model);
            return string.Empty;
        }
 
    }
}