Esempio n. 1
0
    protected void BaseUc_Page_Load(object sender, EventArgs e)
    {
        SH = Screen.PrimaryScreen.Bounds.Height;

        SW        = Screen.PrimaryScreen.Bounds.Width;
        dt_a00201 = Fun.getDtBySql("Select t.* from A00201_V01 t where a00201_key = '" + a00201_key + "'");
        // dt_a0130101 = Fun.getA0130101(a00201_key);
        //dt_a013010101 = Fun.getA013010101(a00201_key);
        // showdatasql = Fun.getShowDataSql(a00201_key);
        //  A002_ID='[REQUEST_A002ID]'
        //解析出request
        for (int i = 0; i < Request.QueryString.AllKeys.Length; i++)
        {
            string key = Request.QueryString.AllKeys.GetValue(i).ToString();
            // Request.QueryString("").
            showdatasql = showdatasql.Replace("[REQUEST_" + key.ToUpper() + "]", Request.QueryString[key].ToString());
        }
        string json = "";

        try
        {
            json = Session["J_" + dt_a00201.Rows[0]["A00201_KEY"].ToString()].ToString();
        }
        catch
        {
            json = "";
        }
        if (json == "")
        {
            Hashtable ht = new Hashtable();
            dt_a013010101 = Fun.getA013010101(a00201_key);
            ht.Add("P1", Fun.DataTable2Json(dt_a013010101));
            ht.Add("P2", dt_a00201.Rows[0]["TABLE_KEY"].ToString());
            ht.Add("P3", dt_a00201.Rows[0]["main_key"].ToString());
            ht.Add("P4", dt_a00201.Rows[0]["table_id"].ToString());
            ht.Add("P5", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t  where a00201_key ='" + dt_a00201.Rows[0]["A00201_KEY"].ToString() + "' and   rb_type='C'")));
            ht.Add("P6", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t  where a00201_key ='" + dt_a00201.Rows[0]["A00201_KEY"].ToString() + "' and   rb_type='U'")));
            ht.Add("P7", dt_a00201.Rows[0]["tbl_type"].ToString());
            ht.Add("P8", Fun.DataTable2Json(Fun.getDtBySql("select t.*   from a00201_v02 t  where a00201_key ='" + dt_a00201.Rows[0]["A00201_KEY"].ToString() + "' order by sort_by")));

            //        ht.Add("P001", Fun.DataTable2Json(Fun.getDtBySql("Select t.* from A00201_V01 t where a00201_key = '" + a00201_key + "'")));
            //      ht.Add("P002", Fun.getA0130101(a00201_key));
            //  ht.Add("P003", Fun.DataTable2Json(dt_a013010101));
            ht.Add("P004", Fun.getShowDataSql(a00201_key));
            string jsonText = JsonConvert.SerializeObject(ht);
            Session["J_" + dt_a00201.Rows[0]["A00201_KEY"].ToString()] = jsonText;
            json = jsonText;
        }
        else
        {
            dt_a013010101 = Fun.getdtByJson(Fun.getJson(json, "P1"));
        }
        showdatasql = Fun.getJson(json, "P004");
    }
Esempio n. 2
0
/// <summary>
/// 检测用户登录

/// </summary>
/// <returns>0 成功</returns>
    public string checkUserLogin( )
    {
        try
        {
            //  in varchar2,  user_id_ in varchar2,
            //   pass_word_ in varchar2 ,user_ip_  in varchar2
            string clientip = fun.getClientIp();

            string    sql   = "Select PKG_User.checkUserLogin('" + _comp_no + "','" + _user_id + "','" + _pass_word.Replace("'", "''") + "','" + clientip + "','" + _if_check__ + "') as c from dual ";
            DataTable dt    = new DataTable();
            int       li_db = fun.db.ExcuteDataTable(dt, sql, CommandType.Text);
            if (li_db < 0)
            {
                return("01执行校验失败!");
            }
            int li_res = int.Parse(dt.Rows[0][0].ToString());
            if (li_res < 0)
            {
                return(usermsg.getMsgByMsgId("100001", ""));
            }
            /*登录成功以后执行写日志和写事务*/

            DataTable dt_key = new DataTable();
            sql   = "select s_a300.nextval  as c  from dual ";
            li_db = fun.db.ExcuteDataTable(dt_key, sql, CommandType.Text);
            if (li_db < 0)
            {
                return("01执行校验失败!");
            }
            sql = "Select  a022_name  from a022 t where  a022_id='CHECK_MAC_NAME' ";

            string    CHECK_MAC_NAME = "1";
            DataTable dt_a           = new DataTable();
            dt_a = fun.getDtBySql(sql);
            if (dt_a.Rows.Count > 0)
            {
                CHECK_MAC_NAME = dt_a.Rows[0][0].ToString();
                if (CHECK_MAC_NAME != "1")
                {
                    CHECK_MAC_NAME = "0";
                }
            }
            if (CHECK_MAC_NAME == "1")
            {
                try
                {
                    System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostByAddress(clientip);

                    sql = "PKG_User.UserLogin('" + _user_id + "','" + clientip + "'," + dt_key.Rows[0][0].ToString() + ",'" + hostInfo.HostName + "','WEB','" + _comp_no + "')";
                }
                catch
                {
                    sql = "PKG_User.UserLogin('" + _user_id + "','" + clientip + "'," + dt_key.Rows[0][0].ToString() + ",'" + clientip + "','WEB','" + _comp_no + "')";
                }
            }
            else
            {
                sql = "PKG_User.UserLogin('" + _user_id + "','" + clientip + "'," + dt_key.Rows[0][0].ToString() + ",'" + clientip + "','WEB','" + _comp_no + "')";
            }
            string res = fun.execSql(sql, _user_id, "login");
            if (res != "0")
            {
                return(res);
            }
            /*初始化 把用户数据 记录到session中*/

            if (GlobeAtt.A007_KEY != "")
            {
                if (_user_id != GlobeAtt.A007_KEY)
                {
                    HttpContext.Current.Session.Clear();
                }
            }

            //用户属性
            HttpContext.Current.Session["USER_ID"]    = _user_id;
            HttpContext.Current.Session["A007_KEY"]   = _user_id;
            HttpContext.Current.Session["A30001_KEY"] = dt_key.Rows[0][0].ToString();

            DataTable dt_a007 = new DataTable();
            sql   = "Select t.* from A007_v01 t where a007_id= '" + _user_id + "'";
            li_db = fun.db.ExcuteDataTable(dt_a007, sql, CommandType.Text);
            if (li_db < 0)
            {
                return("01执行校验失败!");
            }
            HttpContext.Current.Session["A007_NAME"] = dt_a007.Rows[0]["A007_NAME"].ToString();

            HttpContext.Current.Session["LANGUAGE_ID"] = dt_a007.Rows[0]["LANGUAGE_ID"].ToString();


            DataTable dt_dataindex = new DataTable();
            dt_dataindex = fun.getDtBySql("select f_get_data_index() as c  from dual ");
            string v = dt_dataindex.Rows[0][0].ToString();
            dt_dataindex.Dispose();
            HttpContext.Current.Session["DATA_INDEX"] = v;

            DataTable dt_config = new DataTable();

            sql = "Select pkg_show.getSysConfig('" + _user_id + "') as c from dual ";

            DataTable dt_temp = new DataTable();
            dt_temp = fun.getDtBySql(sql);

            sql = dt_temp.Rows[0][0].ToString();


            dt_config = fun.getDtBySql(sql);


            for (int i = 0; i < dt_config.Columns.Count; i++)
            {
                string column_id = dt_config.Columns[i].ColumnName.ToUpper();
                HttpContext.Current.Session["CFG_" + column_id] = dt_config.Rows[0][i].ToString();
            }
            string ls_cfg = fun.DataTable2Json(dt_config);
            HttpContext.Current.Session["CFG"] = ls_cfg;


            DataTable dt_a022 = new DataTable();
            sql     = "Select t.* from A022 t ";
            dt_a022 = fun.getDtBySql(sql);
            for (int i = 0; i < dt_a022.Rows.Count; i++)
            {
                string a022_id   = dt_a022.Rows[i]["A022_ID"].ToString();
                string a002_name = dt_a022.Rows[i]["A022_NAME"].ToString();
                a002_name = a002_name.Replace("[USER_ID]", GlobeAtt.A007_KEY);
                a002_name = a002_name.Replace("[A30001_KEY]", GlobeAtt.A30001_KEY);
                string if_exec = dt_a022.Rows[i]["if_exec"].ToString();
                if (if_exec == "1")
                {
                    DataTable dt_exec = new DataTable();
                    dt_exec   = fun.getDtBySql(a002_name);
                    a002_name = dt_exec.Rows[0][0].ToString();
                }
                HttpContext.Current.Session[a022_id.ToUpper()] = a002_name;
            }
            try
            {
                string LINK_A007_ID = HttpContext.Current.Session["LINK_A007_ID"].ToString();
                if (LINK_A007_ID != _user_id)
                {
                    HttpContext.Current.Session["LINK_P_URL"] = "";
                }
            }
            catch
            {
                HttpContext.Current.Session["LINK_P_URL"] = "";
            }

            /* = fun.getA022Name("QueryList_PageRow");
             * HttpContext.Current.Session["QueryList_MaxRow"] = fun.getA022Name("QueryList_MaxRow");
             * HttpContext.Current.Session["DetailRowS"] = fun.getA022Name("DetailRowS");
             * HttpContext.Current.Session["BS_LOG_SQL"] = fun.getA022Name("BS_LOG_SQL");
             * HttpContext.Current.Session["BS_LOG_A314"] = fun.getA022Name("BS_LOG_A314");
             * HttpContext.Current.Session["SYS_MODE"] = fun.getA022Name("SYS_MODE");
             * HttpContext.Current.Session["BS_LOG_SELECTSQL"] = fun.getA022Name("BS_LOG_SELECTSQL");
             * HttpContext.Current.Session["QUERY_LIKE"] = fun.getA022Name("QUERY_LIKE");
             */
            //HttpContext.Current.Session["A007"] = fun.setPkSYS_MODEgStr(dt_a007);


            //DataTable dt_a00701 = new DataTable();
            //sql = "Select t.* from A00701 t  where a007_key= " + li_res.ToString();
            //li_db = fun.db.ExcuteDataTable(dt_a00701, sql, CommandType.Text);
            //if (li_db < 0)
            //{
            //    return "01执行校验失败!";
            //}

            //HttpContext.Current.Session["A013"] = fun.setPkgStr(dt_a00701);



            ///*登录的日志信息*/
            //DataTable dt_a30001 = new DataTable();
            //sql = "Select t.* from A30001 t where a30001_key= " + dt_key.Rows[0][0].ToString();
            //li_db = fun.db.ExcuteDataTable(dt_a30001, sql, CommandType.Text);
            //if (li_db < 0)
            //{
            //    return "01执行校验失败!";
            //}
            //HttpContext.Current.Session["A30001"] = fun.setPkgStr(dt_a007);


            return("02[HTTP_URL]/default.aspx");
        }
        catch (Exception ex)
        {
            return("00" + ex.Message.Replace("\n", ";").Replace("'", "\""));
        }
    }
Esempio n. 3
0
    public void PageBase_Load(object sender, System.EventArgs e)
    {
        if (GlobeAtt.A007_KEY == "")
        {
            Response.Write("showlogin();");
            return;
        }


        try
        {
            Stream       RequestStream       = Request.InputStream;
            StreamReader RequestStreamReader = new StreamReader(RequestStream);
            RequestXml = RequestStreamReader.ReadToEnd();
            RequestStream.Close();

            a00201_key = BaseFun.getAllHyperLinks(RequestXml, "<A00201KEY>", "</A00201KEY>")[0].Value;
            try
            {
                RequestURL = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value;
            }
            catch
            {
                RequestURL = "";
            }
        }
        catch (Exception ex)
        {
            a00201_key = "-1";
            return;
        }

        // a00201_key = Request.QueryString["A00201KEY"] == null ? "-1" : Request.QueryString["A00201KEY"].ToString();
        if (a00201_key == "-1")
        {
            return;
        }

        try
        {
            json = Session["JSON_" + a00201_key].ToString();
        }
        catch
        {
            json = "";
        }
        if (GlobeAtt.SYS_MODE == "K")
        {
            json = "";
        }
        if (json == "")
        {
            Hashtable ht = new Hashtable();
            dt_a013010101 = Fun.getA013010101(a00201_key);
            dt_a00201     = Fun.getDtBySql("Select t.* from A00201_V01 t where a00201_key = '" + a00201_key + "' order by  line_no  ");
            //列属性
            ht.Add("P1", Fun.DataTable2Json(dt_a013010101));
            //菜单属性
            ht.Add("P2", Fun.DataTable2Json(dt_a00201));
            //数据检测属性
            if (dt_a00201.Rows[0]["IF_MAIN"].ToString() == "1")
            {
                ht.Add("P3", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t  where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' and   rb_type='C'")));
                ht.Add("P4", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00210_V01 t  where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' and   rb_type='U'")));
                ht.Add("P9", Fun.DataTable2Json(Fun.getDtBySql("select t.* from A00201_V01 t  where menu_id ='" + dt_a00201.Rows[0]["MENU_ID"].ToString() + "' order by line_no")));
            }
            //右键属性
            ht.Add("P5", Fun.DataTable2Json(Fun.getDtBySql("select t.*   from a00201_v02 t  where a00201_key ='" + a00201_key + "' order by sort_by")));
            //查询数据的SQL
            showdatasql = Fun.getShowDataSql(a00201_key);
            ht.Add("P6", showdatasql);
            //查询数据数量的SQL
            getShowDataCountSql = Fun.getShowDataCountSql(a00201_key);
            ht.Add("P7", getShowDataCountSql);
            //打印列表
            if (dt_a00201.Rows[0]["if_main"].ToString() == "1")
            {
                ht.Add("P8", Fun.DataTable2Json(Fun.getDtBySql("select t.*   from A00205 t  where menu_id ='" + dt_a00201.Rows[0]["menu_id"].ToString() + "' order by sort_by")));
            }
            else
            {
                ht.Add("P8", "");
            }
            string form_init = dt_a00201.Rows[0]["FORM_INIT"].ToString();

            ht.Add("P10", form_init);
            string jsonText = JsonConvert.SerializeObject(ht);
            Session["JSON_" + a00201_key] = jsonText;
            json = jsonText;
        }
        else
        {
            dt_a013010101       = Fun.getdtByJson(Fun.getJson(json, "P1"));
            dt_a00201           = Fun.getdtByJson(Fun.getJson(json, "P2"));
            showdatasql         = Fun.getJson(json, "P6");
            getShowDataCountSql = Fun.getJson(json, "P7");
        }

        try
        {
            QUERYID = BaseFun.getAllHyperLinks(RequestXml, "<QUERYID>", "</QUERYID>")[0].Value;
        }
        catch
        {
            QUERYID = "";
        }
        string condition = "";

        if (QUERYID != "")
        {
            condition = Fun.getQueryCondition(dt_a00201, QUERYID);
            int    pos       = condition.IndexOf("ORDER BY");
            string str_order = "";
            if (pos > 0)
            {
                str_order = condition.Substring(pos);
                condition = condition.Substring(0, pos - 1);
            }

            showdatasql         = showdatasql + condition + "  " + str_order;
            getShowDataCountSql = getShowDataCountSql + condition;
        }
        string url = "";

        try
        {
            url = BaseFun.getAllHyperLinks(RequestXml, "<URL>", "</URL>")[0].Value;
        }
        catch
        {
            url = "";
        }
        if (url.IndexOf("?") > 0)
        {
            int pos = url.IndexOf("?");
            url = url.Substring(pos + 1);
            string[] data_ = url.Split('&');
            for (int i = 0; i < data_.Length; i++)
            {
                string[] data1_ = data_[i].Split('=');
                showdatasql         = showdatasql.Replace("[REQUEST_" + data1_[0] + "]", data1_[1]);
                getShowDataCountSql = getShowDataCountSql.Replace("[REQUEST_" + data1_[0] + "]", data1_[1]);
            }
        }
    }