| 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; | 
|         } | 
|     } | 
| } |