示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        userManager theUserManager = (userManager)Session["theUserManager"];

        theDisplayProgramName = theUserManager.getProgName();
        theDisplayPlineName   = theUserManager.getPlineName();
        theDisplayUserName    = theUserManager.getUserName();
        theDisplayCompanyCode = theUserManager.getCompanyCode();
        theDisplayProgramCode = theUserManager.getProgCode();
        theProgValue          = theUserManager.getProgVlaue();
        string theMenuCompanyCode = theUserManager.getCompanyCode();

        theMenuUserCode = theUserManager.getUserCode();

        Response.Cookies["CurrentProgramCode"].Value = theDisplayProgramCode;

        ////打印
        //thePrintSql = (string)Session["thePrintSql"];


        //显示提示信息  20071219
        //string str = theDisplayPlineName + "-->" + theDisplayUserName + "___" + theDisplayProgramName;
        //Response.Write("<script>window.status='" + str + "';</script>");

        //theHelpFile = theUrlTemp + "/Rmes/Help/" + theDisplayProgramCode + ".htm";

        //考虑以后可能对程序内容做一些处理,暂且定义变量
        //string theProgTemp = "";
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PubCs  thePubCs      = new PubCs();
        string theServerPath = Server.MapPath("~/").ToString();

        theServerPath = theServerPath + "Rmes/Pub/Xml/RmesConfig.xml";
        baseURI       = thePubCs.ReadFromXml(theServerPath, "rootPath");


        userManager theUserManager = (userManager)Session["theUserManager"];

        theDisplayProgramName = theUserManager.getProgName();
        theDisplayPlineName   = theUserManager.getPlineName();
        theDisplayUserName    = theUserManager.getUserName();
        theDisplayCompanyCode = theUserManager.getCompanyCode();
        theDisplayProgramCode = theUserManager.getProgCode();

        string theMenuCompanyCode = theUserManager.getCompanyCode();
        string theMenuUserCode    = theUserManager.getUserCode();
        string theMenuUserId      = theUserManager.getUserId();

        string opt    = Request["opt"] as string;
        string progid = Request["progCode"] as string;

        if (opt != null && progid != null && opt != string.Empty && progid != string.Empty)
        {
            if (opt == "setdefaultpage")
            {
                try
                {
                    dataConn dc      = new dataConn();
                    string   _theSql = "SELECT * FROM REL_USER_DEFAULTPAGE WHERE COMPANY_CODE = '" + theDisplayCompanyCode + "' AND USER_ID = '" + theMenuUserId + "'";
                    dc.setTheSql(_theSql);
                    if (dc.GetState())
                    {
                        _theSql = "UPDATE REL_USER_DEFAULTPAGE SET DEFAULT_PAGE = '" + progid + "' WHERE  COMPANY_CODE = '" + theDisplayCompanyCode + "' AND USER_ID = '" + theMenuUserId + "'";
                    }
                    else
                    {
                        _theSql = "INSERT INTO REL_USER_DEFAULTPAGE(COMPANY_CODE,USER_ID,DEFAULT_PAGE)VALUES('" + theDisplayCompanyCode + "','" + theMenuUserId + "','" + progid + "')";
                    }
                    dc.ExeSql(_theSql);
                    Response.Write("设置成功:" + progid);
                }
                catch (Exception ex)
                {
                    Response.Write("设置失败,信息如下:\n" + ex.Message);
                }
                Response.End();
            }
        }

        //得到菜单绝对地址
        string theHost    = Request.ServerVariables["REMOTE_ADDR"];
        string thePort    = Request.ServerVariables["SERVER_PORT"];
        string theUrl     = Request.ServerVariables["URL"];
        string theUrlTemp = theUrl.Substring(0, theUrl.IndexOf("/", 1));

        string str = "欢迎使用RMES系统," + theDisplayPlineName + " 的 " + theDisplayUserName + ",你当前打开的页面:" + theDisplayProgramName;

        ASPxRoundPanel1.HeaderText = str;

        //帮助 20080408

        theHelpFile = theUrlTemp + "/Rmes/Help/" + theDisplayProgramCode + ".htm";


        //考虑以后可能对程序内容做一些处理,暂且定义变量
        //string theProgTemp = "";

        string   theSql      = "select menu_code,menu_name,menu_code_father,menu_index,program_code,program_name,program_value from vw_rel_user_menu where company_code='" + theMenuCompanyCode + "' and user_id='" + theMenuUserId + "' order by menu_level,menu_index";
        dataConn theDataConn = new dataConn(theSql);
        //theDataConn.OpenConn();
        //theDataConn.theComd.CommandType = CommandType.Text;
        //theDataConn.theComd.CommandText = theSql;
        //OracleDataReader dr = theDataConn.theComd.ExecuteReader();

        DataTable dt = theDataConn.GetTable(theSql);
        DataView  dv = new DataView(dt);

        dv.RowFilter = "menu_code_father is NULL and menu_code is not NUll and menu_name is not NULL";
        dv.Sort      = "menu_index";

        string name = "", text = "", url = "";

        foreach (DataRowView dvr in dv)
        {
            name = dvr["menu_code"].ToString();
            text = dvr["menu_name"].ToString();
            url  = dvr["program_value"].ToString().Trim();
            url  = url.Equals("") ? "" : ("../.." + url + "?progCode=" + dvr["program_code"].ToString() + "&progName=" + dvr["program_name"]);
            if (!text.Trim().Equals(""))
            {
                DevExpress.Web.ASPxMenu.MenuItem m = new DevExpress.Web.ASPxMenu.MenuItem(text, name, "", url);
                ASPxMenu1.Items.Add(m);
                AddChildMenu(dt, m);
            }
        }
        if (ASPxMenu1.Items.Count > 0)
        {
            //modeify by thl 20161011 用户不需要 注释了
            ASPxMenu1.Target = "ifmain";
            ASPxMenu1.Items.Add("附加功能", "ext_menu", "", "");
            DevExpress.Web.ASPxMenu.MenuItem m = ASPxMenu1.Items.FindByName("ext_menu");
            m.Items.Add("设置为默认页", "ext_set_homepage", "", "javascript:$.setDefaultPage(window.ifmain.location.href)", "_self");
            //m.Items.Add("选择主题", "ext_set_theme", "", "");
            DevExpress.Web.ASPxMenu.MenuItem n = ASPxMenu1.Items.FindByName("ext_set_theme");


            string path = Server.MapPath("~/App_Themes");

            //string[] themes = System.IO.Directory.GetDirectories(path);

            //string sTemp = "";
            //foreach (string s in themes)
            //{
            //    sTemp = s.Substring(s.LastIndexOf("\\") + 1);
            //    if (!sTemp.StartsWith("."))
            //        n.Items.Add(sTemp, sTemp, "", "javascript:jQuery.setTheme('" + sTemp + "')", "_self");
            //}
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //得到相关信息
        userManager theUserManager = (userManager)Session["theUserManager"];

        string theCompanyCode = theUserManager.getCompanyCode();
        string theProgramCode = theUserManager.getProgCode();

        //调用存储过程得到该程序号对应信息
        dataConn theDataConn = new dataConn();

        theDataConn.theComd.CommandType = CommandType.StoredProcedure;
        theDataConn.theComd.CommandText = "MW_QUERY_COMMONQUERY_SINGLE";

        theDataConn.theComd.Parameters.Add("THECOMPANYCODE1", OracleDbType.Varchar2).Value     = "01";
        theDataConn.theComd.Parameters.Add("THECOMPANYCODE1", OracleDbType.Varchar2).Direction = ParameterDirection.Input;

        theDataConn.theComd.Parameters.Add("THEPROGRAMCODE1", OracleDbType.Varchar2).Value     = "selectCompany";
        theDataConn.theComd.Parameters.Add("THEPROGRAMCODE1", OracleDbType.Varchar2).Direction = ParameterDirection.Input;


        theDataConn.theComd.Parameters.Add("THEPROGRAMNAME1", OracleDbType.Varchar2, 50).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETQUERYFIELDCODE1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETQUERYFIELDNAME1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETFIELDCODE1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETFIELDNAME1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETQUERYSQL1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.theComd.Parameters.Add("THERETPRIMARYKEY1", OracleDbType.Varchar2, 300).Direction = ParameterDirection.InputOutput;

        theDataConn.OpenConn();
        theDataConn.theComd.ExecuteNonQuery();

        theProgramName    = (string)theDataConn.theComd.Parameters["THEPROGRAMNAME1"].Value;
        theQueryFieldCode = (string)theDataConn.theComd.Parameters["THERETQUERYFIELDCODE1"].Value;
        theQueryFieldName = (string)theDataConn.theComd.Parameters["THERETQUERYFIELDNAME1"].Value;
        theFieldCode      = (string)theDataConn.theComd.Parameters["THERETFIELDCODE1"].Value;
        theFieldName      = (string)theDataConn.theComd.Parameters["THERETFIELDNAME1"].Value;
        theQuerySql       = (string)theDataConn.theComd.Parameters["THERETQUERYSQL1"].Value;
        thePrimaryKey     = (string)theDataConn.theComd.Parameters["THERETPRIMARYKEY1"].Value;



        theDataConn.CloseConn();


        //相关属性赋值
        SqlDataSource1.SelectCommand = theQuerySql + " " + theConditionStr;

        string[] thePrimaryKeyArray = thePrimaryKey.Split(',');
        GridView1.DataKeyNames = thePrimaryKeyArray;

        //动态生成列

        if (!IsPostBack)
        {
            string[] theFieldCodeArray      = theFieldCode.Split(',');
            string[] theFieldNameArray      = theFieldName.Split(',');
            string[] theQueryFieldCodeArray = theQueryFieldCode.Split(',');
            string[] theQueryFieldNameArray = theQueryFieldName.Split(',');

            BoundField[] field = new BoundField[theFieldCodeArray.Length];
            for (int i = 0; i < theFieldCodeArray.Length; i++)
            {
                field[i]                = new BoundField();
                field[i].DataField      = theFieldCodeArray[i];
                field[i].HeaderText     = theFieldNameArray[i];
                field[i].SortExpression = theFieldCodeArray[i];
                GridView1.Columns.Add(field[i]);
            }

            //生成查询方式下拉框
            ListItem[] listItem = new ListItem[theQueryFieldCodeArray.Length];

            //增加空行
            ListItem listItem1 = new ListItem();
            listItem1.Value = "";
            listItem1.Text  = "";
            DropDownList1.Items.Add(listItem1);
            for (int j = 0; j < theQueryFieldCodeArray.Length; j++)
            {
                listItem[j]       = new ListItem();
                listItem[j].Value = theQueryFieldCodeArray[j];
                listItem[j].Text  = theQueryFieldNameArray[j];
                DropDownList1.Items.Add(listItem[j]);
            }
        }
    }