123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235 |
-
- 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 QWPlatform.SystemLibrary.LogManager;
- using PMS.BusinessModels.Product;
- namespace PMS.DBService.Product
- {
- /// <summary>
- /// 创 建 人:伍莲魁
- /// 创建日期:2018-12-10
- /// 功能描述:产品功能配置数据层
- /// </summary>
- public class Productfunservice : 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(ProductFunModel model)
- {
- model.ID = Guid.NewGuid().ToString();
- model.SetDataFactory(this.DataFactoryObject);
- return model.Insert();
- }
- public int AddInport(ProductFunModel model)
- {
- try
- {
- model.SetDataFactory(this.DataFactoryObject);
- return model.Insert();
- }
- catch (Exception ex)
- {
-
- }
- return -1;
- }
-
- /// <summary>
- /// 增加数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Add(ProductFunModel 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(ProductFunModel model)
- {
- try
- {
- model.SetDataFactory(this.DataFactoryObject);
- List<string> where = new List<string>();
- return model.Where("ID").Update("类型", "上级ID", "编码", "名称", "状态", "开发方式", "说明", "测试人NEW", "测试人IDNEW", "研发人", "研发人ID");
- }catch(Exception ex)
- {
- Logger.Instance.Error(ex.Message);
- return 0;
- }
-
-
- }
- /// <summary>
- /// 更新数据库记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Update(ProductFunModel 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(ProductFunModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- return model.Delete("ID");
- }
- /// <summary>
- /// 删除数据记录
- /// </summary>
- /// <param name="model"></param>
- /// <returns></returns>
- public int Delete(ProductFunModel 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 ProductFunModel Select(ProductFunModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- model.Select();
- return model;
- }
- /// <summary>
- /// 列表查询
- /// </summary>
- /// <returns></returns>
- public List<ProductFunModel> SelectList(ProductFunModel model)
- {
- model.SetDataFactory(this.DataFactoryObject);
- return model.SelectList<ProductFunModel>();
- }
- /// <summary>
- /// 调用存储过程
- /// </summary>
- /// <returns></returns>
- public void CallProcedure(ProductFunModel model)
- {
- this.ProcedureBuilder
- .Procedure("p_PT_产品模块功能_INSERT")
- .Paramter("ID_IN", model.ID)
- .Paramter("产品ID_IN", model.CPID)
- .Paramter("上级ID_IN", model.SJID)
- .Paramter("类型_IN", model.LX)
- .Paramter("编码_IN", model.BM)
- .Paramter("名称_IN", model.MC)
- .Paramter("状态_IN", model.ZT)
- .Paramter("开发方式_IN", model.KFFS)
- .Paramter("研发人ID_IN", model.YFRID)
- .Paramter("研发人_IN", model.YFR)
- .Paramter("测试人ID_IN", model.CSRID)
- .Paramter("测试人_IN", model.CSR)
- .Paramter("说明_IN", model.SM)
- .Execute();
- }
- public DataTable GetProductFunInfo(string id)
- {
- return this.SelectBuilder.Columns("*")
- .From("产品模块功能")
- .Where("ID", id)
- .Select();
- }
- //获取所有产品版本信息
- public DataTable GetAllProducts()
- {
- return this.SelectBuilder
- .Columns("ID")
- .Columns("名称")
- .From("产品系统配置")
- .Where("状态", 1)
- .OrderBy("编码 ASC")
- .Select();
- }
- public bool AddVersionFile(ProductVersionFileModel model)
- {
- return this.InsertBuilder.Insert("产品版本附件")
- .Column("ID", Guid.NewGuid().ToString())
- .Column("产品版本ID", model.VersionID)
- .Column("添加时间", this.DataBaseBuilder.GetDateTime)
- .Column("类型", model.Type)
- .Column("添加人", model.Name)
- .Column("附件ID", model.FileId)
- .Execute() > 0;
- }
- public bool DeleteProductVersionFile(string id)
- {
- return this.UpdateBuilder.Update("产品版本附件")
- .Where("ID", id)
- .Column("是否删除", 1)
- .Execute() > 0;
- }
- }
- }
|