123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- //using System;
- //using System.Collections.Generic;
- //using System.Linq;
- //using System.Text;
- //using QWPlatform.DataIntface;
- //using QWPlatform.IService;
- //using PMS.EntityModels.Product;
- //using System.Data;
- using PMS.EntityModels.Product;
- using QWPlatform.DataIntface;
- using QWPlatform.IService;
- using System;
- using System.Collections.Generic;
- using System.Data;
- namespace PMS.DBService.Product
- {
- /// <summary>
- /// 创 建 人:伍莲魁
- /// 创建日期:2018-12-10
- /// 功能描述:产品系统配置数据层
- /// </summary>
- public class Cpjtpzservice : DataServiceBase
- {
- /// <summary>
- /// 重写数据工厂
- /// </summary>
- /// <param name="conName"></param>
- protected override void DBFctory(string conName)
- {
- base.DBFctory(conName);
- }
- /// <summary>
- /// 增加数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Add(CPJTPZModel model)
- {
- model.ID = Guid.NewGuid().ToString();
- model.SetDataFactory(this.DataFactoryObject);
- return model.Insert();
- }
- /// <summary>
- /// 增加数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Add(CPJTPZModel model, ITransaction trans)
- {
- model.SetDataFactory(this.DataFactoryObject);
- if (trans == null)
- {
- return model.Insert();
- }
- else
- {
- return model.Insert(trans);
- }
- }
- /// <summary>
- /// 更新数据库记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Update(CPJTPZModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- List<string> where = new List<string>();
- where.Add("ID");
- return model.Update(where,"编码", "名称", "状态", "负责人ID", "负责人", "说明", "产品流程状态");
- }
- /// <summary>
- /// 更新数据库记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Update(CPJTPZModel model, ITransaction trans)
- {
- model.SetDataFactory(this.DataFactoryObject);
- List<string> where = new List<string>();
- where.Add("ID");
- if (trans == null)
- {
- return model.Update(where, string.Empty);
- }
- else
- {
- return model.Update(trans, where, string.Empty);
- }
- }
- /// <summary>
- /// 删除数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Delete(CPJTPZModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- return model.Delete("ID");
- }
- /// <summary>
- /// 删除数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Delete(CPJTPZModel model, ITransaction trans)
- {
- model.SetDataFactory(this.DataFactoryObject);
- if (trans == null)
- {
- return model.Delete("ID");
- }
- else
- {
- return model.Delete(trans, "ID");
- }
- }
- /// <summary>
- /// 查询数据对象并进行赋值
- /// </summary>
- /// <returns></returns>
- public CPJTPZModel Select(CPJTPZModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- model.Select();
- return model;
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <returns></returns>
- public List<CPJTPZModel> SelectList(CPJTPZModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- return model.SelectList<CPJTPZModel>();
- }
- /// <summary>
- /// 获取所有产品编码
- /// </summary>
- /// <returns></returns>
- public DataTable GetProductCode()
- {
- return this.SelectBuilder
- .From("产品系统配置")
- .Columns("编码,名称")
- .OrderBy("编码 ASC")
- .Select();
- }
- public DataTable GetProductCodeBycustom(string ProjectId)
- {
- return this.SelectBuilder
- .From("项目产品模块 a,产品系统配置 b")
- .Columns("b.编码,b.名称")
- .Where("a.项目ID", ProjectId)
- .Where("a.模块ID is null")
- .Where("a.产品ID=b.id")
- .OrderBy("b.编码 ASC")
- .Select();
- }
- /// <summary>
- /// 调用存储过程
- /// </summary>
- /// <returns></returns>
- public void CallProcedure(CPJTPZModel model)
- {
- this.ProcedureBuilder
- .Procedure("p_PT_产品系统配置_INSERT")
- .Paramter("ID_IN", model.ID)
- .Paramter("编码_IN", model.BM)
- .Paramter("名称_IN", model.MC)
- .Paramter("状态_IN", model.ZT)
- .Paramter("负责人ID_IN", model.FZRID)
- .Paramter("负责人_IN", model.FZR)
- .Paramter("说明_IN", model.SM)
- .Execute();
- }
- public DataTable GetProductInfoDataGrid(string search, string states)
- {
- var execute = this.ProcedureBuilder
- .Procedure("b_基础管理_产品管理.p_产品系统配置_Select")
- .Paramter("条件_In", search)
- .Paramter("状态_In", states)
- .ParamterOut("Resultlist", true);
- execute.Execute();
- var dt = execute.ParameterValue<DataTable>("Resultlist");
- return dt;
- }
- public DataTable ProductInfoCombobox()
- {
- return this.SelectBuilder.Columns("ID", "名称").From("产品系统配置").OrderBy("编码 asc").Select();
- }
- public DataTable GetProductFunctionTree(string ProductId,string search, string states)
- {
- var execute = this.ProcedureBuilder
- .Procedure("b_基础管理_产品管理.p_产品模块功能Tree_Select")
- .Paramter("开发状态_In", states)
- .Paramter("条件_In", search)
- .Paramter("产品id_In", ProductId)
- .ParamterOut("Resultlist", true);
- execute.Execute();
- var dt = execute.ParameterValue<DataTable>("Resultlist");
- return dt;
- }
- public DataTable GetProductInfo(string id)
- {
- return this.SelectBuilder.Columns("*")
- .From("产品系统配置")
- .Where("ID", id)
- .Select();
- }
- /// <summary>
- /// 根据项目ID获取产品模块
- /// </summary>
- /// <param name="id"></param>
- /// <returns></returns>
- public DataTable GetProductByProjectId(string id)
- {
- var execute = this.ProcedureBuilder
- .Procedure("b_基础管理_产品管理.p_项目产品模块_Select")
- .Paramter("项目ID_In", id)
- .ParamterOut("Resultlist", true);
- execute.Execute();
- var dt = execute.ParameterValue<DataTable>("Resultlist");
- return dt;
- }
- }
- }
|