111
pzy
2024-09-05 4e5110a22f9c72546a593f5073a41557b64f8f52
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using SQLHelper;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Http;
using WebAPI.Models.SBGL.SBBB;
 
namespace WebAPI.DLL.SBGL.SBBB
{
    public class Sb_EquipMentCollectionTechParam_Ctl: DBUtility.ClsGy_Base_Ctl
    {
        //数据库
        SQLHelper.ClsCN oCn;
        //数据对象创建
        private Sb_EquipMentCollectionTechParam oModel;
 
        /// <summary>
        /// 新增
        /// </summary>
        /// <returns></returns>
        public override bool AddNew()
        {
            //开启事务
            oCn.BeginTran();
 
            try
            {
                //调用SQL
                oCn.RunProc("insert into " + MvarItemKey +
                    "(HDate, HSourceCode, HTechParamID, HTechParamName, HCount" +
                    ", HCreateTime, HResult, HProcNumber, HFlag)" +
                    "values('" + DateTime.Now + "','" + oModel.HSourceCode + "'," + oModel.HTechParamID + ",'" +
                    oModel.HTechParamName + "'," + oModel.HCount + ",'" + DateTime.Now + "','" + oModel.HResult +
                    "','" + oModel.HProcNumber + "','" + Convert.ToString(oModel.HFlag ? 1 : 0) + "')"
                    , ref DBUtility.ClsPub.sExeReturnInfo);
 
                //提交事务
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                //回滚事务
                oCn.RollBack();
                throw(e);
            }
 
        }
 
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="sItemID"></param>
        /// <returns></returns>
        public override bool ModifyByID(long sItemID)
        {
            try
            {
                //开启事务
                oCn.BeginTran();
 
                //调用SQL
                oCn.RunProc("Update " + MvarItemKey + "set " +
                    " HDate = '" + oModel.HDate + "' , " + "HSourceCode = '" + oModel.HSourceCode + 
                    "'," + " HTechParamID = "  + oModel.HTechParamID + "," +
                    " HTechParamName = '" + oModel.HTechParamName + "'," + " HCount = " + oModel.HCount +
                    "," + " HCreateTime = '" + oModel.HCreateTime + "'," + " HResult = '" + oModel.HResult +
                    "',"+ "HProcNumber = '" + oModel.HProcNumber + "'," + "HFlag = " + Convert.ToString(oModel.HFlag ? 1 : 0) + 
                    "where HItemID = " + sItemID
                    , ref DBUtility.ClsPub.sExeReturnInfo);
 
                //提交事务
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                //回滚事务
                oCn.RollBack();
                throw(e);
            }
        }
 
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="oCn"></param>
        /// <param name="oModel"></param>
        public Sb_EquipMentCollectionTechParam_Ctl(ClsCN oCn, Sb_EquipMentCollectionTechParam oModel)
        {
            this.oCn = new SQLHelper.ClsCN();
            MvarItemKey = "Sb_EquipMentCollectionTechParam";
            MvarReportTitle = "设备工艺参数数采表";
            this.oModel = oModel;
        }
    }
}