Esempio n. 1
0
        private static pcoPlan.Plan getCurrentPlan()
        {
            pcoPlan.Plan currentPlan = new pcoPlan.Plan();

            try
            {
                pcoPlans.Plans livePlans   = new pcoPlans.Plans();
                pcoPlans.Plans sundayPlans = new pcoPlans.Plans();

                string currentPlanUrl;

                livePlans   = JSonHelper.ConvertJSonToObject <pcoPlans.Plans>(getHttpWebResponse(live));
                sundayPlans = JSonHelper.ConvertJSonToObject <pcoPlans.Plans>(getHttpWebResponse(sunday));

                if (Convert.ToDateTime(livePlans.data[0].attributes.dates) < Convert.ToDateTime(sundayPlans.data[0].attributes.dates))
                {
                    currentPlanUrl = livePlans.data[0].links.self;
                }
                else
                {
                    currentPlanUrl = sundayPlans.data[0].links.self;
                }

                currentPlan = JSonHelper.ConvertJSonToObject <pcoPlan.Plan>(getHttpWebResponse(currentPlanUrl));
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("Application", ex.Message);
            }
            finally { }

            return(currentPlan);
        }
Esempio n. 2
0
        private static pcoPlan.Plan getCurrentPlan()
        {
            pcoPlan.Plan currentPlan = new pcoPlan.Plan();

            try
            {
                pcoPlans.Plans livePlans = new pcoPlans.Plans();
                pcoPlans.Plans sundayPlans = new pcoPlans.Plans();

                string currentPlanUrl;

                livePlans = JSonHelper.ConvertJSonToObject<pcoPlans.Plans>(getHttpWebResponse(live));
                sundayPlans = JSonHelper.ConvertJSonToObject<pcoPlans.Plans>(getHttpWebResponse(sunday));

                if (Convert.ToDateTime(livePlans.data[0].attributes.dates) < Convert.ToDateTime(sundayPlans.data[0].attributes.dates))
                    currentPlanUrl = livePlans.data[0].links.self;
                else
                    currentPlanUrl = sundayPlans.data[0].links.self;

                currentPlan = JSonHelper.ConvertJSonToObject<pcoPlan.Plan>(getHttpWebResponse(currentPlanUrl));
            }
            catch (Exception ex)
            {
                System.Diagnostics.EventLog.WriteEntry("Application", ex.Message);
            }
            finally { }

            return currentPlan;
        }