Exemplo n.º 1
0
    private string GenMultiLinkXML(DataRow myDRow, string strXML)
    {
        PccMsg myMsg = new PccMsg(strXML);
        PccMsg myTempMsg = new PccMsg();

        foreach (XmlNode myNode in myMsg.QueryNodes("LinkButton"))
        {
            myTempMsg.CreateNode("LinkButton");
            myTempMsg.AddToNode("Image", myMsg.Query("Image", myNode));
            myTempMsg.AddToNode("ToolTip", myMsg.Query("ToolTip", myNode));
            myTempMsg.AddToNode("href", myMsg.Query("href", myNode));
            myTempMsg.AddToNode("QueryCondition", myMsg.Query("QueryCondition", myNode));
            myTempMsg.AddToNode("Method", GetMethod(myMsg.Query("Method/MethodName", myNode), myMsg.Query("Method/Key", myNode), myMsg.Query("Method/KeyOther", myNode), myDRow));
            myTempMsg.UpdateNode();
        }

        return myTempMsg.GetXmlStr;
    }
Exemplo n.º 2
0
    private DataTable CreateSecurityTable(string LoginXML)
    {
        DataTable returnDt = CenSecTable();

        PccMsg myMsg = new PccMsg(LoginXML);
        string ap_id = "";
        DataRow drow = null;

        if (myMsg.QueryNodes("Authorize") == null) return returnDt;

        foreach (XmlNode myNode in myMsg.QueryNodes("Authorize"))
        {
            ap_id = myMsg.Query("APID", myNode);

            if (myMsg.QueryNodes("ApMenu", myNode) == null) continue;

            foreach (XmlNode myDNode in myMsg.QueryNodes("ApMenu", myNode))
            {
                drow = returnDt.NewRow();
                drow["ap_id"] = decimal.Parse(ap_id);
                drow["aspxfile"] = SplitAspxFile(myMsg.Query("MenuLink", myDNode));
                drow["check_mk"] = myMsg.Query("check_mk", myDNode);
                drow["show_mk"] = myMsg.Query("show_mk", myDNode);
                drow["add_mk"] = myMsg.Query("add_mk", myDNode);
                drow["upd_mk"] = myMsg.Query("upd_mk", myDNode);
                drow["del_mk"] = myMsg.Query("del_mk", myDNode);
                drow["rpt_mk"] = myMsg.Query("rpt_mk", myDNode);
                drow["send_mk"] = myMsg.Query("send_mk", myDNode);
                returnDt.Rows.Add(drow);
            }

        }

        return returnDt;
    }
Exemplo n.º 3
0
    public bool IsApAuth()
    {
        if (m_ApID == "")
        {
            m_Error = "ApID is space!";
            return false;
        }

        if (m_LoginInfoXml == "")
        {
            m_Error = "LoginInfoXml is space!";
            return false;
        }

        if (m_Url == "")
        {
            m_Error = "URL is space!";
            return false;
        }

        PccMsg myMsg = new PccMsg();

        try
        {
            myMsg.LoadXml(m_LoginInfoXml);
        }
        catch
        {
            m_Error = "Load LoginInfo XML Error!";
            return false;
        }

        string AspxFileName = GetAspxFile();
        bool bOK = false;

        if (myMsg.QueryNodes("Authorize") != null)
        {
            foreach (XmlNode myNode in myMsg.QueryNodes("Authorize"))
            {
                if (myMsg.Query("APID", myNode) == m_ApID)
                {
                    bOK = true;
                }//end if APID
                if (bOK) break;  //if find the Action then exit for loop.
            }//end foreach myNode
        }

        return bOK;
    }
Exemplo n.º 4
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;
    }
Exemplo n.º 5
0
    public string GetAuthByTable(string strAction)
    {
        if (m_ApID == "")
        {
            m_Error = "ApID is space!";
            return m_Error;
        }

        string strReturn = "";
        string AspxFileName = GetAspxFile();

        if (m_bCheckTable)
        {
            try
            {
                strReturn = m_DataTable.Select("ap_id = '" + m_ApID + "' and AspxFile = '" + AspxFileName + "'")[0][strAction].ToString();
            }
            catch
            {
            }
        }
        else
        {
            if (m_LoginInfoXml == "")
            {
                m_Error = "LoginInfoXml is space!";
                return m_Error;
            }

            if (m_Url == "")
            {
                m_Error = "URL is space!";
                return m_Error;
            }

            PccMsg myMsg = new PccMsg();

            try
            {
                myMsg.LoadXml(m_LoginInfoXml);
            }
            catch
            {
                m_Error = "Load LoginInfo XML Error!";
                return m_Error;
            }

            bool bOK = false;

            if (myMsg.QueryNodes("Authorize") != null)
            {
                foreach (XmlNode myNode in myMsg.QueryNodes("Authorize"))
                {
                    if (myMsg.Query("APID", myNode) == m_ApID)
                    {
                        if (myMsg.QueryNodes("ApMenu", myNode) != null)
                        {
                            foreach (XmlNode myDetailNode in myMsg.QueryNodes("ApMenu", myNode))
                            {
                                if (CheckAspxFile(myMsg.Query("MenuLink", myDetailNode), AspxFileName))
                                {
                                    strReturn = myMsg.Query(strAction, myDetailNode);
                                    bOK = true;
                                    break;
                                }
                            } //end foreach myDeailNode
                        }// end if Menu Nodes.
                    }//end if APID
                    if (bOK) break;  //if find the Action then exit for loop.
                }//end foreach myNode
            }
        }

        return strReturn;
    }