using System; 
 | 
using System.Collections.Generic; 
 | 
using System.Text; 
 | 
using System.Data; 
 | 
using SQLHelper; 
 | 
  
 | 
namespace DBUtility 
 | 
{ 
 | 
    class ClsXt_BillTypeHlp : IDisposable 
 | 
    { 
 | 
        private string mvarReportTitle; 
 | 
  
 | 
        public string MvarReportTitle 
 | 
        { 
 | 
            get { return mvarReportTitle; } 
 | 
            set { mvarReportTitle = value; } 
 | 
        } 
 | 
        public string WherePart; 
 | 
        public string ClsName; 
 | 
        // 
 | 
        ClsCN oCN = new ClsCN(); 
 | 
        public long HItemID; 
 | 
        public string HNumber; 
 | 
        public string HName; 
 | 
        public string HTemplate; 
 | 
        public string HHeadTable; 
 | 
        public string HEntryTable; 
 | 
        public string MvarItemKey; 
 | 
        // 
 | 
         
 | 
        // 
 | 
        public ClsXt_BillTypeHlp() 
 | 
        { 
 | 
            mvarReportTitle = "单据类型资料设置"; 
 | 
            ClsName = "单据类型资料"; 
 | 
            MvarItemKey = "22222"; 
 | 
        } 
 | 
        // 
 | 
        public void Dispose() 
 | 
        { 
 | 
            GC.SuppressFinalize(this); 
 | 
        } 
 | 
        // 
 | 
        //帮助 
 | 
        //帮助 
 | 
        public virtual bool RefreshView(string sLike) 
 | 
        { 
 | 
            try 
 | 
            {// 
 | 
                Pub_Control.frmHlpInfo_View ofrm = new Pub_Control.frmHlpInfo_View(); 
 | 
                // 
 | 
                string sSQL = " select HitemID,HNumber,HName from Xt_BillType order by hnumber"; 
 | 
                //编辑ofrm 
 | 
                ofrm.sTitle = MvarReportTitle; 
 | 
                ofrm.sBill = MvarItemKey; 
 | 
                ofrm.txtFindInfo.Text = WherePart; 
 | 
                //编辑ofrm GRID 
 | 
  
 | 
                // 
 | 
                DataSet Ds; 
 | 
                Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper(); 
 | 
                Ds = oCn.RunProcReturn(sSQL, MvarItemKey); 
 | 
                if (Ds == null || Ds.Tables[0].Rows.Count == 0) 
 | 
                { 
 | 
                    return false; 
 | 
                } 
 | 
  
 | 
                //绑定 
 | 
                ofrm.grdShow.DataSource = Ds.Tables[0].DefaultView; 
 | 
                Ds.Dispose(); 
 | 
                Ds = null; 
 | 
                ofrm.grdShow.SuspendLayout(); 
 | 
                ofrm.grdShow.Columns[0].Visible = false; 
 | 
                ofrm.ShowDialog(); 
 | 
                //得到对应列  
 | 
                int HItemIDCol = 0; 
 | 
                int HNumberCol = 1; 
 | 
                int HNameCol = 2; 
 | 
                // 
 | 
                if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) 
 | 
                { 
 | 
                    HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[0].Value); 
 | 
                    HNumber = Pub_Class.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[1].Value); 
 | 
                    HName = Pub_Class.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[2].Value); 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    return false; 
 | 
                } 
 | 
                // 
 | 
                ofrm.Dispose(); 
 | 
                ofrm = null; 
 | 
                // 
 | 
                return true; 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                throw (e); 
 | 
            } 
 | 
  
 | 
            //try 
 | 
            //{// 
 | 
            //    Pub_Control.frmHlpTree ofrm = new Pub_Control.frmHlpTree(); 
 | 
            //    // 
 | 
            //    string sSQL = " select HitemID,HNumber,HName from Xt_BillType order by hnumber"; 
 | 
            //    //编辑ofrm 
 | 
            //    ofrm.sTitle = MvarReportTitle; 
 | 
            //    ofrm.sBill = MvarItemKey; 
 | 
            //    ofrm.txtFindInfo.Text = WherePart; 
 | 
            //    //编辑ofrm GRID 
 | 
            //    ofrm.grdMain.Cols = 3; 
 | 
            //    ofrm.grdMain.FixedRows = 1; 
 | 
            //    ofrm.grdMain.Rows = ofrm.grdMain.FixedRows; 
 | 
            //    ofrm.grdMain.set_TextMatrix(0, 1, MvarReportTitle + "代码"); 
 | 
            //    ofrm.grdMain.set_TextMatrix(0, 2, MvarReportTitle + "名称"); 
 | 
            //    ofrm.grdMain.set_ColHidden(0, true); 
 | 
            //    ofrm.grdMain.set_FixedAlignment(-1, VSFlex7.AlignmentSettings.flexAlignCenterCenter); 
 | 
            //    // 
 | 
            //    DataSet Ds; 
 | 
            //    Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper(); 
 | 
            //    Ds = oCn.RunProcReturn(sSQL, MvarItemKey); 
 | 
            //    if (Ds == null || Ds.Tables[0].Rows.Count == 0) 
 | 
            //    { 
 | 
            //        return false; 
 | 
            //    } 
 | 
            //    for (int i = ofrm.grdMain.FixedRows - 1; i < Ds.Tables[0].Rows.Count; i++) 
 | 
            //    { 
 | 
            //        ofrm.grdMain.Rows = ofrm.grdMain.Rows + 1; 
 | 
            //        ofrm.grdMain.set_TextMatrix(ofrm.grdMain.Rows - 1, 0, Ds.Tables[0].Rows[i][0].ToString()); 
 | 
            //        ofrm.grdMain.set_TextMatrix(ofrm.grdMain.Rows - 1, 1, Ds.Tables[0].Rows[i][1].ToString()); 
 | 
            //        ofrm.grdMain.set_TextMatrix(ofrm.grdMain.Rows - 1, 2, Ds.Tables[0].Rows[i][2].ToString()); 
 | 
            //    } 
 | 
            //    Ds.Dispose(); 
 | 
            //    Ds = null; 
 | 
  
 | 
            //    ofrm.ShowDialog(); 
 | 
            //    //得到对应列  
 | 
            //    int HItemIDCol = 0; 
 | 
            //    int HNumberCol = 1; 
 | 
            //    int HNameCol = 2; 
 | 
            //    // 
 | 
            //    if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) 
 | 
            //    { 
 | 
            //        HItemID = Pub_Class.ClsPub.isLong(ofrm.grdMain.get_ValueMatrix(ofrm.grdMain.Row, 0)); 
 | 
            //        HNumber = ofrm.grdMain.get_TextMatrix(ofrm.grdMain.Row, 1); 
 | 
            //        HName = ofrm.grdMain.get_TextMatrix(ofrm.grdMain.Row, 2); 
 | 
            //    } 
 | 
            //    else 
 | 
            //    { 
 | 
            //        return false; 
 | 
            //    } 
 | 
            //    // 
 | 
            //    ofrm.Dispose(); 
 | 
            //    ofrm = null; 
 | 
            //    // 
 | 
            //    return true; 
 | 
            //} 
 | 
            //catch (Exception e) 
 | 
            //{ 
 | 
            //    throw (e); 
 | 
            //} 
 | 
        } 
 | 
        //返回项目信息 
 | 
        public bool GetInfoByID(long sItemID) 
 | 
        { 
 | 
            DataSet DS ; 
 | 
            try 
 | 
            { 
 | 
                DS = oCN.RunProcReturn("Select * from Xt_BillType Where HItemID='" + sItemID + "'", "Xt_BillType"); 
 | 
                if (DS.Tables[0].Rows.Count  == 0) 
 | 
                    return false; 
 | 
                else 
 | 
                { 
 | 
                    HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); 
 | 
                    HNumber = DS.Tables[0].Rows[0]["HNumber"].ToString().Trim(); 
 | 
                    HName = DS.Tables[0].Rows[0]["HName"].ToString().Trim(); 
 | 
                    HTemplate = DS.Tables[0].Rows[0]["HTemplate"].ToString().Trim(); 
 | 
                    HHeadTable = DS.Tables[0].Rows[0]["HHeadTable"].ToString().Trim(); 
 | 
                    HEntryTable = DS.Tables[0].Rows[0]["HEntryTable"].ToString().Trim(); 
 | 
                    // 
 | 
                    DS = null; 
 | 
                    // 
 | 
                    return true; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                return false; 
 | 
            } 
 | 
        } 
 | 
        //根据代码返回项目信息 
 | 
        public bool GetInfoByNumber(string  sNumber) 
 | 
        { 
 | 
            DataSet DS ; 
 | 
            try 
 | 
            { 
 | 
                DS = oCN.RunProcReturn("Select * from Xt_BillType Where HNumber='" + sNumber + "'", "Xt_BillType"); 
 | 
                if (DS.Tables[0].Rows.Count == 0) 
 | 
                    return false; 
 | 
                else 
 | 
                { 
 | 
                    HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); 
 | 
                    HNumber = DS.Tables[0].Rows[0]["HNumber"].ToString().Trim(); 
 | 
                    HName = DS.Tables[0].Rows[0]["HName"].ToString().Trim(); 
 | 
                    HTemplate = DS.Tables[0].Rows[0]["HTemplate"].ToString().Trim(); 
 | 
                    HHeadTable = DS.Tables[0].Rows[0]["HHeadTable"].ToString().Trim(); 
 | 
                    HEntryTable = DS.Tables[0].Rows[0]["HEntryTable"].ToString().Trim(); 
 | 
                    // 
 | 
                    DS = null; 
 | 
                    // 
 | 
                    return true; 
 | 
                } 
 | 
            } 
 | 
            catch (Exception e) 
 | 
            { 
 | 
                return false; 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
} 
 |