protected void Page_Load(object sender, EventArgs e)
        {
            //Get Data
            SqlCommand cmd = new SqlCommand("[Stored Proc Name]", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandTimeout = 14400;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();

            if (con.State != ConnectionState.Open)
                con.Open();

            da.Fill(ds);
            con.Close();

            DataTable dt = ds.Tables[0];
            string json = "[";

            //Build JSON
            foreach (DataRow dr in dt.Rows)
            {
                json = "{";

                foreach (DataColumn dc in dt.Rows)
                    json += "\"" + dc.ColumnName + "\": \"" + dr[dc.ColumnName] + "\"";

                json = "}";
            }

            json += "]";

            ParseWebRequest request = new ParseWebRequest();

            request.UpdateParseDataPost("ParjvvKO2Xxt0R1qbJccfxT7CzJF9jAjjseSWPsW"
                    , "84Q84H3PIlWWZVxBQQDpGz2a3t3TR2bViIJcLb0A"
                    , "https://api.parse.com/1/classes/Booth" //+ "/" + ""
                    , json);
        }
        //protected void Page_Load(object sender, EventArgs e)
        //{
        //    ParseWebRequest request = new ParseWebRequest();
        //    string time = DateTime.Now.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffK");
        //    //string jsonData = request.GetParseData("CtWCmGmHcZvsEDOSbd8VzVrC385gn9jsj2ER84pL"
        //    //                    , "Re26wTkXBBGQ4800kS6SZAZWSRgWTG60xiM9vVg7"
        //    //                    , "https://api.parse.com/1/classes/OSRSupportMeetingRequest"
        //    //                    , "where={\"date_email_sent_to_support\": \"\"}");
        //    request.UpdateParseData("CtWCmGmHcZvsEDOSbd8VzVrC385gn9jsj2ER84pL"
        //                        , "Re26wTkXBBGQ4800kS6SZAZWSRgWTG60xiM9vVg7"
        //                        , "https://api.parse.com/1/classes/OSRSupportMeetingRequest/UmHEswTCfi"
        //                        , "{\"date_email_sent_to_support\": \"" + time + "\"}");
        //    //Response.Write(jsonData);
        //}
        protected void Page_Load(object sender, EventArgs e)
        {
            ParseWebRequest request = new ParseWebRequest();

            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "log.txt");

            string responseText = "";

            string listener_SendTo = ConfigurationManager.AppSettings["Listener_SendTo"].ToString();
            string listener_Subject = ConfigurationManager.AppSettings["Listener_Subject"].ToString();
            string listener_SendFrom = ConfigurationManager.AppSettings["Listener_SendFrom"].ToString();
            string listener_SendCC = ConfigurationManager.AppSettings["Listener_SendCC"].ToString();

            string listener_ParseUserName = ConfigurationManager.AppSettings["Listener_ParseUserName"].ToString();
            string listener_ParsePassword = ConfigurationManager.AppSettings["Listener_ParsePassword"].ToString();
            string listener_ParseAuthenticationID = ConfigurationManager.AppSettings["Listener_ParseAuthenticationID"].ToString();
            string listener_ParseRestAPIKey = ConfigurationManager.AppSettings["Listener_ParseRestAPIKey"].ToString();
            string listener_ParseMasterKey = ConfigurationManager.AppSettings["Listener_ParseMasterKey"].ToString();
            string listener_SMTPClient = ConfigurationManager.AppSettings["Listener_SMTPClient"].ToString();
            string listener_SMTPPort = ConfigurationManager.AppSettings["Listener_SMTPPort"].ToString();
            string listener_MessageFailEmailAddress = ConfigurationManager.AppSettings["Listener_MessageFailEmailAddress"].ToString();
            string listener_BaseURL = ConfigurationManager.AppSettings["Listener_BaseURL"].ToString();

            try
            {
                responseText = request.GetParseData(listener_ParseAuthenticationID
                                    , listener_ParseMasterKey
                                    , listener_BaseURL
                                    , "where={\"date_email_sent_to_support\": {\"$in\":[null,\"\"]}}"); //fetch entries with null or empty string.
            }
            catch (Exception ex)
            {
                File.AppendAllText(path, DateTime.Now.ToString() + " - Fetch Data Fail - " + ex.ToString() + Environment.NewLine);
                return;
            }

            if (responseText == null || responseText == "")
                return;

            var jss = new JavaScriptSerializer();

            dynamic data = jss.Deserialize<dynamic>(responseText);

            foreach (dynamic item in data)
            {
                foreach (dynamic row in item.Value)
                {
                    bool sentOK = false;
                    string oID = row["objectId"];
                    string body = "";
                    string userEmail = "";
                    userEmail = GetValueByKey(row, "user_email_address");

                    string requestTime = SafeDateFormat(GetValueByKey(row, "date_request_entered"));
                    string scheduleDate = SafeDateFormat(GetValueByKey(row, "schedule_time_requested"));
                    string scheduleDay = SafeSplit(scheduleDate, ' ', 0);
                    string scheduleTime = SafeSplit(scheduleDate, ' ', 1) + " " + SafeSplit(scheduleDate, ' ', 2);

                    body = "Esriid:" + GetValueByKey(row, "user_esri_registration") + Environment.NewLine +
                            "Name:" + GetValueByKey(row, "user_name") + Environment.NewLine +
                            "Organization:" + GetValueByKey(row, "user_organization_name") + Environment.NewLine +
                            "Email:" + GetValueByKey(row, "user_email_address") + Environment.NewLine +
                            "Phone:" + GetValueByKey(row, "user_phone_number") + Environment.NewLine +
                            "Product:" + GetValueByKey(row, "support_skill_type_name") + Environment.NewLine +
                            "Technology:" + GetValueByKey(row, "support_skill_subtype_name") + Environment.NewLine +
                            "Availableday:" + scheduleDay + Environment.NewLine +
                            "Availabletime:" + scheduleTime + Environment.NewLine +
                            "Requesttime:" + requestTime + Environment.NewLine +
                            "Description:" + ReplaceCharacters(GetValueByKey(row, "problem_description"), @"\\n,\n,%0A,\") + Environment.NewLine +
                            "EventID:" + "a0E3000000D0VFo";

                    try
                    {

                        sentOK = SendMessage(listener_SendTo
                                        , listener_Subject
                                        , listener_SendFrom
                                        , listener_SendCC
                                        , body
                                        , listener_SMTPClient
                                        , listener_SMTPPort);

                        if (sentOK)
                        {
                            string time = DateTime.Now.ToUniversalTime().ToString("yyyy'-'MM'-'dd' 'HH':'mm':'ss") + " +0000";

                            request.UpdateParseData(listener_ParseAuthenticationID
                                                , listener_ParseMasterKey
                                                , listener_BaseURL + "/" + oID
                                                , "{\"date_email_sent_to_support\": \"" + time + "\"}");
                        }
                        else
                        {
                            File.AppendAllText(path, DateTime.Now.ToString() + " - Email Send Fail - No Exceptions thrown" + Environment.NewLine);
                            return;
                        }
                    }
                    catch (Exception ex2)
                    {
                        if (sentOK)
                            File.AppendAllText(path, DateTime.Now.ToString() + " - Date Update Fail - " + ex2.ToString() + Environment.NewLine);
                        else
                            File.AppendAllText(path, DateTime.Now.ToString() + " - Email Send Fail - " + ex2.ToString() + Environment.NewLine);

                        return;
                    }
                }

            }
        }