using System; 
 | 
using System.Collections.Generic; 
 | 
using System.ComponentModel; 
 | 
using System.Data; 
 | 
using System.Drawing; 
 | 
using System.Text; 
 | 
using System.Windows.Forms; 
 | 
  
 | 
namespace HuanXin.ERP 
 | 
{ 
 | 
    public partial class Frm_Show : Form 
 | 
    { 
 | 
        public Frm_Show() 
 | 
        { 
 | 
            InitializeComponent(); 
 | 
        } 
 | 
  
 | 
        private void ClearTool() 
 | 
        { 
 | 
            cg.CheckState = CheckState.Unchecked; 
 | 
            xs.CheckState = CheckState.Unchecked; 
 | 
            pay.CheckState = CheckState.Unchecked; 
 | 
            sc.CheckState = CheckState.Unchecked; 
 | 
            kf.CheckState = CheckState.Unchecked; 
 | 
            ys.CheckState = CheckState.Unchecked; 
 | 
            yf.CheckState = CheckState.Unchecked; 
 | 
            gy.CheckState = CheckState.Unchecked; 
 | 
            cb.CheckState = CheckState.Unchecked; 
 | 
            xt.CheckState = CheckState.Unchecked; 
 | 
            cus.CheckState = CheckState.Unchecked; 
 | 
            sup.CheckState = CheckState.Unchecked; 
 | 
        } 
 | 
  
 | 
        private void SetTool(ToolStripButton oBr) 
 | 
        { 
 | 
            oBr.CheckState = CheckState.Checked; 
 | 
            //显示子项目 
 | 
            grdList.Rows.Clear(); 
 | 
            DataSet oDs; 
 | 
            Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper(); 
 | 
            oDs = oCn.RunProcReturn("select * from xt_xtgnb where sjgnbm='" + oBr.Name + "' and menulist=1  Order by gnbm", "xt_xtgnb"); 
 | 
            if (oDs == null || oDs.Tables[0].Rows.Count == 0) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
            for (int i = 0; i < oDs.Tables[0].Rows.Count; i++) 
 | 
            { 
 | 
                grdList.Rows.Add(); 
 | 
                grdList.Rows[i].Cells["NameCol"].Value = oDs.Tables[0].Rows[i]["gnmc"].ToString(); 
 | 
                grdList.Rows[i].Cells["IDCol"].Value = oDs.Tables[0].Rows[i]["gnbm"].ToString(); 
 | 
                //如果未购买则显示灰色 
 | 
                if ( Pub_Class.ClsPub.isBool(oDs.Tables[0].Rows[i]["buyFlag"]) != true) 
 | 
                { 
 | 
                    grdList.Rows[i].DefaultCellStyle.ForeColor = Color.LightGray; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    grdList.Rows[i].DefaultCellStyle.ForeColor = Color.Black; 
 | 
                } 
 | 
                // 
 | 
            } 
 | 
            //默认将第一项目 显示出 下级项目 
 | 
            if (oDs.Tables[0].Rows.Count >= 0) 
 | 
            { 
 | 
                 
 | 
                ShowSubItems(0); 
 | 
  
 | 
            } 
 | 
  
 | 
  
 | 
        } 
 | 
  
 | 
        private void cg_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(cg); 
 | 
        } 
 | 
  
 | 
        private void xs_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(xs); 
 | 
        } 
 | 
  
 | 
        private void sc_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(sc); 
 | 
        } 
 | 
  
 | 
        private void cc_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(kf); 
 | 
        } 
 | 
  
 | 
        private void gz_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(pay); 
 | 
        } 
 | 
  
 | 
        private void Frm_Show_Load(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(cg); 
 | 
        } 
 | 
  
 | 
        private void grdList_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) 
 | 
        { 
 | 
            e.Handled = true; 
 | 
            e.PaintBackground(e.CellBounds, true); 
 | 
            e.PaintContent(e.CellBounds); 
 | 
  
 | 
        } 
 | 
  
 | 
        private void grdSub_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) 
 | 
        { 
 | 
            e.Handled = true; 
 | 
            e.PaintBackground(e.CellBounds, true); 
 | 
            e.PaintContent(e.CellBounds); 
 | 
        } 
 | 
  
 | 
        private void ShowSubItems(int sRow) 
 | 
        { 
 | 
            grdSub.Rows.Clear(); 
 | 
            DataSet oDs; 
 | 
            Pub_Class.ClsSqlHelper oCn = new Pub_Class.ClsSqlHelper(); 
 | 
            oDs = oCn.RunProcReturn("select * from xt_xtgnb where sjgnbm='" + grdList.Rows[sRow].Cells["IDCol"].Value + "' and menulist=1 Order by gnbm", "xt_xtgnb"); 
 | 
            if (oDs == null || oDs.Tables[0].Rows.Count == 0) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
            for (int i = 0; i < oDs.Tables[0].Rows.Count; i++) 
 | 
            { 
 | 
                grdSub.Rows.Add(); 
 | 
                grdSub.Rows[i].Cells["SubNameCol"].Value = oDs.Tables[0].Rows[i]["gnmc"].ToString(); 
 | 
                grdSub.Rows[i].Cells["SubNumberCol"].Value = oDs.Tables[0].Rows[i]["gnsy"].ToString(); 
 | 
                grdSub.Rows[i].Cells["SubIDCol"].Value = oDs.Tables[0].Rows[i]["gnbm"].ToString(); 
 | 
                //如果未购买则显示灰色 
 | 
                if (Pub_Class.ClsPub.isBool(oDs.Tables[0].Rows[i]["buyFlag"]) != true) 
 | 
                { 
 | 
                    grdSub.Rows[i].DefaultCellStyle.ForeColor = Color.LightGray; 
 | 
                } 
 | 
                else 
 | 
                { 
 | 
                    grdSub.Rows[i].DefaultCellStyle.ForeColor = Color.Black; 
 | 
                } 
 | 
                // 
 | 
            } 
 | 
        } 
 | 
  
 | 
        private void grdList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) 
 | 
        { 
 | 
            if (grdList.CurrentCell == null) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
            ShowSubItems(grdList.CurrentCell.RowIndex); 
 | 
        } 
 | 
  
 | 
        private void grdSub_CellDoubleClick(object sender, DataGridViewCellEventArgs e) 
 | 
        { 
 | 
            if (grdSub.CurrentCell == null) 
 | 
            { 
 | 
                return; 
 | 
            } 
 | 
            //判断颜色 
 | 
            if (grdSub.Rows[grdSub.CurrentCell.RowIndex].DefaultCellStyle.ForeColor == Color.LightGray) 
 | 
            { 
 | 
                MessageBox.Show("对不起,您尚未购买本模块,请求不被允许!"); 
 | 
                return; 
 | 
            } 
 | 
            // 
 | 
            string gnsy = grdSub.Rows[grdSub.CurrentCell.RowIndex].Cells["SubNumberCol"].Value.ToString(); 
 | 
            string gnbm = grdSub.Rows[grdSub.CurrentCell.RowIndex].Cells["SubIDCol"].Value.ToString(); 
 | 
            ClsShowMod oMod = new ClsShowMod(); 
 | 
            oMod.Zxxymk(gnsy.ToLower().Trim(), gnbm.ToLower().Trim(), this.MdiParent); 
 | 
        } 
 | 
  
 | 
        private void cb_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(cb); 
 | 
        } 
 | 
  
 | 
        private void ys_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(ys); 
 | 
        } 
 | 
  
 | 
        private void yf_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(yf); 
 | 
        } 
 | 
  
 | 
        private void bb_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(xt); 
 | 
        } 
 | 
  
 | 
        private void gy_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(gy); 
 | 
        } 
 | 
  
 | 
        private void sup_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(sup); 
 | 
        } 
 | 
  
 | 
        private void cus_Click(object sender, EventArgs e) 
 | 
        { 
 | 
            ClearTool(); 
 | 
            SetTool(cus); 
 | 
        } 
 | 
  
 | 
         
 | 
  
 | 
          
 | 
  
 | 
          
 | 
    } 
 | 
} 
 |