Exemplo n.º 1
0
    public static string GetImgConditionsType(string type)
    {
        string dataPath = System.Web.HttpContext.Current.Server.MapPath("~") + "/XmlDoc/Data.xml";

        PccMsg myMsg = new PccMsg();
        myMsg.Load(dataPath);
        return myMsg.Query("IMGConditions/" + type);
    }
Exemplo n.º 2
0
    private void SetMenu()
    {
        string strLeftMenu = string.Empty;
        int AreaCount = 1;

        //LoginInfoUser of AP Detail Menu.
        PccCommonForC.PccErrMsg myLabel = new PccCommonForC.PccErrMsg(Server.MapPath(Session["PageLayer"] + "XmlDoc"), Session["CodePage"].ToString(), "Label");
        string strDetailPageLayer = Session["PageLayer"].ToString();

        if (Request.QueryString["ApID"] != null)
        {
            //APID
            string strApID = Request.Params["ApID"];
            string ApFolder = "", MenuItem = "", MenuName = "";

            PccCommonForC.PccMsg myMsg = new PccCommonForC.PccMsg();
            myMsg.LoadXml(Session["XmlLoginInfo"].ToString());

            if (strApID.Length > 0 && strDetailPageLayer.Length > 0)
            {
                //strDetailPageLayer = strDetailPageLayer.Substring(0,strDetailPageLayer.Length - 3);
                if (myMsg.QueryNodes("Authorize") != null)
                {
                    foreach (XmlNode myNode in myMsg.QueryNodes("Authorize"))
                    {

                        if (strApID != myMsg.Query("APID", myNode)) continue;

                        //Folder
                        ApFolder = GetApFolder(myMsg.Query("APLink", myNode));

                        if (myMsg.QueryNodes("ApMenu", (XmlElement)myNode) != null)
                        {
                            foreach (XmlNode myDetailNode in myMsg.QueryNodes("ApMenu", (XmlElement)myNode))
                            {
                                if (myMsg.Query("show_mk", myDetailNode).Equals("Y"))
                                {

                                    if (myMsg.Query("MenuLink", myDetailNode).IndexOf(".asmx", 0) > 0)
                                        continue;

                                    if (Session["CodePage"].ToString() == "CP950")
                                    {
                                        SaveDataToHashMenu(myMsg.Query("MenuManage", (XmlElement)myDetailNode), strDetailPageLayer, ApFolder, myMsg.Query("MenuNM", (XmlElement)myDetailNode), myMsg.Query("MenuLink", (XmlElement)myDetailNode));
                                    }
                                    else
                                    {
                                        MenuItem = "M" + strApID + int.Parse(myMsg.Query("MENUID", myDetailNode)).ToString();
                                        MenuName = myLabel.GetErrMsg(MenuItem, "MenuItem");
                                        SaveDataToHashMenu(myMsg.Query("MenuManage", (XmlElement)myDetailNode), strDetailPageLayer, ApFolder, MenuName, myMsg.Query("MenuLink", (XmlElement)myDetailNode));

                                    }

                                    // SaveDataToHashMenu(myMsg.Query("MenuManage", (XmlElement)myDetailNode), strDetailPageLayer, ApFolder, myMsg.Query("MenuNM", (XmlElement)myDetailNode), myMsg.Query("MenuLink", (XmlElement)myDetailNode));
                                }
                            }
                        }
                    }
                }
            }

            strLeftMenu = "<div class='glossymenu'>";
            string strLang = "";
            ArrayList arrMenu = new ArrayList();

            if (Session["CodePage"].ToString() != "CP950")
            {
                strLang = "_VN";
            }

            myMsg = new PccMsg();
            myMsg.Load(Server.MapPath(Session["PageLayer"] + @"XmlDoc\ApMenu" + strLang + ".xml"));

            if (myMsg.QueryNodes("Applications/Application") != null)
            {
                foreach (XmlNode apNode in myMsg.QueryNodes("Applications/Application"))
                {
                    if (myMsg.Query("ApID", apNode) == Request.QueryString["ApID"])
                    {
                        if (myMsg.QueryNodes("ApAreas/Area", apNode) != null)
                        {
                            foreach (XmlNode areaNode in myMsg.QueryNodes("ApAreas/Area", apNode))
                            {
                                string AreaMK = myMsg.Query("AreaMK", areaNode);
                                string AreaName = myMsg.Query("AreaName", areaNode);
                                if (m_Menu.ContainsKey(AreaMK))//xet quyen han thay menu
                                {
                                    strLeftMenu += "<a class='menuitem submenuheader' style='cursor:pointer'><span class='area_item'><img  src='" + ResolveUrl("~/") + "Pub/EasyLayout/ImgBody/group_item.png" + "' border='0'>" + AreaName.ToUpper() + "</span></a>";
                                    strLeftMenu += "<div  class='submenu'>";
                                    strLeftMenu += "<ul>";
                                    //add child menu
                                    strLeftMenu += m_Menu[AreaMK].ToString();
                                    strLeftMenu += "</ul>";
                                    strLeftMenu += "</div>"; //end class=menu_body
                                }
                            }
                        }
                        break;
                    }
                }
            }

            /*
            if (m_Menu.Count > 0)
            {
                AreaCount += m_Menu.Count;
                //strLeftMenu += GetWelcome(strDetailPageLayer, strApID);

                string[] strArrMenu = { "N", "R", "S", "W", "M", "Q" };

                for (int w = 0; w < strArrMenu.Length; w++)
                {
                    if (m_Menu.ContainsKey(strArrMenu[w]))
                    {

                        string area_mk = strArrMenu[w];
                        arrMenu.Add(area_mk);
                        //GroupMenu
                        strLeftMenu += "<a class='menuitem submenuheader' style='cursor:pointer'><img src='" + ResolveUrl("~/") + "images/MenuArea/" + area_mk + "_Open" + strLang + ".gif' border='0' ></a>";
                        strLeftMenu += "<div  class='submenu'>";
                        strLeftMenu += "<ul>";
                        //child menu
                        strLeftMenu += m_Menu[area_mk].ToString();
                        strLeftMenu += "</ul>";
                        strLeftMenu += "</div>"; //end class=menu_body
                    }
                }

                foreach (string strArea in m_Menu.Keys) //cac nhom menu khac
                {
                    bool isExits = false;
                    for (int k = 0; k < arrMenu.Count; k++) //kiem tra co ton tai trong menu da co chua
                    {
                        if (strArea == arrMenu[k].ToString() || strArea == "Y")
                        {
                            isExits = true;
                            break;
                        }
                    }

                    if (!isExits)
                    {
                        string area_mk = strArea;

                        //GroupMenu
                        strLeftMenu += "<a class='menuitem submenuheader' style='cursor:pointer'><img src='" + ResolveUrl("~/") + "images/MenuArea/" + area_mk + "_Open" + strLang + ".gif' border='0' ></a>";
                        strLeftMenu += "<div  class='submenu'>";
                        strLeftMenu += "<ul>";
                        //child menu
                        strLeftMenu += m_Menu[area_mk].ToString();
                        strLeftMenu += "</ul>";
                        strLeftMenu += "</div>"; //end class=menu_body
                    }
                }

                //Khu quan ly
                if (m_Menu.ContainsKey("Y"))
                {
                    string area_mk = "Y";
                    arrMenu.Add(area_mk);
                    //GroupMenu
                    strLeftMenu += "<a class='menuitem submenuheader' style='cursor:pointer'><img src='" + ResolveUrl("~/") + "images/MenuArea/" + area_mk + "_Open" + strLang + ".gif' border='0' ></a>";
                    strLeftMenu += "<div  class='submenu'>";
                    strLeftMenu += "<ul>";
                    //child menu
                    strLeftMenu += m_Menu[area_mk].ToString();
                    strLeftMenu += "</ul>";
                    strLeftMenu += "</div>"; //end class=menu_body
                }

            }
            else //表示沒有選單權限
            {
                //strLeftMenu += GetWelcome(strDetailPageLayer, strApID);
            }*/

            strLeftMenu += "</div>"; //end div  class='glossymenu'
        }

        ltrLeftMenu.Text = strLeftMenu;
    }