public static string GetJson() { PersonsData data = new PersonsData(); data = Get.GetPersonsData(); string json = JsonConvert.SerializeObject(data); return(json); }
public static PersonsData GetPersonsData() { string sConnLiteStr = new SqlConnectionStringBuilder { DataSource = @"LAPTOP-1GAL0TI1\SQLEXPRESS", InitialCatalog = "StartDB", IntegratedSecurity = true, }.ConnectionString; PersonsData data = new PersonsData(); data.categor_customer = ReadDataLite(sConnLiteStr, @"SELECT DISTINCT categor_customer FROM OrderN", "categor_customer", "", ""); data.categor_product = ReadDataLite(sConnLiteStr, @"SELECT DISTINCT categor_product FROM OrderN", "categor_product", "", ""); data.name_product = ReadDataLite(sConnLiteStr, @"SELECT DISTINCT name_product, price, categor_product FROM OrderN", "name_product", "price", "categor_product"); data.name_customer = ReadDataLite(sConnLiteStr, @"SELECT DISTINCT name_customer, categor_customer FROM OrderN", "name_customer", "categor_customer", ""); data.id_order = ReadDataLite(sConnLiteStr, @"SELECT DISTINCT id_order, name_product, name_customer FROM OrderN", "id_order", "name_product", "name_customer"); return(data); }