Wednesday, 26 February 2014

JSON WITH EXAMPLE

{
    "multidomainwindowshosting": {
        "7": {
            "renew": {
                "3": 523.86
            },
            "ssl": 299.03,
            "add": {
                "3": 523.86
            }
        },
        "8": {
            "renew": {
                "3": 373.97
            },
            "ssl": 299.03,
            "add": {
                "3": 373.97
            }
        }
    },
    "singledomainhostinglinuxus": {
        "3148238": {
            "renew": {
                "12": 111.67
            },
            "ssl": 111.67,
            "add": {
                "12": 261.55
            }
        }
    },
    "singledomainhostinglinuxin": {
        "3148243": {
            "renew": {
                "12": 111.67
            },
            "ssl": 111.67,
            "add": {
                "12": 261.55
            }
        }
    },
    "multidomainwindowshostingin": {
        "26": {
            "renew": {
                "3": 373.97
            },
            "ssl": 299.03,
            "add": {
                "3": 373.97
            }
        },
        "27": {
            "renew": {
                "3": 523.86
            },
            "ssl": 299.03,
            "add": {
                "3": 523.86
            }
        }
    },
    "resellerwindowshostingin": {
        "32": {
            "renew": {
                "1": 1198.36
            },
            "ssl": 299.03,
            "add": {
                "1": 1198.36
            }
        },
        "33": {
            "renew": {
                "1": 1460.66
            },
            "ssl": 299.03,
            "add": {
                "1": 1460.66
            }
        },
        "34": {
            "renew": {
                "1": 2022.74
            },
            "ssl": 299.03,
            "add": {
                "1": 2022.74
            }
        },
        "35": {
            "renew": {
                "1": 3071.96
            },
            "ssl": 299.03,
            "add": {
                "1": 3071.96
            }
        }
    },
    "singledomainhostinglinuxuk": {
        "3148240": {
            "renew": {
                "12": 261.55
            },
            "ssl": 299.03,
            "add": {
                "12": 261.55
            }
        }
    },
    "thawtecert": {
        "0": {
            "pricing": {
                "ssl": {
                    "renew": {
                        "1": "8056.48",
                        "2": "14301.82"
                    },
                    "add": {
                        "1": "9305.55",
                        "2": "15550.89"
                    },
                    "additionallicense": {
                        "1": "5583.33",
                        "2": "12440.71"
                    }
                },
                "fssl": {
                    "renew": {
                        "1": "4309.28",
                        "2": "7431.95"
                    },
                    "add": {
                        "1": "4309.28",
                        "2": "7431.95"
                    },
                    "additionallicense": {
                        "1": "3016.50",
                        "2": "5276.68"
                    }
                },
                "wild": {
                    "renew": {
                        "1": "40532.23",
                        "2": "62390.91"
                    },
                    "add": {
                        "1": "40532.23",
                        "2": "62390.91"
                    },
                    "additionallicense": {
                        "1": "32425.78",
                        "2": "53032.27"
                    }
                },
                "sgc": {
                    "renew": {
                        "1": "19922.62",
                        "2": "34286.89"
                    },
                    "add": {
                        "1": "24918.89",
                        "2": "40532.23"
                    },
                    "additionallicense": {
                        "1": "19187.55",
                        "2": "32425.78"
                    }
                }
            },
            "category": {
                "category3": {
                    "name": "NA",
                    "quantity": "0.00"
                },
                "category2": {
                    "name": "receipts",
                    "quantity": "0.00"
                },
                "category1": {
                    "name": "digicert",
                    "quantity": "0.00"
                },
                "category6": {
                    "name": "NA",
                    "quantity": "0.00"
                },
                "category5": {
                    "name": "NA",
                    "quantity": "0.00"
                },
                "category4": {
                    "name": "NA",
                    "quantity": "0.00"
                }
            }
        }
    },
    "multidomainwindowshostinguk": {
        "50": {
            "renew": {
                "3": 373.97
            },
            "ssl": 299.03,
            "add": {
                "3": 373.97
            }
        },
        "51": {
            "renew": {
                "3": 523.86
            },
            "ssl": 299.03,
            "add": {
                "3": 523.86
            }
        }
    },
    "resellerwindowshostinguk": {
        "44": {
            "renew": {
                "1": 1198.36
            },
            "ssl": 299.03,
            "add": {
                "1": 1198.36
            }
        },
        "45": {
            "renew": {
                "1": 1460.66
            },
            "ssl": 299.03,
            "add": {
                "1": 1460.66
            }
        },
        "46": {
            "renew": {
                "1": 2022.74
            },
            "ssl": 299.03,
            "add": {
                "1": 2022.74
            }
        },
        "47": {
            "renew": {
                "1": 3071.96
            },
            "ssl": 299.03,
            "add": {
                "1": 3071.96
            }
        }
    },
    "singledomainhostingwindowsus": {
        "3148242": {
            "renew": {
                "12": 448.17
            },
            "ssl": 149.14,
            "add": {
                "12": 448.17
            }
        }
    },
    "singledomainhostingwindowsin": {
        "3148241": {
            "renew": {
                "12": 448.17
            },
            "ssl": 149.14,
            "add": {
                "12": 448.17
            }
        }
    },
    "resellerwindowshosting": {
        "9": {
            "renew": {
                "1": 1112.17
            },
            "ssl": 329,
            "add": {
                "1": 1112.17
            }
        },
        "10": {
            "renew": {
                "1": 1648.02
            },
            "ssl": 329,
            "add": {
                "1": 1648.02
            }
        },
        "11": {
            "renew": {
                "1": 2225.09
            },
            "ssl": 329,
            "add": {
                "1": 2225.09
            }
        },
        "12": {
            "renew": {
                "1": 3626.54
            },
            "ssl": 329,
            "add": {
                "1": 3626.54
            }
        }
    },
    "resellerhostinglinuxin": {
        "28": {
            "renew": {
                "1": 1460.66
            },
            "ssl": 299.03,
            "add": {
                "1": 1460.66
            }
        },
        "29": {
            "renew": {
                "1": 1385.72
            },
            "ssl": 299.03,
            "add": {
                "1": 1385.72
            }
        },
        "30": {
            "renew": {
                "1": 2022.74
            },
            "ssl": 299.03,
            "add": {
                "1": 2022.74
            }
        },
        "31": {
            "renew": {
                "1": 3146.9
            },
            "ssl": 299.03,
            "add": {
                "1": 3146.9
            }
        }
    },
    "singledomainhostingwindowsuk": {
        "3148239": {
            "renew": {
                "12": 261.55
            },
            "ssl": 149.14,
            "add": {
                "12": 261.55
            }
        }
    },
    "multidomainhostinglinuxin": {
        "24": {
            "renew": {
                "3": 411.44
            },
            "ssl": 186.61,
            "add": {
                "3": 411.44
            }
        },
        "25": {
            "renew": {
                "3": 299.03
            },
            "ssl": 186.61,
            "add": {
                "3": 299.03
            }
        }
    },
    "vpslinuxus": {
        "addons": {
            "plesk_unlimited_domain": 741.95,
            "ssl": 246.57,
            "cpanel": 906.82,
            "whmcs": 412.19,
            "plesk_10_domain": 247.32,
            "plesk_100_domain": 412.19
        },
        "plans": {
            "14": {
                "renew": {
                    "1": 1648.77
                },
                "add": {
                    "1": 1648.77
                }
            },
            "15": {
                "renew": {
                    "1": 2390.71
                },
                "add": {
                    "1": 2390.71
                }
            },
            "16": {
                "renew": {
                    "1": 3709.73
                },
                "add": {
                    "1": 3709.73
                }
            },
            "17": {
                "renew": {
                    "1": 4863.87
                },
                "add": {
                    "1": 4863.87
                }
            },
            "18": {
                "renew": {
                    "1": 6182.88
                },
                "add": {
                    "1": 6182.88
                }
            },
            "19": {
                "renew": {
                    "1": 8161.41
                },
                "add": {
                    "1": 8161.41
                }
            },
            "20": {
                "renew": {
                    "1": 10634.56
                },
                "add": {
                    "1": 10634.56
                }
            },
            "21": {
                "renew": {
                    "1": 13107.71
                },
                "add": {
                    "1": 13107.71
                }
            },
            "22": {
                "renew": {
                    "1": 18878.4
                },
                "add": {
                    "1": 18878.4
                }
            },
            "23": {
                "renew": {
                    "1": 24649.09
                },
                "add": {
                    "1": 24649.09
                }
            }
        }
    },
    "resellerhosting": {
        "3": {
            "renew": {
                "1": 299.03
            },
            "ssl": 186.61,
            "add": {
                "1": 0
            }
        },
        "4": {
            "renew": {
                "1": 299.03
            },
            "ssl": 186.61,
            "add": {
                "1": 299.03
            }
        },
        "5": {
            "renew": {
                "1": 299.03
            },
            "ssl": 186.61,
            "add": {
                "1": 299.03
            }
        },
        "6": {
            "renew": {
                "1": 299.03
            },
            "ssl": 186.61,
            "add": {
                "1": 299.03
            }
        },
        "141": {
            "renew": {
                "1": 733.38
            },
            "ssl": 325.54,
            "add": {
                "1": 651.81
            }
        }
    },
    "resellerhostinglinuxuk": {
        "40": {
            "renew": {
                "1": 1385.72
            },
            "ssl": 299.03,
            "add": {
                "1": 1385.72
            }
        },
        "41": {
            "renew": {
                "1": 1460.66
            },
            "ssl": 299.03,
            "add": {
                "1": 1460.66
            }
        },
        "42": {
            "renew": {
                "1": 2022.74
            },
            "ssl": 299.03,
            "add": {
                "1": 2022.74
            }
        },
        "43": {
            "renew": {
                "1": 3146.9
            },
            "ssl": 299.03,
            "add": {
                "1": 3146.9
            }
        }
    },
    "multidomainhostinglinuxuk": {
        "48": {
            "renew": {
                "3": 299.03
            },
            "ssl": 186.61,
            "add": {
                "3": 299.03
            }
        },
        "49": {
            "renew": {
                "3": 411.44
            },
            "ssl": 186.61,
            "add": {
                "3": 411.44
            }
        }
    },
    "dotnet": {
        "addtransferdomain": {
            "1": 590.23
        },
        "restoredomain": {
            "1": 5620.18
        },
        "addnewdomain": {
            "1": 580.23,
            "2": 570.23,
            "3": 560.23,
            "4": 550.23,
            "5": 540.23,
            "6": 530.23,
            "7": 520.23,
            "8": 510.23,
            "9": 500.23,
            "10": 490.23
        },
        "renewdomain": {
            "1": 580.23,
            "2": 580.23,
            "3": 530.23,
            "4": 530.23,
            "5": 530.23,
            "6": 530.23,
            "7": 530.23,
            "8": 530.23,
            "9": 530.23,
            "10": 530.23
        }
    },
    "domcno": {
        "addtransferdomain": {
            "1": 530.23
        },
        "restoredomain": {
            "1": 5620.18
        },
        "addnewdomain": {
            "1": 530.23,
            "2": 530.23,
            "3": 530.23,
            "4": 530.23,
            "5": 530.23,
            "6": 530.23,
            "7": 530.23,
            "8": 530.23,
            "9": 530.23,
            "10": 530.23
        },
        "renewdomain": {
            "1": 530.23,
            "2": 530.23,
            "3": 530.23,
            "4": 530.23,
            "5": 530.23,
            "6": 530.23,
            "7": 530.23,
            "8": 530.23,
            "9": 530.23,
            "10": 530.23
        }
    },
    "hosting": {
        "3148236": {
            "renew": {
                "12": 26.23
            },
            "add": {
                "12": 111.67
            }
        },
        "3148237": {
            "renew": {
                "12": 299.03
            },
            "add": {
                "12": 523.86
            }
        }
    },
    "multidomainhosting": {
        "1": {
            "renew": {
                "3": 299.03
            },
            "ssl": 186.61,
            "add": {
                "3": 299.03
            }
        },
        "2": {
            "renew": {
                "3": 411.44
            },
            "ssl": 186.61,
            "add": {
                "3": 411.44
            }
        }
    }
}




**************************** PROGRAMMING WITH JSON *****************

//Download DLL of (Json Newtonsoft.Json.dll) and put it in BIN folder
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Data;
public partial class About : System.Web.UI.Page
{
    string redirecturl = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        getdata();

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string i, a, q;
        i = TextBox1.Text;
        a = TextBox2.Text;
        q = TextBox3.Text;
        redirecturl = getpay(i, a, q);
        Response.Redirect(redirecturl);
       
     //   redirecturl += "&return=http://www.google.com&cancel_return=http://www.rediffmail.com&currency_code=USD";
     
    }

    string getpay(string name, string amount, string qty)
    {
        string emailid = "sanyogcgc@gmail.com";
        redirecturl += "https://www.sandbox.paypal.com/us/cgi-bin/webscr?cmd=_cart&upload=1&business=" + emailid;
        redirecturl += "&item_name_1=" + name;
        redirecturl += "&amount_1=" + amount;
        redirecturl += "&quantity_1=" + qty;
        return redirecturl;
    }

    public void getdata()
    {
     
        string f = @"D:\HarjotWorkspace\WebSite3\ouula.txt";

        int i;
        List<string> lines = new List<string>();
        string s = string.Empty;
     
        using (StreamReader r = new StreamReader(f))
        {
         
         
            string line=r.ReadToEnd();
            //while (line != null)
            //{
            //    // 4
            //    // Insert logic here.
            //    // ...
             
            //    // "line" is a line in the file. Add it to our List.
            //   s += line + "<br/>";
            //    line=r.ReadLine();
               
            //}
            JObject o = JObject.Parse(line);


            DataTable dtDomainPrc = new DataTable();
            dtDomainPrc.Columns.Add("id", typeof(int));
            dtDomainPrc.Columns.Add("Type", typeof(string)); //.net,com
            dtDomainPrc.Columns.Add("Year", typeof(string));  //No. of years for which Domain is provided
            dtDomainPrc.Columns.Add("Price", typeof(decimal));
            dtDomainPrc.Columns.Add("ToDsp", typeof(string)); //Dropdown Text
            foreach (JProperty items in o["domcno"].Children())  //.com Extension
            {
                if (items.Name == "addnewdomain")
                {
                    JObject jso = JObject.Parse(items.Value.ToString());
                    for (int cnt = 1; cnt < 11; cnt++)
                    {
                        DataRow dtRow = dtDomainPrc.NewRow();
                        dtRow["id"] = cnt;
                        dtRow["Type"] = "com";
                        dtRow["Year"] = cnt;
                        dtRow["Price"] = jso[cnt.ToString()].ToString();
                        dtRow["ToDsp"] = cnt + " year(s) at Rs. " + jso[cnt.ToString()].ToString() + "/ yr";
                        dtDomainPrc.Rows.Add(dtRow);
                    }
                }
            }
           DataTable dtt=new DataTable();
            dtt=dtDomainPrc;
           // int k;
            foreach (DataRow dr in dtt.Rows)
            {
             
                Response.Write(dr.ItemArray[4]);
            }

         
           
        }


    }
}

No comments:

Post a Comment