提交 | 用户 | 时间
|
e46d3b
|
1 |
using System; |
懒 |
2 |
using System.Collections.Generic; |
|
3 |
using System.Data; |
|
4 |
using System.Data.Entity; |
|
5 |
using System.Linq; |
|
6 |
using System.Text; |
|
7 |
using YX.DAL; |
|
8 |
using YX.Entity; |
|
9 |
|
|
10 |
namespace YX.BLL |
|
11 |
{ |
|
12 |
public class SystemOrganization_Bll |
|
13 |
{ |
|
14 |
SystemOrganization_Dal org_dal = new SystemOrganization_Dal(); |
|
15 |
public List<Base_Organization>GetOrganizations() |
|
16 |
{ |
|
17 |
try |
|
18 |
{ |
|
19 |
//using (Sam_DBEntities db = new Sam_DBEntities()) |
|
20 |
//{ |
|
21 |
// return db.Base_Organization.ToList(); |
|
22 |
//} |
|
23 |
return org_dal.GetOrganizations(); |
|
24 |
} |
|
25 |
catch (Exception ex) |
|
26 |
{ |
|
27 |
|
|
28 |
throw ex; |
|
29 |
} |
|
30 |
} |
|
31 |
public DataTable GetInitParentId() |
|
32 |
{ |
|
33 |
try |
|
34 |
{ |
|
35 |
return org_dal.GetInitParentId(); |
|
36 |
} |
|
37 |
catch (Exception) |
|
38 |
{ |
|
39 |
|
|
40 |
throw; |
|
41 |
} |
|
42 |
} |
|
43 |
public List<Base_Organization> GetOrganizationDetail(string Organization_ID) |
|
44 |
{ |
|
45 |
try |
|
46 |
{ |
|
47 |
return org_dal.GetOrganizationDetail(Organization_ID); |
|
48 |
} |
|
49 |
catch (Exception) |
|
50 |
{ |
|
51 |
|
|
52 |
throw; |
|
53 |
} |
|
54 |
} |
|
55 |
/// <summary> |
|
56 |
/// 获取所在部门 |
|
57 |
/// </summary> |
|
58 |
/// <param name="User_ID"></param> |
|
59 |
/// <returns></returns> |
|
60 |
public List<Base_StaffOrganize> GetStaffOrganize(string User_ID) |
|
61 |
{ |
|
62 |
try |
|
63 |
{ |
|
64 |
//using (Sam_DBEntities db = new Sam_DBEntities()) |
|
65 |
//{ |
|
66 |
// return db.Base_StaffOrganize.Where(o => o.Base_UserInfo.User_ID == User_ID).ToList(); ; |
|
67 |
//} |
|
68 |
return org_dal.GetStaffOrganize(User_ID); |
|
69 |
} |
|
70 |
catch (Exception ex) |
|
71 |
{ |
|
72 |
|
|
73 |
throw ex; |
|
74 |
} |
|
75 |
} |
|
76 |
/// <summary> |
|
77 |
/// 添加部门 |
|
78 |
/// </summary> |
|
79 |
/// <param name="info"></param> |
|
80 |
public int AddSysOrganization(Base_Organization info) |
|
81 |
{ |
|
82 |
try |
|
83 |
{ |
|
84 |
//using (Sam_DBEntities db = new Sam_DBEntities()) |
|
85 |
//{ |
|
86 |
// db.Base_Organization.Add(info); |
|
87 |
// return db.SaveChanges(); |
|
88 |
//} |
|
89 |
return org_dal.AddSysOrganization(info); |
|
90 |
} |
|
91 |
catch (Exception) |
|
92 |
{ |
|
93 |
|
|
94 |
throw; |
|
95 |
} |
|
96 |
} |
|
97 |
/// <summary> |
|
98 |
/// 修改部门 |
|
99 |
/// </summary> |
|
100 |
/// <param name="info"></param> |
|
101 |
/// <returns></returns> |
|
102 |
public int UpdateSysOrganization(Base_Organization info) |
|
103 |
{ |
|
104 |
try |
|
105 |
{ |
|
106 |
//using (Sam_DBEntities db = new Sam_DBEntities()) |
|
107 |
//{ |
|
108 |
// db.Base_Organization.Attach(info); |
|
109 |
// //把当前实体的状态改为Modified |
|
110 |
// db.Entry(info).State = EntityState.Modified; |
|
111 |
// return db.SaveChanges(); |
|
112 |
//} |
|
113 |
return org_dal.UpdateSysOrganization(info); |
|
114 |
} |
|
115 |
catch (Exception) |
|
116 |
{ |
|
117 |
|
|
118 |
throw; |
|
119 |
} |
|
120 |
} |
|
121 |
/// <summary> |
|
122 |
/// 删除部门 |
|
123 |
/// </summary> |
|
124 |
/// <param name="key"></param> |
|
125 |
/// <returns></returns> |
|
126 |
public int DeleteSysOrganization(string key) |
|
127 |
{ |
|
128 |
try |
|
129 |
{ |
|
130 |
//using (Sam_DBEntities db = new Sam_DBEntities()) |
|
131 |
//{ |
|
132 |
// var obj = new Base_Organization { Organization_ID = key }; |
|
133 |
// db.Base_Organization.Attach(obj); |
|
134 |
// db.Base_Organization.Remove(obj); |
|
135 |
// return db.SaveChanges(); |
|
136 |
//} |
|
137 |
return org_dal.DeleteSysOrganization(key); |
|
138 |
} |
|
139 |
catch (Exception) |
|
140 |
{ |
|
141 |
|
|
142 |
throw; |
|
143 |
} |
|
144 |
} |
|
145 |
|
|
146 |
} |
|
147 |
} |