Beispiel #1
0
        public Dictionary <string, object> AgentGetAll(int start_index, int count)
        {
            Console.WriteLine($"start_index={start_index}, count={count}");
            if (count < 1)
            {
                count = 10;
            }
            if (start_index < 0)
            {
                start_index = 0;
            }
            SQLiteDataReader reader = client.Query(
                $"select Id, TotalDeals, MonthDeals, MonthPayment from Agent limit {count} offset {start_index};");

            return(CommonDataview.Build(reader));
        }
        public Dictionary <string, object> PersonGetAll(int start_index, int count)
        {
            Console.WriteLine($"start_index={start_index}, count={count}");
            if (count < 1)
            {
                count = 10;
            }
            if (start_index < 0)
            {
                start_index = 0;
            }
            SQLiteDataReader reader = client.Query(
                $"select Id, Surname, Name, Phone from Person limit {count} offset {start_index};");

            return(CommonDataview.Build(reader));
        }
Beispiel #3
0
        public Dictionary <string, object> EstateObjectGetAll(int start_index, int count)
        {
            Console.WriteLine($"start_index={start_index}, count={count}");
            if (count < 1)
            {
                count = 10;
            }
            if (start_index < 0)
            {
                start_index = 0;
            }
            SQLiteDataReader reader = client.Query(
                $"select Id, LocationId, Price, Description from EstateObject limit {count} offset {start_index};");

            return(CommonDataview.Build(reader));
        }
        public Dictionary <string, object> DealGetAll(int start_index, int count)
        {
            Console.WriteLine($"start_index={start_index}, count={count}");
            if (count < 1)
            {
                count = 10;
            }
            if (start_index < 0)
            {
                start_index = 0;
            }
            SQLiteDataReader reader = client.Query(
                $"select Id, SellerId, BuyerId, AgentId, Price, DealDate from Deal limit {count} offset {start_index};");

            return(CommonDataview.Build(reader));
        }
Beispiel #5
0
        public Dictionary <string, object> ClientWishGetAll(int start_index, int count)
        {
            Console.WriteLine($"start_index={start_index}, count={count}");
            if (count < 1)
            {
                count = 10;
            }
            if (start_index < 0)
            {
                start_index = 0;
            }
            SQLiteDataReader reader = client.Query(
                $"select Id, PersonId, PostDate, Variant, Price from ClientWish limit {count} offset {start_index};");

            return(CommonDataview.Build(reader));
        }
Beispiel #6
0
        public Dictionary <string, object> RawSql(Dictionary <string, string> Data)
        {
            if (Data.ContainsKey("Query"))
            {
                string op = Data["Query"].Split(' ')[0].ToLower();
                if (op != "select")
                {
                    return new Dictionary <string, object>()
                           {
                               ["Good"]    = 0,
                               ["Message"] = "Only select operation is supported, for your own safety!"
                           }
                }
                ;
                try
                {
                    var reader = client.Query(Data["Query"]);

                    var result = CommonDataview.Build(reader);
                    result["Good"] = 1;
                    return(result);
                }
                catch (Exception ee)
                {
                    return(new Dictionary <string, object>()
                    {
                        ["Good"] = 0, ["Message"] = ee.Message
                    });
                }
            }
            return(new Dictionary <string, object>()
            {
                ["Good"] = 0
            });
        }
    }