Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary<String, String> appDef = new Dictionary<String, String>();

            DataConnection actDB = new DataConnection();

            if (actDB.OpenConnection("DATABASE"))
            {
                appDef.Add("Name", "ACT IIb");
                appDef.Add("Description", "Welcome to ACTII<br />Community and Economic Development's<br />Contact Management System");
                appDef.Add("Footer", "&copy; 2011 PPL Corporation. All Rights Reserved.");

                JavaScriptSerializer rs = new JavaScriptSerializer();
                Response.Write(rs.Serialize(appDef));
            }

            actDB.CloseConnection();
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary<String, Object> responsePackage = new Dictionary<String, Object>();
            List<Dictionary<String, String>> responses = new List<Dictionary<String, String>>();
            Dictionary<String, String> response = new Dictionary<String, String>();
            Dictionary<String, String> status = new Dictionary<String, String>();
            JavaScriptSerializer rs = new JavaScriptSerializer();

            try
            {

                Stream instream = Page.Request.InputStream;
                BinaryReader br = new BinaryReader(instream,
                System.Text.Encoding.UTF8);
                byte[] bytes = br.ReadBytes((int)instream.Length);

                System.Text.Encoding enc = System.Text.Encoding.ASCII;
                String superProject = enc.GetString(bytes);
                DataConnection theDB = new DataConnection();

                Dictionary<String, Object> jsonRequest = new Dictionary<String, Object>();
                jsonRequest = rs.Deserialize<Dictionary<String, Object>>(enc.GetString(bytes));

                String request = (String)jsonRequest["request"];
                String action = (String)jsonRequest["action"];
                //String connectionType = (String)jsonRequest["connectionType"];
                Dictionary<String, Object> requestData = (Dictionary<String, Object>)jsonRequest["requestData"];

                String userName = Request.ServerVariables["AUTH_USER"];

                //Security securityA = new Security();
                //Boolean ok = securityA.CheckGroup(new String[] {"PPL\\ISD-DL-GIS","aaa"});

                // Allow for case insensitive search.
                theDB.execNonQuery("alter session set NLS_SORT=BINARY_CI");
                theDB.execNonQuery("alter session set NLS_COMP=LINGUISTIC");

                OracleDataReader resultA = null;

                if (theDB.OpenConnection("PVEU"))
                {

                    // Dynamically build query:
                    String sql = "select count(*) from P3E_ACT11_SPNUMBER where SP_NUMBER = '" + requestData["superProject"] + "' and DELETE_DATE is null";
                    resultA = theDB.execQuery(sql);
                    Boolean alreadyExists = false;

                    if (resultA != null)
                    {
                        while (resultA.Read())
                        {
                            if (resultA.GetInt32(0) > 0)
                            {
                                alreadyExists = true;
                            }
                        }
                        resultA.Close();
                    }
                    theDB.CloseConnection();

                    response = new Dictionary<String, String>();
                    if (alreadyExists)
                    {
                        response["exists"] = "true";
                        //Response.Write("true");
                    }
                    else
                    {
                        response["exists"] = "false";
                        //Response.Write("false");
                    }
                    responses.Add(response);
                }

                status.Add("result", "true");
                status.Add("message", "");
                responsePackage.Add("data", responses);
                responsePackage.Add("status", status);

                Response.Write(rs.Serialize(responsePackage));

            }
            catch (Exception ex)
            {
                status.Add("result", "false");
                status.Add("message", ex.Message + "\n" + ex.StackTrace);

                Response.Write(rs.Serialize(responsePackage));
                //Response.Write(ex.Message + "\n" + ex.StackTrace);
            }
        }