首页
技术博客
PHP教程
数据库技术
前端开发
HTML5
Nginx
php论坛
新用户注册
|
会员登录
PHP教程
技术博客
编程问答
PNG素材
编程语言
前端技术
Android
PHP教程
HTML5教程
数据库
Linux技术
Nginx技术
PHP安全
WebSerer
职场攻略
JavaScript
开放平台
业界资讯
大话程序猿
登录
极速注册
取消
热门标签 | HotTags
rsa
cPlusPlus
require
metadata
tags
command
actionscrip
hashset
email
erlang
javascript
future
vbscript
select
md5
usb
post
subset
substring
request
httpclient
web3
node.js
uri
import
int
get
spring
expression
hashcode
config
io
php8
perl
express
bytecode
timezone
fetch
runtime
case
timestamp
byte
copy
cSharp
solr
settings
search
include
cookie
loops
shell
testing
dockerfile
sum
java
process
random
hash
plugins
hook
go
export
iostream
hashtable
install
dll
object
instance
stream
scala
httprequest
frameworks
uml
client
audio
buffer
controller
datetime
ascii
当前位置:
开发笔记
>
编程语言
> 正文
ASP.NET&Spring.NET&NHibernate最佳实践(五)——第3章人事子系统(2)
作者:玩在青岩堡欢乐长桌宴_840 | 来源:互联网 | 2023-10-17 16:43
3.4.人事子系统服务层(Service)部门服务接口(IDeptService.cs)usingSystem;usingGuushuuse.SalaryPrj.
3.4. 人事子系统服务层(Service)
部门服务接口(IDeptService.cs)
using
System;
using
Guushuuse.SalaryPrj.HR.DomainModel;
using
Guushuuse.SalaryPrj.HR.Dao;
using
System.Collections;
namespace
Guushuuse.SalaryPrj.HR.Service
{
/**/
///
///
部门服务接口
///
public
interface
IDeptService
{
void
CreateDept(Dept dept);
void
DeleteDept(Dept dept);
IDeptDao DeptDao
{
get
;
set
; }
IList GetAllDepts();
Dept GetDept(
int
deptID);
void
UpdateDept(Dept dept);
}
}
部门服务类(DeptService.cs)
using
System;
using
System.Collections.Generic;
using
System.Text;
using
Guushuuse.SalaryPrj.HR.Dao;
using
Guushuuse.SalaryPrj.HR.DomainModel;
using
System.Collections;
using
Spring.Transaction.Interceptor;
namespace
Guushuuse.SalaryPrj.HR.Service
{
/**/
///
///
部门服务类
///
public
class
DeptService : IDeptService
{
private
IDeptDao _deptDao;
public
IDeptDao DeptDao
{
get
{
return
_deptDao; }
set
{ _deptDao
=
value; }
}
public
DeptService()
{
}
[Transaction(ReadOnly
=
false
)]
public
void
CreateDept(Dept dept)
{
_deptDao.CreateDept(dept);
}
[Transaction(ReadOnly
=
false
)]
public
void
UpdateDept(Dept dept)
{
_deptDao.UpdateDept(dept);
}
[Transaction(ReadOnly
=
false
)]
public
void
DeleteDept(Dept dept)
{
_deptDao.DeleteDept(dept);
}
public
IList GetAllDepts()
{
return
_deptDao.GetAllDepts();
}
public
Dept GetDept(
int
deptID)
{
return
_deptDao.GetDept(deptID);
}
}
}
员工服务接口(IEmployeeService.cs)
using
System;
using
Guushuuse.SalaryPrj.HR.DomainModel;
using
Guushuuse.SalaryPrj.HR.Dao;
using
System.Collections;
namespace
Guushuuse.SalaryPrj.HR.Service
{
/**/
///
///
员工服务接口
///
public
interface
IEmployeeService
{
void
CreateEmployee(Employee employee);
void
DeleteEmployee(Employee employee);
IEmployeeDao EmployeeDao
{
get
;
set
; }
IList GetAllEmployees();
Employee GetEmployee(
int
employeeID);
void
UpdateEmployee(Employee employee);
}
}
员工服务类(EmployeeService.cs)
using
System;
using
System.Collections.Generic;
using
System.Text;
using
Guushuuse.SalaryPrj.HR.Dao;
using
Guushuuse.SalaryPrj.HR.DomainModel;
using
System.Collections;
using
Spring.Transaction.Interceptor;
namespace
Guushuuse.SalaryPrj.HR.Service
{
/**/
///
///
员工服务类
///
public
class
EmployeeService : IEmployeeService
{
private
IEmployeeDao _employeeDao;
public
IEmployeeDao EmployeeDao
{
get
{
return
_employeeDao; }
set
{ _employeeDao
=
value; }
}
public
EmployeeService()
{
}
[Transaction(ReadOnly
=
false
)]
public
void
CreateEmployee(Employee employee)
{
_employeeDao.CreateEmployee(employee);
}
[Transaction(ReadOnly
=
false
)]
public
void
UpdateEmployee(Employee employee)
{
_employeeDao.UpdateEmployee(employee);
}
[Transaction(ReadOnly
=
false
)]
public
void
DeleteEmployee(Employee employee)
{
_employeeDao.DeleteEmployee(employee);
}
public
IList GetAllEmployees()
{
return
_employeeDao.GetAllEmployees();
}
public
Employee GetEmployee(
int
employeeID)
{
return
_employeeDao.GetEmployee(employeeID);
}
}
}
服务定位类(ServiceLocator.cs)
using
System;
using
System.Collections.Generic;
using
System.Text;
using
Spring.Context;
using
Spring.Context.Support;
namespace
Guushuuse.SalaryPrj.HR.Service
{
/**/
///
///
服务定位类
///
public
class
ServiceLocator
{
private
static
IApplicationContext _ctx;
static
ServiceLocator()
{
_ctx
=
ContextRegistry.GetContext();
}
public
static
IDeptService DeptService
{
get
{
IDeptService deptService
=
_ctx[
"
deptService
"
]
as
IDeptService;
return
deptService;
}
}
public
static
IEmployeeService EmployeeService
{
get
{
IEmployeeService employeeService
=
_ctx[
"
employeeService
"
]
as
IEmployeeService;
return
employeeService;
}
}
}
}
修改Config/Guushuuse.SalaryPrj.HR.config文件,新增object
<
object
id
="deptService"
type
="Guushuuse.SalaryPrj.HR.Service.DeptService, Guushuuse.SalaryPrj.HR"
>
<
property
name
="DeptDao"
ref
="deptDao"
/>
object
>
<
object
id
="employeeService"
type
="Guushuuse.SalaryPrj.HR.Service.EmployeeService, Guushuuse.SalaryPrj.HR"
>
<
property
name
="EmployeeDao"
ref
="employeeDao"
/>
object
>
asp.net
spring
service
ide
ajax
dom
io
sum
int
写下你的评论吧 !
吐个槽吧,看都看了
会员登录
|
用户注册
推荐阅读
get
解析JSON格式文本并处理数据
本文介绍如何使用阿里云的fastjson库解析包含时间戳、IP地址和参数等信息的JSON格式文本,并进行数据处理和保存。 ...
[详细]
蜡笔小新 2024-12-26 16:06:09
get
使用 NSTimer 实现倒计时功能
本文介绍如何使用 NSTimer 实现倒计时功能,详细讲解了初始化方法、参数配置以及具体实现步骤。通过示例代码展示如何创建和管理定时器,确保在指定时间间隔内执行特定任务。 ...
[详细]
蜡笔小新 2024-12-26 19:08:19
spring
Spring Boot 解决 AJAX 跨域请求及自定义 Headers 方法
本文探讨了浏览器的同源策略限制及其对 AJAX 请求的影响,并详细介绍了如何在 Spring Boot 应用中优雅地处理跨域请求,特别是当请求包含自定义 Headers 时的解决方案。 ...
[详细]
蜡笔小新 2024-12-17 13:57:01
get
深入理解org.neo4j.helpers.collection.Iterators.single()方法及其应用
本文详细介绍了Java中org.neo4j.helpers.collection.Iterators.single()方法的功能、使用场景及代码示例,帮助开发者更好地理解和应用该方法。 ...
[详细]
蜡笔小新 2024-12-28 10:51:55
get
优化ListView性能
本文深入探讨了如何通过多种技术手段优化ListView的性能,包括视图复用、ViewHolder模式、分批加载数据、图片优化及内存管理等。这些方法能够显著提升应用的响应速度和用户体验。 ...
[详细]
蜡笔小新 2024-12-28 10:36:30
get
编写有趣的VBScript恶作剧脚本
本文将介绍如何编写一些有趣的VBScript脚本,这些脚本可以在朋友之间进行无害的恶作剧。通过简单的代码示例,帮助您了解VBScript的基本语法和功能。 ...
[详细]
蜡笔小新 2024-12-28 09:46:23
get
Handling Null Object Encoding in OAuth 1.0a API Implementation
Explore a common issue encountered when implementing an OAuth 1.0a API, specifically the inability to encode null objects and how to resolve it. ...
[详细]
蜡笔小新 2024-12-28 08:54:34
get
使用Objective-C和dispatch库实现并发素数计算
本文介绍如何使用Objective-C结合dispatch库进行并发编程,以提高素数计数任务的效率。通过对比纯C代码与引入并发机制后的代码,展示dispatch库的强大功能。 ...
[详细]
蜡笔小新 2024-12-28 08:44:35
get
DataGridView 保存时,为什么当前单元格的值无法保存?
在使用 DataGridView 时,如果在当前单元格中输入内容但光标未移开,点击保存按钮后,输入的内容可能无法保存。只有当光标离开单元格后,才能成功保存数据。本文将探讨如何通过调用 DataGridView 的内置方法解决此问题。 ...
[详细]
蜡笔小新 2024-12-27 09:27:14
int
一个登陆界面
预览截图html部分123456789101112用户登入1314邮箱名称邮箱为空15密码密码为空16登 ...
[详细]
蜡笔小新 2024-12-20 09:57:07
get
深入解析Android自定义View面试题
本文探讨了Android Launcher开发中自定义View的重要性,并通过一道经典的面试题,帮助开发者更好地理解自定义View的实现细节。文章不仅涵盖了基础知识,还提供了实际操作建议。 ...
[详细]
蜡笔小新 2024-12-28 11:15:04
get
如何在ASP.NET中操作没有runat='server'属性的HTML元素
本文探讨了在不使用服务器控件的情况下,如何通过多种方法获取并修改页面中的HTML元素值。除了常见的AJAX方式,还介绍了其他可行的技术方案。 ...
[详细]
蜡笔小新 2024-12-27 06:30:46
int
Python学习笔记:使用pydoc工具查询文档
本文介绍了在Windows环境下使用pydoc工具的方法,并详细解释了如何通过命令行和浏览器查看Python内置函数的文档。此外,还提供了关于raw_input和open函数的具体用法和功能说明。 ...
[详细]
蜡笔小新 2024-12-26 17:05:56
int
HTML 文件上传按钮的样式设计
本文详细介绍了如何使用 HTML 和 CSS 对文件上传按钮进行样式美化,使用户界面更加友好和美观。 ...
[详细]
蜡笔小新 2024-12-20 18:30:59
get
当unique验证运到图片上传时
2019独角兽企业重金招聘Python工程师标准model:public$imageFile;publicfunctionrules(){return[[[na ...
[详细]
蜡笔小新 2024-12-20 10:19:12
玩在青岩堡欢乐长桌宴_840
这个家伙很懒,什么也没留下!
Tags | 热门标签
rsa
cPlusPlus
require
metadata
tags
command
actionscrip
hashset
email
erlang
javascript
future
vbscript
select
md5
usb
post
subset
substring
request
httpclient
web3
node.js
uri
import
int
get
spring
expression
hashcode
RankList | 热门文章
1
请教一个关于Fragment结合ViewPager懒加载,加载过渡动画统一的问题,我这样写有什么问题或者可以进一步优化吗?
2
线程安全列表
3
strong reid 代码实现
4
字节跳动 录屏功能_字节跳动的ToB生意经
5
php5.2.6安装openssl.o扩展,make时报错?
6
ak和sk怎么认证 海康威视_aksk鉴权
7
大型的labview程序实例_LabVIEW
8
Java基础复习——访问权限
9
异常处理·MSSQL·在将nvarchar值‘XXX‘转换成数据类型int时失败
10
Sublime Text 2 不能编译 Python 3.4.2
11
HDUP1087:Super Jumping! Jumping! Jumping![动态规划]
12
Dockerdeepin系统下docker安装registry
13
从String PHP中删除前3个字符和后3个字符
14
Linux下/Qt UTF8转GB2312
15
内部类(成员、局部、匿名)
PHP1.CN | 中国最专业的PHP中文社区 |
DevBox开发工具箱
|
json解析格式化
|
PHP资讯
|
PHP教程
|
数据库技术
|
服务器技术
|
前端开发技术
|
PHP框架
|
开发工具
|
在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved |
京公网安备 11010802041100号
|
京ICP备19059560号-4
| PHP1.CN 第一PHP社区 版权所有