protected RatesObject TransformRatesInfoIntoObject(string json)
        {
            JavaScriptSerializer jss         = new JavaScriptSerializer();
            RatesObject          ratesObject = jss.Deserialize <RatesObject>(json);

            if (ratesObject.formatedAddress != null)
            {
                PropertyName.Text = ratesObject.formatedAddress;
            }
            return(ratesObject);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string assessmentNumber = Request.QueryString["AssessmentNumber"];

            if (assessmentNumber != null)
            {
                //download rates info from api
                ratingInfo = TransformRatesInfoIntoObject(GetRatesInfo(assessmentNumber));

                //convert into string
                PropertyInfoForList propInfo = new PropertyInfoForList(ratingInfo);

                hiddenAddressServer.Text = propInfo.formatedAddress;

                Dictionary <string, string> propertyItems = new Dictionary <string, string>();
                propertyItems.Add("Assessment Number", propInfo.assessmentNumber.ToString());
                propertyItems.Add("Valuation Number", propInfo.valuationNumber.ToString());
                propertyItems.Add("Property Address", propInfo.formatedAddress.ToString());
                propertyItems.Add("Ratepayer Name(s)", propInfo.owners.ToString());
                propertyItems.Add("Postal Address for this Assessment", propInfo.postal.ToString());
                propertyItems.Add("Land Zone", propInfo.zones.ToString());

                gridPropertyInfo.DataSource = propertyItems;
                gridPropertyInfo.DataBind();


                Dictionary <string, string> currentRatesItems = new Dictionary <string, string>();
                currentRatesItems.Add("Current Rating Year", propInfo.ratingYear.ToString());
                currentRatesItems.Add("Rateability", propInfo.rateable.ToString());
                currentRatesItems.Add("Legal Description", propInfo.qvLegalDescription.ToString());
                currentRatesItems.Add("Area", propInfo.landArea.ToString());
                currentRatesItems.Add("Land Value", propInfo.landValue.ToString());
                currentRatesItems.Add("Capital Value", propInfo.capitalValue.ToString());
                gridCurrentRates.DataSource = currentRatesItems;
                gridCurrentRates.DataBind();


                decimal total = 0;

                List <LeviedDetailForList> leviedList = new List <LeviedDetailForList>();
                leviedList.Add(new LeviedDetailForList("Description", "Factor", "Rate or Charge", "Amount"));

                foreach (RatesLevyDetail item in ratingInfo.levyDetails)
                {
                    leviedList.Add(new LeviedDetailForList(item.levyDescription, item.rate, item.basis, item.levied));
                    total += item.levied;
                }
                leviedList.Add(new LeviedDetailForList("Total", total));

                gridRatesLevied.DataSource = leviedList;
                gridRatesLevied.DataBind();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string assessmentNumber = Request.QueryString["AssessmentNumber"];

            if (assessmentNumber != null)
            {
                //download rates info from api
                ratingInfo = TransformRatesInfoIntoObject(GetRatesInfo(assessmentNumber));

                //convert into string
                PropertyInfoForList propInfo = new PropertyInfoForList(ratingInfo);

                hiddenAddressServer.Text = propInfo.formatedAddress;

                Dictionary<string, string> propertyItems = new Dictionary<string, string>();
                propertyItems.Add("Assessment Number", propInfo.assessmentNumber.ToString());
                propertyItems.Add("Valuation Number", propInfo.valuationNumber.ToString());
                propertyItems.Add("Property Address", propInfo.formatedAddress.ToString());
                propertyItems.Add("Ratepayer Name(s)", propInfo.owners.ToString());
                propertyItems.Add("Postal Address for this Assessment", propInfo.postal.ToString());
                propertyItems.Add("Land Zone", propInfo.zones.ToString());

                gridPropertyInfo.DataSource = propertyItems;
                gridPropertyInfo.DataBind();

                Dictionary<string, string> currentRatesItems = new Dictionary<string, string>();
                currentRatesItems.Add("Current Rating Year", propInfo.ratingYear.ToString());
                currentRatesItems.Add("Rateability", propInfo.rateable.ToString());
                currentRatesItems.Add("Legal Description", propInfo.qvLegalDescription.ToString());
                currentRatesItems.Add("Area", propInfo.landArea.ToString());
                currentRatesItems.Add("Land Value", propInfo.landValue.ToString());
                currentRatesItems.Add("Capital Value", propInfo.capitalValue.ToString());
                gridCurrentRates.DataSource = currentRatesItems;
                gridCurrentRates.DataBind();

                decimal total = 0;

                List<LeviedDetailForList> leviedList = new List<LeviedDetailForList>();
                leviedList.Add(new LeviedDetailForList("Description", "Factor", "Rate or Charge", "Amount"));

                foreach (RatesLevyDetail item in ratingInfo.levyDetails)
                {
                    leviedList.Add(new LeviedDetailForList(item.levyDescription, item.rate, item.basis, item.levied));
                    total += item.levied;
                }
                leviedList.Add(new LeviedDetailForList("Total", total));

                gridRatesLevied.DataSource = leviedList;
                gridRatesLevied.DataBind();
            }
        }
        public PropertyInfoForList(RatesObject ratesObject)
        {
            this.assessmentNumber = ratesObject.assessmentNumber.ToString();

            if (ratesObject.valuationNumber != null)
            {
                this.valuationNumber = ratesObject.valuationNumber.ToString();
            }
            else
            {
                this.valuationNumber = "";
            }

            this.valuationYear = ratesObject.valuationYear.ToString();


            this.landValue = ratesObject.landValue.ToString("C");


            this.capitalValue = ratesObject.capitalValue.ToString("C");

            if (ratesObject.rateable != null)
            {
                if (ratesObject.rateable == "Y")
                {
                    this.rateable = "Rateable";
                }
                else
                {
                    this.rateable = "Non-Rateable";
                }
            }
            else
            {
                this.rateable = "";
            }

            this.landArea = ratesObject.landArea.ToString() + "ha";

            if (ratesObject.houseAddress != null)
            {
                this.houseAddress = ratesObject.houseAddress.ToString();
            }
            else
            {
                this.houseAddress = "";
            }
            if (ratesObject.formatedAddress != null)
            {
                this.formatedAddress = ratesObject.formatedAddress.ToString();
            }
            else
            {
                this.formatedAddress = "";
            }
            if (ratesObject.formatedStreetAddress != null)
            {
                this.formatedStreetAddress = ratesObject.formatedStreetAddress.ToString();
            }
            else
            {
                this.formatedStreetAddress = "";
            }

            this.levied = ratesObject.levied.ToString("C");

            if (ratesObject.qvLegalDescription != null)
            {
                this.qvLegalDescription = ratesObject.qvLegalDescription.ToString();
            }
            else
            {
                this.qvLegalDescription = "";
            }
            if (ratesObject.zones != null)
            {
                this.zones = ratesObject.zones.ToString();
            }
            else
            {
                this.zones = "";
            }
            if (ratesObject.ratingYear != null)
            {
                this.ratingYear = ratesObject.ratingYear.ToString();
            }
            else
            {
                this.ratingYear = "";
            }
            if (ratesObject.owners != null)
            {
                this.owners = ratesObject.owners.ToString();
            }
            else
            {
                this.owners = "";
            }
            if (ratesObject.postal != null)
            {
                this.postal = ratesObject.postal.ToString();
            }
            else
            {
                this.postal = "";
            }
        }