Esempio n. 1
0
        private string isParent()
        {
            int Menu_ID = CommonLib.CheckNullInt(Request["Menu_ID"]);

            if (Menu_ID > 0)
            {
                HPCBusinessLogic.UltilFunc ultilDAL = new UltilFunc();
                if (CommonLib.isParrentMenu(Menu_ID))
                {
                    return(Menu_ID.ToString());
                }
                else
                {
                    return(UltilFunc.GetColumnValues("T_Chucnang", "Ma_Chucnang_Cha", " Ma_Chucnang=" + Menu_ID.ToString()));
                }
            }
            else
            {
                return("0");
            }
        }
Esempio n. 2
0
        public string BindNavigation(int User_ID)
        {
            StringBuilder _sbHeader = new StringBuilder();
            StringBuilder _sb       = new StringBuilder();

            string _tmp = string.Empty;

            if (Ma_QTBT != 0)
            {
                _tmp = GetMenu4User(User_ID, Ma_QTBT);
            }

            DataTable _dt;
            DataTable _dtChild;

            string _sql = string.Empty; string _sqlChild = string.Empty;

            _sql = "BindNavigationByUserID";
            HPCBusinessLogic.UltilFunc _untilDAL = new HPCBusinessLogic.UltilFunc();
            _sb.Append(" <tr> <td align=\"left\"> <table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"> <tr>");
            _sb.Append("  <td width=\"2px\">  </td>");
            try
            {
                _dt = _untilDAL.GetStoreDataSet(_sql, new string[] { "@User_ID" }, new object[] { User_ID }).Tables[0];
                if (_dt.Rows.Count > 0)
                {
                    for (int i = 0; i < _dt.Rows.Count; i++)
                    {
                        if (CommonLib.CheckNullInt(_dt.Rows[i]["node"]) > 0)
                        {
                            _sb.Append("<td class=\"MenuBar\"><div id=\"idchildMenu\" onmouseover=\"ShowMenu('SubMenu" + CommonLib.CheckNullStr(_dt.Rows[i]["Ma_Chucnang"]) + "')\" onmouseout=\"HideMenu('SubMenu" + CommonLib.CheckNullStr(_dt.Rows[i]["Ma_Chucnang"]) + "',2)\" >");
                            _sb.Append(" <div id=\"Menu" + CommonLib.CheckNullStr(_dt.Rows[i]["Ma_Chucnang"]) + "\">");
                            _sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr><td width=\"6\">");
                            if (CommonLib.CheckNullInt(isParent()) == CommonLib.CheckNullInt(_dt.Rows[i]["Ma_Chucnang"]))
                            {
                                _sb.Append("<img src='" + Global.ApplicationPath + "/Dungchung/images/Active/Left.jpg'>");
                                _sb.Append("</td>");
                                _sb.Append("<td background=\"" + Global.ApplicationPath + "/Dungchung/images/Active/Center.jpg\" style=\"background-repeat: repeat-x;\">");
                            }
                            else
                            {
                                _sb.Append("<img src='" + Global.ApplicationPath + "/Dungchung/images/Left.jpg'>");
                                _sb.Append("</td>");
                                _sb.Append("<td background=\"" + Global.ApplicationPath + "/Dungchung/images/Center.jpg\" style=\"background-repeat: repeat-x;\">");
                            }

                            _sb.Append("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" class=\"MenuBar\"><tr>");
                            if (CommonLib.CheckNullStr(_dt.Rows[i]["Icon"]).Length > 0)
                            {
                                _sb.Append("<td><img alt=\"\" src=\"" + UltilFunc.TinPath + CommonLib.CheckNullStr(_dt.Rows[i]["Icon"]) + "\" align=\"absmiddle\" onload=\"FixPNG(this)\" /></td>");
                            }
                            if (CommonLib.CheckNullInt(isParent()) == CommonLib.CheckNullInt(_dt.Rows[i]["Ma_Chucnang"]))
                            {
                                _sb.Append("<td class=\"TextAtive\">");
                            }
                            else
                            {
                                _sb.Append("<td class=\"Text\">");
                            }

                            if (CommonLib.CheckNullStr(_dt.Rows[i]["URL_Chucnang"]).Length > 0)
                            {
                                _sb.Append("<a href=\"" + Global.ApplicationPath + CommonLib.CheckNullStr(_dt.Rows[i]["URL_Chucnang"]) + "\">" + CommonLib.CheckNullStr(_dt.Rows[i]["Ten_chucnang"]) + "</a>");
                            }
                            else
                            {
                                _sb.Append(CommonLib.CheckNullStr(_dt.Rows[i]["Ten_chucnang"]));
                            }
                            if (CommonLib.CheckNullInt(isParent()) == CommonLib.CheckNullInt(_dt.Rows[i]["Ma_Chucnang"]))
                            {
                                _sb.Append("</td><td><img src=\"" + Global.ApplicationPath + "/Dungchung/images/Active/Arrow.gif\" alt=\"\" /></td></tr></table></td>");
                            }
                            else
                            {
                                _sb.Append("</td><td><img src=\"" + Global.ApplicationPath + "/Dungchung/images/Arrow.gif\" alt=\"\" /></td></tr></table></td>");
                            }

                            _sb.Append("<td width=\"6\">");
                            if (CommonLib.CheckNullInt(isParent()) == CommonLib.CheckNullInt(_dt.Rows[i]["Ma_Chucnang"]))
                            {
                                _sb.Append("<img src=\"" + Global.ApplicationPath + "/Dungchung/images/Active/Right.jpg\">");
                            }
                            else
                            {
                                _sb.Append("<img src=\"" + Global.ApplicationPath + "/Dungchung/images/Right.jpg\">");
                            }

                            _sb.Append("</td></tr></table></div>");


                            if (_tmp.Length == 1)
                            {
                                _sqlChild  = "SELECT Ten_chucnang,URL_Chucnang,STT,Ma_Chucnang,Icon,Mota,Quytrinh,Ma_Doituong,(select count(*) FROM T_Chucnang WHERE  T_Chucnang.HoatDong=1 and  Ma_Chucnang_Cha = mn.Ma_Chucnang) childnodecount ";
                                _sqlChild += " FROM T_Chucnang mn WHERE  mn.HoatDong=1 and  Ma_Chucnang_Cha = " + _dt.Rows[i]["Ma_Chucnang"] + " AND Ma_Chucnang =" + _tmp + " ORDER BY mn.STT";
                            }
                            else
                            {
                                _sqlChild  = " SELECT Ten_chucnang,[dbo].[fn_MenuQuytrinh]('" + Ma_QTBT + "',Quytrinh,Ma_Chucnang) as URL_Chucnang,STT,Ma_Chucnang,Icon,Mota,Quytrinh,Ma_Doituong,(select count(*) FROM T_Chucnang WHERE T_Chucnang.HoatDong=1  and Ma_Chucnang_Cha = mn.Ma_Chucnang) childnodecount";
                                _sqlChild += " FROM T_Chucnang mn WHERE mn.HoatDong=1 and Ma_Chucnang_Cha = " + _dt.Rows[i]["Ma_Chucnang"] + " AND Ma_Chucnang IN (" + _tmp + ") ORDER BY mn.STT";
                            }
                            try
                            {
                                _dtChild = _untilDAL.ExecSqlDataSet(_sqlChild).Tables[0];
                                if (_dtChild.Rows.Count > 0)
                                {
                                    _sb.Append("<div id=\"SubMenu" + CommonLib.CheckNullStr(_dt.Rows[i]["Ma_Chucnang"]) + "\" class=\"Hide\">");
                                    _sb.Append("<div style=\"padding-top: 0px; position: absolute;z-index:200px;\" align=\"left\">");
                                    _sb.Append("<div style=\"width: 200px; padding-top: 5px;z-index:50000px;\" class=\"SubMenu\">");
                                    _sb.Append("<table border=\"0\" class=\"cssMenuTables\" width=\"100%\" cellpadding=\"0\" cellspacing=\"0\">");

                                    for (int j = 0; j < _dtChild.Rows.Count; j++)
                                    {
                                        _sb.Append("<tr class=\"SubMenuItem\" onmouseover=\"this.className='SubMenuItemOver'\" onmouseout=\"this.className='SubMenuItem'\">");
                                        _sb.Append("<td width=\"100%\" style=\"padding-top: 5px;\">");
                                        _sb.Append("<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"100%\" align=\"center\">");
                                        _sb.Append("<tr> <td width=\"24px\" align=\"left\" style=\"padding-left: 4px;\" valign=\"top\">");
                                        _sb.Append("<td style=\"padding-right: 10px;\" align=\"left\">");
                                        bool quytrinh = Convert.ToBoolean(_dtChild.Rows[j]["Quytrinh"].ToString());

                                        if (quytrinh == true)
                                        {
                                            _sb.Append("<a class=\"SubMenuItem\" href='" + Global.ApplicationPath + "/" + _dtChild.Rows[j]["URL_Chucnang"].ToString() + "?Menu_ID=" + _dtChild.Rows[j]["Ma_Chucnang"].ToString() + "&MaDoiTuong=" + _dtChild.Rows[j]["Ma_Doituong"].ToString() + "'>" + CommonLib.CheckNullStr(_dtChild.Rows[j]["Ten_chucnang"]) + "</a>");
                                        }
                                        else
                                        {
                                            _sb.Append("<a class=\"SubMenuItem\" href='" + Global.ApplicationPath + "/" + _dtChild.Rows[j]["URL_Chucnang"].ToString() + "?Menu_ID=" + _dtChild.Rows[j]["Ma_Chucnang"].ToString() + "'>" + CommonLib.CheckNullStr(_dtChild.Rows[j]["Ten_chucnang"]) + "</a>");
                                        }

                                        _sb.Append("<div class=\"SubMenuItemDesc\" align=\"left\" style=\"padding-top: 3px; font-size: 10px\">");
                                        _sb.Append(CommonLib.CheckNullStr(_dtChild.Rows[j]["Mota"]));
                                        _sb.Append("  </div>  </td>  </tr>  <tr><td height=\"10px\" >  </td></tr></table></td></tr>");
                                    }
                                    _sb.Append("</table></div></div> </div> ");
                                }
                            }
                            catch (Exception ex)
                            {
                                throw ex;
                            }

                            _sb.Append(" </div></td><td width=\"2px\"></td>");
                        }
                        else
                        {
                            //_sb.Append("<td class=\"MenuBar\"><div>");
                            //_sb.Append(" <div id=\"Menu" + CommonLib.CheckNullStr(_dt.Rows[i]["Ma_Chucnang"]) + "\">");
                            //_sb.Append("<td background=\"" + Global.ApplicationPath + "/Dungchung/images/Center.jpg\" style=\"background-repeat: repeat-x;\">");
                            //_sb.Append("<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" class=\"MenuBar\"><tr>");

                            //if (CommonLib.CheckNullStr(_dt.Rows[i]["URL_Chucnang"]).Length > 0)
                            //{
                            //    _sb.Append("<td class=\"Text\"><a href=\"" + Global.ApplicationPath + CommonLib.CheckNullStr(_dt.Rows[i]["URL_Chucnang"]) + "\">" + CommonLib.CheckNullStr(_dt.Rows[i]["Ten_chucnang"]) + "</a></td><td><img src=\"" + Global.ApplicationPath + "/images/Arrow.gif\" alt=\"\" /></td></tr></table></td>");
                            //}
                            //else
                            //{
                            //    _sb.Append("<td class=\"Text\">" + CommonLib.CheckNullStr(_dt.Rows[i]["Ten_chucnang"]) + "</td>");
                            //}
                            //_sb.Append("</td></tr></table></td><td width=\"6\"><img src=\"" + Global.ApplicationPath + "/Dungchung/images/Right.jpg\"></td></tr></table></div>");
                            //_sb.Append(" </div></td><td width=\"5px\"></td>");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            _sb.Append(" </tr>  </table></td> </tr> <tr><td height=\"4\" bgcolor=\"#167cba\" align=\"right\"/></tr>");

            return(_sb.ToString());
        }