Example #1
0
 private void FormMain_Load(object sender, System.EventArgs e)
 {
     CarpenterBll.Bll.MainBll _bll = new CarpenterBll.Bll.MainBll( );
     UserLogin.userNum = CarpenterBll.UserInformation.UserNum = _bll.getUserNum( );
     if (string.IsNullOrEmpty(UserLogin.userNum))
     {
         this.Close( );
     }
     else
     {
         UserLogin.userName = CarpenterBll.UserInformation.UserName = _bll.getUserName(UserLogin.userNum);
         ShowMenuByUser( );
     }
 }
Example #2
0
        void Power(DevExpress.XtraNavBar.NavBarGroup pnl)
        {
            if (UserLogin.userNum.Equals("DS"))
            {
                return;
            }
            CarpenterBll.Bll.MainBll _bll = new CarpenterBll.Bll.MainBll( );
            DataTable dt = _bll.GetDataTablePower(UserLogin.userNum);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DevExpress.XtraNavBar.NavBarItem cn in pnl.NavBar.Items)
                {
                    if (!string.IsNullOrEmpty(cn.Tag.ToString( )))
                    {
                        if (dt.Select("POW003='" + cn.Tag.ToString( ) + "'").Length < 1)
                        {
                            cn.Visible = false;
                        }
                        else
                        {
                            cn.Visible = true;
                        }
                    }
                    else
                    {
                        cn.Visible = false;
                    }
                }
            }
            else
            {
                foreach (DevExpress.XtraNavBar.NavBarItem cn in pnl.NavBar.Items)
                {
                    cn.Visible = false;
                }
            }
        }
Example #3
0
        void Power( )
        {
            CarpenterBll.Bll.MainBll _bll = new CarpenterBll.Bll.MainBll( );
            DataTable dt = _bll.GetDataTableBtnPower(UserLogin.userNum, UserLogin.programName);

            if (dt != null && dt.Rows.Count > 0)
            {
                string btnPow = string.Empty;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    btnPow = dt.Rows [0] ["POW011"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolCancel.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolCancel.Id);
                    }
                    btnPow = dt.Rows [0] ["POW010"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolSave.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolSave.Id);
                    }
                    btnPow = dt.Rows [0] ["POW007"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolEdit.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolEdit.Id);
                    }
                    btnPow = dt.Rows [0] ["POW006"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolDelete.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolDelete.Id);
                    }
                    btnPow = dt.Rows [0] ["POW005"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolAdd.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolAdd.Id);
                    }
                    btnPow = dt.Rows [0] ["POW004"].ToString( );
                    if (string.IsNullOrEmpty(btnPow))
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolQuery.Id);
                    }
                    else if (btnPow == "False")
                    {
                        barMenu.LinksPersistInfo.RemoveAt(toolQuery.Id);
                    }
                }
            }
            else if (UserLogin.userNum != "00001")
            {
                barMenu.Visible = false;

                //foreach ( ToolStripButton btn in toolStrip1 . Items )
                //{
                //    if ( btn . GetType ( ) == typeof ( ToolStripButton ) )
                //    {
                //        ToolStripButton toolBtn = btn as ToolStripButton;
                //        toolStrip1 . Items . Remove ( toolBtn );
                //    }
                //}
            }
        }