当前位置: 首页 > news >正文

关于WCF开发 相应流程注意事项

一、根据逻辑模型设计数据库

二、添加实体类

类前加

[Description("仲裁实体")]//用于描述实体名称
[Serializable]//表示可序列化
[DataContract]//代表数据契约  表示可在服务器端和客户端可以传送

属性前加

[DataMember]//表示可在客户端见到的成员

二、DAL层

string strConnection = NLISServiceConfigs.GetNLISServiceConfig().NLISServiceSST.ReadOnlyDBConnection;//数据库连接字符串

SqlConnection sqlConn = null;//数据库连接对象

SqlTransaction sqlTran = null;//事物对象

SqlCommand command = null;//数据库命令对象
#endregion

#region 添加
/// <summary>
/// 添加仲裁信息
/// </summary>
/// <param name="BI">仲裁对象</param>
/// <returns></returns>
public int Add(SST_Arbitration BI)
{
int result = 0;
try
{
//输出结果参数
SqlParameter para_Result = new SqlParameter("@Result", SqlDbType.Int);
para_Result.Direction = ParameterDirection.Output;
//输出参数,返回插入数据成功后的最新仲裁编号
SqlParameter para_ArbitrationID = new SqlParameter("@ArbitrationID", SqlDbType.BigInt);
para_ArbitrationID.Direction = ParameterDirection.Output;
//关联ID
SqlParameter para_ArbitrationOrderID = new SqlParameter("@ArbitrationOrderID", BI.ArbitrationOrderID);
//申请人
SqlParameter para_ArbitrationApplyUserID = new SqlParameter("@ArbitrationApplyUserID", BI.ArbitrationApplyUserID);
//申请时间
SqlParameter para_ArbitrationApplyTime = new SqlParameter("@ArbitrationApplyTime", DateTime.Now);
//申请原因
SqlParameter para_ArbitrationApplyReason = new SqlParameter("@ArbitrationApplyReason", BI.ArbitrationApplyReason);
//类型(索酬=0、索赔=1)
SqlParameter para_ArbitrationOrderType = new SqlParameter("@ArbitrationOrderType", BI.ArbitrationOrderType);
//原始金额
SqlParameter para_ArbitrationOriginalMoney = new SqlParameter("@ArbitrationOriginalMoney", BI.ArbitrationOriginalMoney);

//状态(仲裁中0、已仲裁1)
SqlParameter para_ArbitrationStatus = new SqlParameter("@ArbitrationStatus", BI.ArbitrationStatus);
//参数数组
SqlParameter[] paras = new SqlParameter[]
{
para_Result,para_ArbitrationID,para_ArbitrationOrderID,para_ArbitrationApplyUserID,
para_ArbitrationApplyTime,para_ArbitrationApplyReason,para_ArbitrationOrderType,
para_ArbitrationOriginalMoney,para_ArbitrationStatus
};
sqlConn = new SqlConnection(strConnection);
sqlConn.Open();
command = sqlConn.CreateCommand();
command.CommandType = CommandType.StoredProcedure;
//存储名称
command.CommandText = "SST.sp_ArbitrationAdd";
command.Parameters.Clear();
command.Parameters.AddRange(paras);
result = command.ExecuteNonQuery();
result = Convert.ToInt32(para_Result.Value);//得到执行结果
}
catch (Exception)
{

throw;
}
finally
{
if (sqlConn != null)
{
sqlConn.Close();
sqlConn.Dispose();
}
}
return result;
}
#endregion

三、BLL层

    public class ArbitrationService : IArbitrationService通过接口实现传送

//public interface IArbitrationService
{
/// <summary>
/// 仲裁信息的添加方法
/// </summary>
/// <param name="BI">要添加的仲裁对象</param>
/// <returns></returns>
[OperationContract]//说明该方法是服务的一部分
MessageInfo Add(SST_Arbitration BI);//

 

........................................

{

public MessageInfo Add(SST_Arbitration BI)
{
try
{
int result = _dalBI.Add(BI);

switch (result)
{
case 0://失败
_infoMessage = NLISServiceMessage.GetMessageInfoByCode("P_PUB02", SubSystemType.NLISServiceSST);
_infoMessage.Success = false;
break;
case 1://成功
_infoMessage = NLISServiceMessage.GetMessageInfoByCode("P_PUB01", SubSystemType.NLISServiceSST);
_infoMessage.Success = true;
break;
default://失败
_infoMessage = NLISServiceMessage.GetMessageInfoByCode("P_PUB02", SubSystemType.NLISServiceSST);
_infoMessage.Success = false;
break;
}
return _infoMessage;
}
catch (Exception)
{
throw;
}
}

}

转载于:https://www.cnblogs.com/eric-gms/p/3715730.html

相关文章:

  • asp.net mvc部署
  • [leetcode]_String to Integer (atoi)
  • 收到offer 7B
  • Python学习_算数运算函数
  • 【struts2】Result和ResultType
  • JVM调优[转]
  • cocos2d-x3.0 编译android出现的问题笔记  cocos2dx3.0 Android.mk No rule to make target
  • WCF学习笔记二
  • php利用新浪接口查询ip获取地理位置
  • 我的推送架构解决方案
  • Android NDK JNI C++ 13 pthread多线程
  • 铁大课表 详细设计说明书
  • 结合FireBreath在Chrome/FireFox的多进程模式下崩溃一例
  • Java多线程之Wait()和Notify()
  • [java面试]宇信易诚 广州分公司 java笔试题目回忆录
  • php的引用
  • “Material Design”设计规范在 ComponentOne For WinForm 的全新尝试!
  • 【每日笔记】【Go学习笔记】2019-01-10 codis proxy处理流程
  • 5分钟即可掌握的前端高效利器:JavaScript 策略模式
  • ES6之路之模块详解
  • java2019面试题北京
  • Laravel核心解读--Facades
  • php面试题 汇集2
  • React的组件模式
  • SQLServer之创建数据库快照
  • SQLServer之索引简介
  • TiDB 源码阅读系列文章(十)Chunk 和执行框架简介
  • 从0到1:PostCSS 插件开发最佳实践
  • 得到一个数组中任意X个元素的所有组合 即C(n,m)
  • 动态魔术使用DBMS_SQL
  • 分享一个自己写的基于canvas的原生js图片爆炸插件
  • 老板让我十分钟上手nx-admin
  • 前嗅ForeSpider教程:创建模板
  • 巧用 TypeScript (一)
  • 在weex里面使用chart图表
  • 中文输入法与React文本输入框的问题与解决方案
  • Salesforce和SAP Netweaver里数据库表的元数据设计
  • 湖北分布式智能数据采集方法有哪些?
  • ​LeetCode解法汇总2670. 找出不同元素数目差数组
  • # 飞书APP集成平台-数字化落地
  • #162 (Div. 2)
  • #我与Java虚拟机的故事#连载05:Java虚拟机的修炼之道
  • (1)常见O(n^2)排序算法解析
  • (30)数组元素和与数字和的绝对差
  • (4)logging(日志模块)
  • (JS基础)String 类型
  • (二)七种元启发算法(DBO、LO、SWO、COA、LSO、KOA、GRO)求解无人机路径规划MATLAB
  • (二十一)devops持续集成开发——使用jenkins的Docker Pipeline插件完成docker项目的pipeline流水线发布
  • (附源码)python房屋租赁管理系统 毕业设计 745613
  • (介绍与使用)物联网NodeMCUESP8266(ESP-12F)连接新版onenet mqtt协议实现上传数据(温湿度)和下发指令(控制LED灯)
  • (九)c52学习之旅-定时器
  • (六)软件测试分工
  • (论文阅读40-45)图像描述1
  • (五)IO流之ByteArrayInput/OutputStream
  • (一)appium-desktop定位元素原理