YL
2022-02-21 a905b3df0d0c9ae045b51d1299fbb2f2dcbc2e2d
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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);
        }
 
        
 
         
 
         
    }
}