using System; 
 | 
using System.Collections.Generic; 
 | 
using System.Text; 
 | 
using System.Data; 
 | 
using SQLHelper; 
 | 
  
 | 
namespace DBUtility 
 | 
{ 
 | 
    class ClsXt_BillType 
 | 
    { 
 | 
        private string _mvarItemKey; 
 | 
  
 | 
        public string MvarItemKey 
 | 
        { 
 | 
            get { return _mvarItemKey; } 
 | 
            set { _mvarItemKey = value; } 
 | 
        } 
 | 
        private string _mvarReportTitle; 
 | 
  
 | 
        public string MvarReportTitle 
 | 
        { 
 | 
            get { return _mvarReportTitle; } 
 | 
            set { _mvarReportTitle = value; } 
 | 
        } 
 | 
        ClsCN oCN = new ClsCN(); 
 | 
        public long HItemID; 
 | 
        public string HNumber; 
 | 
        public string HName; 
 | 
        public string HTemplate; 
 | 
        public string HHeadTable; 
 | 
        public string HEntryTable; 
 | 
        //新增 
 | 
        public bool AddNew() 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                oCN.BeginTran(); 
 | 
                oCN.RunProc("Insert into Xt_BillType " + 
 | 
                    " (HNumber,HName,HTemplate" + 
 | 
                    ",HHeadTable,HEntryTable) " + 
 | 
                    " Values('" + this.HNumber + "','" + this.HName + "','" + this.HTemplate.ToString() + 
 | 
                    "','" + this.HHeadTable + "','" + this.HEntryTable + "')"); 
 | 
                oCN.Commit(); 
 | 
                return true; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                oCN.RollBack(); 
 | 
                return false;  
 | 
            } 
 | 
        } 
 | 
         
 | 
        //修改 
 | 
        public bool ModifyByID(long sItemID) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                oCN.BeginTran(); 
 | 
                oCN.RunProc("Update Xt_BillType set " + 
 | 
                    " HNumber='" + this.HNumber + "'" + 
 | 
                    ",HName='" + this.HName + "'" + 
 | 
                    ",HTemplate='" + this.HTemplate + "'" + 
 | 
                    ",HHeadTable='" + this.HHeadTable + "'" + 
 | 
                    ",HEntryTable= '" + this.HEntryTable + "' Where HItemID=" + sItemID); 
 | 
                
 | 
                // 
 | 
                oCN.Commit(); 
 | 
                return true; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                oCN.RollBack(); 
 | 
                return false; 
 | 
            } 
 | 
        } 
 | 
  
 | 
  
 | 
        #region 固定代码  
 | 
        //删除 
 | 
        public bool DeleteByID(long sItemID) 
 | 
        { 
 | 
            try 
 | 
            { 
 | 
                oCN.RunProc("Delete from Xt_BillType where HItemID='" + sItemID + "'"); 
 | 
                return true; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                return false; 
 | 
            } 
 | 
        } 
 | 
        //是否存在重复代码 
 | 
        public bool HavSameNumber(long sItemID,string  sNumber) 
 | 
        { 
 | 
            DataSet DS ; 
 | 
            try 
 | 
            { 
 | 
                DS = oCN.RunProcReturn("Select HItemID from Xt_BillType Where HItemID<>'" + sItemID + "' and HNumber='" + sNumber + "'", "Xt_BillType"); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return false; 
 | 
                else 
 | 
                { 
 | 
                    return true; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                return false; 
 | 
            } 
 | 
        } 
 | 
        //构造函数 
 | 
        public ClsXt_BillType()  
 | 
        { 
 | 
            MvarItemKey="Xt_BillType"; 
 | 
            MvarReportTitle = "货币设置"; 
 | 
        } 
 | 
        #endregion 
 | 
    } 
 | 
} 
 |