コード例 #1
0
ファイル: frm그룹메뉴관리.cs プロジェクト: munsejin/MES
        private void bindData_AllMenu(string sID)
        {
            lblBody.Visible = true;
            lblBody.Text    = "Loading ...";
            Application.DoEvents();

            this.grdGet.Columns[1].HeaderText = "[ ]";
            bHeadCheck = false;

            this.grdSet.DataSource = null;
            this.grdSet.RowCount   = 0;

            this.grdGet.DataSource = null;
            this.grdGet.RowCount   = 0;

            int nRowCnt = 0;

            try
            {
                wnDm      wDm = new wnDm();
                DataTable dt  = null;
                dt = wDm.fn_AllMenu_CheckList(sID);

                if (dt != null && dt.Rows.Count > 0)
                {
                    this.grdSet.RowCount = dt.Rows.Count;
                    this.grdGet.RowCount = dt.Rows.Count;

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string sBlank = "";
                        if (dt.Rows[i]["SubID"].ToString() != "")
                        {
                            sBlank = "     ";
                        }

                        // 전체 메뉴 목록
                        this.grdGet.Rows[i].Cells[0].Value = sBlank + dt.Rows[i]["MenuName"].ToString();
                        if (dt.Rows[i]["ChkYN"].ToString() == "Y")
                        {
                            this.grdGet.Rows[i].Cells[1].Value = true;
                        }
                        else
                        {
                            if (dt.Rows[i]["SubID"].ToString() == "")
                            {
                                this.grdGet.Rows[i].Cells[1].Value           = false;
                                this.grdGet.Rows[i].Cells[1].Style.BackColor = Color.Gainsboro;
                                this.grdGet.Rows[i].Cells[1].ReadOnly        = true;
                            }
                        }
                        this.grdGet.Rows[i].Cells[2].Value = dt.Rows[i]["TopID"].ToString();
                        this.grdGet.Rows[i].Cells[3].Value = dt.Rows[i]["SubID"].ToString();

                        // 그룹 메뉴 목록
                        if (int.Parse(dt.Rows[i]["SubCnt"].ToString()) > 0 || dt.Rows[i]["ChkYN"].ToString() == "Y")
                        {
                            nRowCnt += 1;

                            this.grdSet.Rows[nRowCnt - 1].Cells[0].Value = sBlank + dt.Rows[i]["MenuName"].ToString();
                            this.grdSet.Rows[nRowCnt - 1].Cells[1].Value = dt.Rows[i]["TopID"].ToString();
                            this.grdSet.Rows[nRowCnt - 1].Cells[2].Value = dt.Rows[i]["SubID"].ToString();
                        }
                    }

                    this.grdSet.RowCount = nRowCnt;
                }
            }
            catch (Exception ex) {
                wnLog.writeLog(wnLog.LOG_ERROR, ex.Message + " - " + ex.ToString()); Popup.pop오류리포트 msg = new Popup.pop오류리포트(ex.Message + " - " + ex.ToString());
                msg.ShowDialog();
            }

            lblBody.Visible = false;
        }