ORM提供了实现持久化层的另一种模式,它采用映射元数据来描述对象关系的映射,使得ORM中间件能在任何一个应用的业务逻辑层和数据库层之间充当桥梁。

如以下示例:

  public int GetSystemAccreditMessageInfo(AccreditParam param)
{
var where = new Where<User>();
var countMesage = ;//记录提醒次数
HttpCookie cookie = HttpContext.Current.Request.Cookies["UserLogin"] as HttpCookie;
if (cookie["Login_id"] != null)
{
where.And(d => d.id == cookie["Login_id"].ToString());
}
where.And(d => d.Del_state == );
var fs = DB.Context.From<User>()
.Select(User._.All, Power._.All)
.InnerJoin<Power>((a, b) => a.Role_id == b.id)
.Where(where);
if (fs.First().Authority == "")
{
countMesage = ;
}
else if (fs.First().Authority == "")
{
countMesage = DB.Context.From<Accredit>().Where(d => d.OAuditor_signature == null || d.OAuditor_signature == "").Count();
}
else if (fs.First().Authority == "")
{
countMesage = DB.Context.From<Accredit>().Where(d => d.TAuditor_signature == null || d.TAuditor_signature == "").Count();
}
else if (fs.First().Authority == "")
{
countMesage = DB.Context.From<Accredit>().Where(d => d.OAuditor_signature == null || d.OAuditor_signature == "" || d.TAuditor_signature == null || d.TAuditor_signature == "").Count();
}
return countMesage;
}

AccreditLogic.cs

 public BaseResult AddAccreditInfo(AccreditParam param)
{
var model = new Accredit();
model.id = Guid.NewGuid().ToString();
model.Acceptance_number = param.Acceptance_number;
model.Certificate_number = param.Certificate_number;
model.Issuing_office = param.Issuing_office;
model.Issue_date = param.Issue_date;
model.Effective_date = param.Effective_date;
model.Authorization_projectname = param.Authorization_projectname;
model.Measuring_range = param.Measuring_range;
model.Accuracy = param.Accuracy;
model.Organization_name = param.Organization_name;
model.Address = param.Address;
model.Corporate_representative = param.Corporate_representative;
model.Leading_person = param.Leading_person;
model.Competent_department = param.Competent_department;
model.Authorized_area = param.Authorized_area;
model.Authorization_form = param.Authorization_form;
model.Approver = param.Approver;
model.Input_person = param.Input_person;
model.Input_unit = param.Input_unit;
model.Acceptance_date = param.Acceptance_date;
HttpCookie cookie = HttpContext.Current.Request.Cookies["UserLogin"] as HttpCookie;
if (cookie["OrgId"] != null)
{
model.OrgId = cookie["OrgId"].ToString();
}
if (cookie["OrgId"]=="63001c38-afa4-4a06-567d-0f39b6b5ca9b")
{
model.Processing_state = ;
}
model.Remarks = param.Remarks;
model.Del_state = ;
model.Time = DateTime.Now;
//model.Processing_state = param.Processing_state;
model.brand = param.brand;
var count = DB.Context.Insert<Accredit>(model);
return new BaseResult(true, model, "", count);
}
  public BaseResult UptAccreditInfo(AccreditParam param)
{
var result = GetUpdateModel(param);
if (!result.IsSuccess)
return result; var model = (Accredit)result.Data;
model.Acceptance_number = param.Acceptance_number;
model.Certificate_number = param.Certificate_number;
model.Issuing_office = param.Issuing_office;
model.Issue_date = param.Issue_date;
model.Effective_date = param.Effective_date;
model.Authorization_projectname = param.Authorization_projectname;
model.Measuring_range = param.Measuring_range;
model.Accuracy = param.Accuracy;
model.Organization_name = param.Organization_name;
model.Address = param.Address;
model.Corporate_representative = param.Corporate_representative;
model.Leading_person = param.Leading_person;
model.Competent_department = param.Competent_department;
model.Authorized_area = param.Authorized_area;
model.Authorization_form = param.Authorization_form;
model.Approver = param.Approver;
model.Input_person = param.Input_person;
model.Input_unit = param.Input_unit;
HttpCookie cookie = HttpContext.Current.Request.Cookies["UserLogin"] as HttpCookie;
if (cookie["OrgId"] != null)
{
model.OrgId = cookie["OrgId"].ToString();
}
if (cookie["OrgId"] == "63001c38-afa4-4a06-567d-0f39b6b5ca9b")
{
model.Processing_state = ;
}
model.Acceptance_date = param.Acceptance_date;
model.Remarks = param.Remarks;
model.Del_state = ;
//model.Processing_state = param.Processing_state??model.Processing_state;
model.Time = DateTime.Now;
model.brand = param.brand;
var count = DB.Context.Update(model, d => d.id == param.id);
return new BaseResult(true, model, "", count);
}

AccreditLogic.cs

ORM框架(ITDOS实战源码)的更多相关文章

  1. Spring框架之beans源码完全解析

    导读:Spring可以说是Java企业开发里最重要的技术.而Spring两大核心IOC(Inversion of Control控制反转)和AOP(Aspect Oriented Programmin ...

  2. Spring框架之事务源码完全解析

    Spring框架之事务源码完全解析   事务的定义及特性: 事务是并发控制的单元,是用户定义的一个操作序列.这些操作要么都做,要么都不做,是一个不可分割的工作单位.通过事务将逻辑相关的一组操作绑定在一 ...

  3. Android 图片加载框架Glide4.0源码完全解析(二)

    写在之前 上一篇博文写的是Android 图片加载框架Glide4.0源码完全解析(一),主要分析了Glide4.0源码中的with方法和load方法,原本打算是一起发布的,但是由于into方法复杂性 ...

  4. DotNetty网络通信框架学习之源码分析

    DotNetty网络通信框架学习之源码分析 有关DotNetty框架,网上的详细资料不是很多,有不多的几个博友做了简单的介绍,也没有做深入的探究,我也根据源码中提供的demo做一下记录,方便后期查阅. ...

  5. Spring Boot 揭秘与实战 源码分析 - 工作原理剖析

    文章目录 1. EnableAutoConfiguration 帮助我们做了什么 2. 配置参数类 – FreeMarkerProperties 3. 自动配置类 – FreeMarkerAutoCo ...

  6. Spring Boot 揭秘与实战 源码分析 - 开箱即用,内藏玄机

    文章目录 1. 开箱即用,内藏玄机 2. 总结 3. 源代码 Spring Boot提供了很多”开箱即用“的依赖模块,那么,Spring Boot 如何巧妙的做到开箱即用,自动配置的呢? 开箱即用,内 ...

  7. Dream_Spark-----Spark 定制版:005~贯通Spark Streaming流计算框架的运行源码

    Spark 定制版:005~贯通Spark Streaming流计算框架的运行源码   本讲内容: a. 在线动态计算分类最热门商品案例回顾与演示 b. 基于案例贯通Spark Streaming的运 ...

  8. 别人家的 InfluxDB 实战 + 源码剖析

    1. 前几次的分享,我们多次提到了下图中 Metrics 指标监控的 Prometheus.Grafana,而且 get 到了 influxdata 旗下的 InfluxDB 的入门技能. 本次,我们 ...

  9. Spring框架之AOP源码完全解析

    Spring框架之AOP源码完全解析 Spring可以说是Java企业开发里最重要的技术.Spring两大核心IOC(Inversion of Control控制反转)和AOP(Aspect Orie ...

随机推荐

  1. linux使用技巧,返回上一次目录

    cd - 当你一不小心,走岔了的时候,可以通过这个命令,直接找回上一次的路径.

  2. <script src="../build/browser.min.js"></script> 是用来里面babel工具把ES6的语法转成ES5

    <!DOCTYPE html> <html> <head> <script src="../build/react.js">< ...

  3. 学习笔记23—window10 64位 python2.7 安装liblinear

    最近在使用pythin,因为要使用libsvm,所以到官网去下载libsvm.官网地址为libsvm(https://www.csie.ntu.edu.tw/~cjlin/libsvm/)结果下载下来 ...

  4. 00-python语言介绍

    以下为摘录的python的介绍 Python是一种解释型语言.这就是说,与C语言和C的衍生语言不同,Python代码在运行之前不需要编译.其他解释型语言还包括PHP和Ruby. Python是动态类型 ...

  5. Memcached遇到的问题及解决办法

    1. memcached make: *** No targets specified and no makefile found. Stop. 其实是因为在安装libevent时增加了版本号导致的, ...

  6. Spring之Spel表达式

    正常业务场景一般不用这个技术,但需要知道有这么个东西支持Spring. 记忆力不好,抄了些套路代码便于以后用到. package com.paic.phssp.springtest.spel; imp ...

  7. 用R的igraph包来画蛋白质互作网络图 | PPI | protein protein interaction network | Cytoscape

    igraph语法简单,画图快速. Cytoscape专业,个性定制. 最终效果图: 当然也可以用Cytoscape来画. 参考:Network visualization with R Cytosca ...

  8. C# ftp 上传、下载、删除

    public class FtpHelper { public static readonly FtpHelper Instance = new FtpHelper(); /// <summar ...

  9. php二分法查找

    //二分查找(数组里查找某个元素) function bin_sch($array, $low, $high, $k) { if ($low <= $high) { $mid = intval( ...

  10. 『PyTorch』第三弹_自动求导

    torch.autograd 包提供Tensor所有操作的自动求导方法. 数据结构介绍 autograd.Variable 这是这个包中最核心的类. 它包装了一个Tensor,并且几乎支持所有的定义在 ...