Ejemplo n.º 1
0
        public static List <String> GetJoinData(string sql, params object[] values)
        {
            List <String> tablo = new List <string>();
            int           kayit = 0;

            try
            {
                if (sql.IndexOf("INNER JOIN") != -1 || sql.IndexOf("LEFT JOIN") != -1 || sql.IndexOf("Inner Join") != -1 || sql.IndexOf("Left Join") != -1 || sql.IndexOf("inner join") != -1 || sql.IndexOf("left join") != -1)
                {
                    DataSet ds         = WebFramework.DataSetFill(sql, values);
                    String  verikumesi = null;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            for (int j = 0; j < ds.Tables[0].Columns.Count; j++)
                            {
                                verikumesi += ds.Tables[0].Rows[i][j] + Config.parse.ToString();
                            }
                            verikumesi = verikumesi.Remove(verikumesi.Length - 1);
                            tablo.Add(verikumesi);
                            verikumesi = null;
                        }
                        kayit = ds.Tables[0].Rows.Count;
                        if (Config.debug == true)
                        {
                            FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + "Count: " + kayit);
                        }
                        return(tablo);
                    }
                    else
                    {
                        if (Config.debug == true)
                        {
                            FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + "Count: " + kayit);
                        }
                        tablo.Add("");
                        return(tablo);
                    }
                }
                else
                {
                    if (Config.debug == true)
                    {
                        FrameworkHandler.DebugLogger(sql + System.Environment.NewLine + "Could not execute SQL query could not be found in the inner join and left join, please check your query.");
                    }
                    tablo.Add("Couldn't run Sql in question, please check your query.");
                    return(tablo);
                }
            }
            catch (Exception hata)
            {
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger(hata.ToString());
                }
                tablo.Add("Error:" + hata.Message);
                return(tablo);
            }
        }
Ejemplo n.º 2
0
        public static string GetJSONData(string sql, params object[] values)
        {
            try
            {
                WebFramework web = new WebFramework();
                DataTable    dt  = web.DataTableGetir(sql, values);
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger("SQL Execute: " + sql + " \nCount: " + dt.Rows.Count);
                }

                return(Utils.GetJson(dt));
            }
            catch (Exception hata)
            {
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger(hata.ToString());
                }
                return("Error: " + hata.Message);
            }
        }