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 GetCountData(string sql, params object[] values)
 {
     try
     {
         int     pFrom      = sql.IndexOf("AS ") + "AS ".Length;
         int     pTo        = sql.LastIndexOf(" FROM ");
         String  sonuc      = sql.Substring(pFrom, pTo - pFrom).Trim();
         int     verikumesi = 0;
         DataSet ds         = WebFramework.DataSetFill(sql, values);
         if (ds.Tables[0].Rows.Count > 0)
         {
             verikumesi = ds.Tables[0].Rows[0].Field <int>(sonuc.Trim());
         }
         else
         {
             verikumesi = 0;
         }
         if (Config.debug == true)
         {
             FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + "Return: " + verikumesi);
         }
         return(verikumesi.ToString());
     }
     catch (Exception hata)
     {
         if (Config.debug == true)
         {
             FrameworkHandler.DebugLogger(hata.ToString());
         }
         return("Error: " + hata.Message);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Bir tablodan obje değişkenlerinden kayıt getirir. Sadece tek satır kayıt gibi çok fonksiyonlu sql destekler.'
        /// </summary>
        /// <param name="sql">Bir sql ifadesi girin.</param>
        /// <param name="values">sql parametre değerlerini girin.</param>
        public static T GetSingleData <T>(String sql, params object[] values)
        {
            try
            {
                Type           tip = typeof(T);
                PropertyInfo[] ps  = tip.GetProperties();

                DataSet ds = WebFramework.DataSetFill(sql, values);

                List <T> liste = new List <T>();


                var obj = Activator.CreateInstance <T>();

                liste.Add(obj);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    foreach (var properti in ps)
                    {
                        object deger = null;
                        try
                        {
                            deger = ds.Tables[0].Rows[0].Field <Object>(properti.Name);
                            Type   t         = Nullable.GetUnderlyingType(properti.PropertyType) ?? properti.PropertyType;
                            object safeValue = (deger == null) ? null : Convert.ChangeType(deger, t);
                            properti.SetValue(obj, safeValue, null);
                        }
                        catch (Exception hata)
                        {
                            if (Config.debug == true)
                            {
                                FrameworkHandler.DebugLogger(hata.ToString());
                            }
                        }
                    }
                }
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + " Count: " + ds.Tables[0].Rows.Count);
                }
                if (ds.Tables[0].Rows.Count > 0)
                {
                    return(liste[0]);
                }
                else
                {
                    return(default(T));
                }
            }
            catch (Exception hata)
            {
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger(hata.ToString());
                }
                return(default(T));
            }
        }
Ejemplo n.º 4
0
        public static List <String> GetData(String sql, params object[] values)
        {
            List <String> tablo = new List <string>();

            try
            {
                int      pFrom    = sql.IndexOf("SELECT ") + "SELECT ".Length;
                int      pTo      = sql.LastIndexOf(" FROM ");
                String   sonuc    = sql.Substring(pFrom, pTo - pFrom).Trim();
                String[] kolonlar = sonuc.Split(',');
                int      kayit    = 0;
                if (sonuc == "*")
                {
                    tablo.Add("An error occurred while returning the dataset *, please specify the column names instead.");
                }
                else
                {
                    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 < kolonlar.Length; j++)
                            {
                                verikumesi += ds.Tables[0].Rows[i].Field <Object>(kolonlar[j].Trim()) + Config.parse.ToString();
                            }
                            verikumesi = verikumesi.Remove(verikumesi.Length - 1);
                            tablo.Add(verikumesi);
                            verikumesi = null;
                        }
                        kayit = ds.Tables[0].Rows.Count;
                    }
                    else
                    {
                        tablo.Add("");
                    }
                }
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + "Count: " + kayit);
                }
                return(tablo);
            }
            catch (Exception hata)
            {
                tablo.Add("Error: " + hata.Message);
                if (Config.debug == true)
                {
                    FrameworkHandler.DebugLogger(hata.ToString());
                }
                return(tablo);
            }
        }
Ejemplo n.º 5
0
        protected override void RenderContents(HtmlTextWriter output)
        {
            String html = "";

            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
            if (Class != null)
            {
                output.AddAttribute("class", this.Class);
            }

            try
            {
                DataSet ds = null;
                if (SQL != "")
                {
                    string prov = Config.provider.ToString();
                    if (prov == "MSSQL")
                    {
                        ds = WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "MYSQL")
                    {
                        ds = MySQLDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ACCESS")
                    {
                        ds = AccessDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ORACLE")
                    {
                        ds = OracleDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            html += "<li data-id='" + ds.Tables[0].Rows[i].Field <Object>(Value) + "'>" + ds.Tables[0].Rows[i].Field <Object>(DisplayValue) + "</li>";
                        }
                    }
                }
                output.RenderBeginTag("ul");
            }
            catch (Exception hata)
            {
                output.RenderBeginTag("div");
                html = "<p style='color:red;'><strong>Hata:</strong> " + hata.Message + "</p>";
            }
            output.Write(html);
            output.RenderEndTag();
        }
Ejemplo n.º 6
0
        public static string GetSingleData(String sql, params object[] values)
        {
            try
            {
                int      kayit      = 0;
                int      pFrom      = sql.IndexOf("SELECT ") + "SELECT ".Length;
                int      pTo        = sql.LastIndexOf(" FROM ");
                String   sonuc      = sql.Substring(pFrom, pTo - pFrom).Trim();
                String   verikumesi = null;
                String[] kolonlar   = sonuc.Split(',');
                if (sonuc == "*")
                {
                    verikumesi = "An error occurred while rotating the line * instead of the column names.";
                }
                else
                {
                    DataSet ds = WebFramework.DataSetFill(sql, values);
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < kolonlar.Length; i++)
                        {
                            verikumesi += ds.Tables[0].Rows[0].Field <Object>(kolonlar[i].Trim()) + Config.parse.ToString();
                        }
                    }
                    else
                    {
                        verikumesi = "";
                    }
                    kayit      = ds.Tables[0].Rows.Count;
                    verikumesi = verikumesi.Remove(verikumesi.Length - 1);
                }
                if (Config.debug)
                {
                    FrameworkHandler.DebugLogger("SQL Execute: " + sql + System.Environment.NewLine + "Count: " + kayit);
                }
                return(verikumesi);
            }

            catch (Exception hata)
            {
                if (Config.debug)
                {
                    FrameworkHandler.DebugLogger(hata.ToString());
                }
                return("Error: " + hata.Message);
            }
        }
Ejemplo n.º 7
0
        ///<summary>ASP.NET taglarını referans ederek UIControl nesnelerine erişerek nesneler oluşturabilirsiniz.
        ///Örnek: Response.Write(getUI(tablo, sql)) veya Literal1.Text = getUI(tablo, sql) daha fazlası için dökümana bakınız.</summary>
        ///<param name="tablo">Tablonun UIControl nesnelerine erişmek için bu alan girilmek zorundadır. </param>
        ///<param name="sql">Tabloyu veritabanından doldurmak istiyorsanız bir sql giriniz eğer doldurmak istemiyorsanız bu alanı boş bırakabilirsiniz.</param>
        ///<param name="section">UIControl alanlarının oluşturulması için gereken bölüm ismi bu bölüm UIControl özelliklerinde sections parametresinde verdiğiniz bir değeri içerir. (Bu alan doldurulmak zorundadır.)</param>
        public static string getUI(Type tablo, String sql, String section, params object[] sqlparametreler)
        {
            String html = "";

            try
            {
                DataSet ds = null;
                if (sql != "")
                {
                    string prov = Config.provider.ToString();
                    if (prov == "MSSQL")
                    {
                        ds = WebFramework.DataSetFill(sql, sqlparametreler);
                    }
                    else if (prov == "MYSQL")
                    {
                        ds = MySQLDb.WebFramework.DataSetFill(sql, sqlparametreler);
                    }
                    else if (prov == "ACCESS")
                    {
                        ds = AccessDb.WebFramework.DataSetFill(sql, sqlparametreler);
                    }
                    else if (prov == "ORACLE")
                    {
                        ds = OracleDb.WebFramework.DataSetFill(sql, sqlparametreler);
                    }
                }
                PropertyInfo[] props = tablo.GetProperties();
                string         propName = "", label = "", tip = "", sinif = "", placeholder = "", selectSQL = "";
                int            maks    = 0;
                Boolean        zorunlu = false;
                foreach (PropertyInfo prop in props)
                {
                    object[] attrs = prop.GetCustomAttributes(true);
                    foreach (object attr in attrs)
                    {
                        UIController fieldlar = attr as UIController;
                        if (fieldlar != null)
                        {
                            try
                            {
                                propName    = prop.Name;
                                zorunlu     = fieldlar.Required;
                                label       = fieldlar.Label;
                                tip         = fieldlar.Tip.ToString();
                                sinif       = fieldlar.Class.ToString();
                                maks        = fieldlar.MaxLength;
                                placeholder = fieldlar.PlaceHolder;
                                selectSQL   = fieldlar.SQL;
                            }
                            catch
                            {
                                //Boş field olsa dahi çalışmaya devam edecektir.
                            }
                            string[] sections = fieldlar.Sections.Trim().Split(',');

                            for (int s = 0; s < sections.Length; s++)
                            {
                                if (sections[s].Trim() == section)
                                {
                                    if (label != "")
                                    {
                                        if (tip != "HIDDEN")
                                        {
                                            html += "<div class='control controlLabel' id='" + Utils.ClearTurkishLetter(section) + "_lbl_" + propName + "'><label for='" + propName + "'>" + label + "</label></div> ";
                                        }
                                    }
                                    if (tip == "TEXTBOX")
                                    {
                                        if (sql != "")
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_text_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='text' value='" + ds.Tables[0].Rows[0].Field <Object>(propName) + "'";
                                            }
                                            else
                                            {
                                                html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_text_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='text' value=''";
                                            }
                                        }
                                        else
                                        {
                                            html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_text_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='text'";
                                        }
                                        if (zorunlu == true)
                                        {
                                            html += " required='required' ";
                                        }
                                        if (maks > 0)
                                        {
                                            html += " maxlength='" + maks + "' ";
                                        }
                                        if (placeholder != "")
                                        {
                                            html += " placeholder='" + placeholder + "' ";
                                        }
                                        html += "/></div>";
                                    }
                                    else if (tip == "CHECKBOX")
                                    {
                                        html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_checkbox_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='checkbox' value='" + fieldlar.value + "'";
                                        if (sql != "")
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                if (ds.Tables[0].Rows[0].Field <Object>(propName) != null)
                                                {
                                                    if (ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == "E" ||
                                                        ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == "Y" ||
                                                        ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == "1" ||
                                                        ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == "true" ||
                                                        ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == "True")
                                                    {
                                                        html += " value='" + ds.Tables[0].Rows[0].Field <Object>(propName) + "' checked='checked' ";
                                                    }
                                                }
                                            }
                                        }
                                        if (zorunlu == true)
                                        {
                                            html += " required='required' ";
                                        }
                                        html += "/></div>";
                                    }
                                    else if (tip == "TEXTAREA")
                                    {
                                        html += "<div class='control controlTextArea' id='" + Utils.ClearTurkishLetter(section) + "_textarea_" + propName + "'><textarea id='" + propName + "' name='" + propName + "' class='" + sinif + "'";
                                        if (zorunlu == true)
                                        {
                                            html += " required='required' ";
                                        }
                                        if (maks > 0)
                                        {
                                            html += " maxlength='" + maks + "' ";
                                        }
                                        if (placeholder != "")
                                        {
                                            html += " placeholder='" + placeholder + "' ";
                                        }
                                        if (sql != "")
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                html += ">" + ds.Tables[0].Rows[0].Field <Object>(propName) + "</textarea></div>";
                                            }
                                            else
                                            {
                                                html += "></textarea></div>";
                                            }
                                        }
                                        else
                                        {
                                            html += "></textarea></div>";
                                        }
                                    }
                                    else if (tip == "SELECT")
                                    {
                                        html += "<div class='control controlSelect' id='" + Utils.ClearTurkishLetter(section) + "_select_" + propName + "'><select id='" + propName + "' name='" + propName + "' class='" + sinif + "'";
                                        if (zorunlu == true)
                                        {
                                            html += "required='required'";
                                        }
                                        if (selectSQL != "")
                                        {
                                            DataSet dsSelect = null;
                                            string  prov     = Config.provider.ToString();
                                            if (prov == "MSSQL")
                                            {
                                                dsSelect = WebFramework.DataSetFill(selectSQL, sqlparametreler);
                                            }
                                            else if (prov == "MYSQL")
                                            {
                                                dsSelect = MySQLDb.WebFramework.DataSetFill(selectSQL, sqlparametreler);
                                            }
                                            else if (prov == "ACCESS")
                                            {
                                                dsSelect = AccessDb.WebFramework.DataSetFill(selectSQL, sqlparametreler);
                                            }
                                            else if (prov == "ORACLE")
                                            {
                                                dsSelect = OracleDb.WebFramework.DataSetFill(selectSQL, sqlparametreler);
                                            }
                                            if (dsSelect.Tables[0].Rows.Count > 0)
                                            {
                                                html += ">";
                                                for (int i = 0; i < dsSelect.Tables[0].Rows.Count; i++)
                                                {
                                                    if (sql == "" || sql == null)
                                                    {
                                                        html += "<option value='" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.value) + "'>" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.displayValue) + "</option>";
                                                    }
                                                    else
                                                    {
                                                        if (ds.Tables[0].Rows.Count > 0)
                                                        {
                                                            if (ds.Tables[0].Rows[0].Field <Object>(propName).ToString() == dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.value).ToString())
                                                            {
                                                                html += "<option selected value='" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.value) + "'>" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.displayValue) + "</option>";
                                                            }
                                                            else
                                                            {
                                                                html += "<option value='" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.value) + "'>" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.displayValue) + "</option>";
                                                            }
                                                        }
                                                        else
                                                        {
                                                            html += "<option value='" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.value) + "'>" + dsSelect.Tables[0].Rows[i].Field <Object>(fieldlar.displayValue) + "</option>";
                                                        }
                                                    }
                                                }
                                                html += "</select></div>";
                                            }
                                            else
                                            {
                                                html += "></select></div>";
                                            }
                                        }
                                        else
                                        {
                                            html += "></select></div>";
                                        }
                                    }
                                    else if (tip == "FILEUPLOAD")
                                    {
                                        html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_fileupload_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='file'";
                                        if (zorunlu == true)
                                        {
                                            html += "required='required'";
                                        }
                                        html += "/></div>";
                                    }
                                    else if (tip == "PASSWORD")
                                    {
                                        html += "<div class='control controlInput' id='" + Utils.ClearTurkishLetter(section) + "_pass_" + propName + "'><input id='" + propName + "' name='" + propName + "' class='" + sinif + "' type='password'";
                                        if (zorunlu == true)
                                        {
                                            html += "required='required'";
                                        }
                                        if (maks > 0)
                                        {
                                            html += "maxlength='" + maks + "'";
                                        }
                                        if (placeholder != "")
                                        {
                                            html += "placeholder='" + placeholder + "'";
                                        }
                                        html += "/></div>";
                                    }
                                    else if (tip == "HIDDEN")
                                    {
                                        if (sql != "")
                                        {
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                html += "<input id=\"" + propName + "\" name=\"" + propName + "\" value=\"" + ds.Tables[0].Rows[0].Field <Object>(propName) + "\"";
                                            }
                                            else
                                            {
                                                html += "<input id=\"" + propName + "\" name=\"" + propName + "\" value=\"\" ";
                                            }
                                        }
                                        else
                                        {
                                            html += "<input id='" + propName + "' name='" + propName + "' ";
                                        }
                                        if (zorunlu == true)
                                        {
                                            html += " required=\"required\" ";
                                        }
                                        html += " type=\"hidden\" />";
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception hata)
            {
                html += "<p style='color:red;'><strong>Hata:</strong> " + hata.Message + "</p>";
            }
            return(html);
        }
Ejemplo n.º 8
0
        protected override void RenderContents(HtmlTextWriter output)
        {
            String html = "";

            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
            if (Class != null)
            {
                output.AddAttribute("class", this.Class);
            }

            try
            {
                DataSet ds = null;
                if (SQL != "")
                {
                    string[] kolonlar = Columns.Split(',');
                    string[] fieldlar = DisplayFields.Split(',');
                    string   prov     = Config.provider.ToString();
                    if (prov == "MSSQL")
                    {
                        ds = WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "MYSQL")
                    {
                        ds = MySQLDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ACCESS")
                    {
                        ds = AccessDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ORACLE")
                    {
                        ds = OracleDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        html += "<thead><tr>";
                        for (int i = 0; i < fieldlar.Length; i++)
                        {
                            html += "<td>" + fieldlar[i].Trim() + "</td>";
                        }
                        String content = "";
                        if (this.Content != null)
                        {
                            Control templateContainer = new Control();
                            Content.InstantiateIn(templateContainer);

                            content = RenderControl(templateContainer);
                        }
                        if (content != "")
                        {
                            html += "<td class='tablecontrol_content'>" + ContentHeaderTitle + "</td>";
                        }
                        html += "</tr></thead>";
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            if (PrimaryKey != "")
                            {
                                html += "<tr data-id='" + ds.Tables[0].Rows[i].Field <Object>(PrimaryKey) + "'>";
                            }
                            else
                            {
                                html += "<tr>";
                            }
                            for (int j = 0; j < kolonlar.Length; j++)
                            {
                                html += "<td>" + ds.Tables[0].Rows[i].Field <Object>(kolonlar[j].Trim()) + "</td>";
                            }
                            if (content != "")
                            {
                                html += "<td>" + content + "</td>";
                            }
                            html += "</tr>";
                        }
                    }
                }
                output.RenderBeginTag("table");
            }
            catch (Exception hata)
            {
                output.RenderBeginTag("div");
                html += "<p style='color:red;'><strong>Hata:</strong> " + hata.Message + "</p>";
            }
            output.Write(html);
            output.RenderEndTag();
        }
Ejemplo n.º 9
0
        protected override void RenderContents(HtmlTextWriter output)
        {
            output.AddAttribute(HtmlTextWriterAttribute.Id, this.ID);
            if (Class != null)
            {
                output.AddAttribute("class", this.Class);
            }
            output.RenderBeginTag("div");
            output.BeginRender();
            try
            {
                Type tablo = null;
                if (this.Content != null)
                {
                    Control templateContainer = new Control();
                    Content.InstantiateIn(templateContainer);

                    var s = RenderControl(templateContainer);
                    html = s;
                    // HttpContext.Current.Response.Write("<textarea>"+s+"</textarea>");
                }
                try
                {
                    tablo = GetType(DataSource);
                }
                catch
                {
                    //DataSource Attributesi boş ise
                }
                if (SQL != string.Empty)
                {
                    HtmlAgilityPack.HtmlDocument dokuman = new HtmlAgilityPack.HtmlDocument();
                    dokuman.LoadHtml(html);

                    //html = dokuman.DocumentNode.OuterHtml; //Template üzerinde manipule edilen html manipule edilmiş hali ile Content değişkenine atılıyor.
                    //dokuman.LoadHtml(html);
                    PropertyInfo[] props = tablo.GetProperties();
                    DataSet        ds    = new DataSet();
                    string         prov  = Config.provider.ToString();
                    if (prov == "MSSQL")
                    {
                        ds = WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "MYSQL")
                    {
                        ds = MySQLDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ACCESS")
                    {
                        ds = AccessDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    else if (prov == "ORACLE")
                    {
                        ds = OracleDb.WebFramework.DataSetFill(SQL, SQLParams.ToArray());
                    }
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            var paragraflar = dokuman.DocumentNode.SelectNodes("//p[@data-name]"); //Paragraf tagları değişkene atılıyor.
                            if (paragraflar != null)
                            {
                                foreach (HtmlNode node in paragraflar)                                   //düğüm null'dan farklı ise döngüye sokuluyor
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;            //düğümdeki data-name attribute değerini okur. //[@data-name='ADSOYAD']
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty) //Eğer data-name null'dan veya boş'dan farklı ise
                                    {
                                        //Model sınıfındaki propertiler döngüye sokulur.
                                        foreach (PropertyInfo prop in props)
                                        {
                                            //Stabil ve doğruluk olması amacıyla model dosyasındaki properti isim ile düğümdeki data-name eşit ise veritabanından veri okulur.
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name); //tablo örneğinden sütün adının propertisi okunuyor
                                                if (veri != null)                                             //Kayıt null'dan farklı ise
                                                {
                                                    node.InnerHtml += veri.ToString();                        //InnerHtml ile tagların arasına ekliyor
                                                    node.Attributes.Remove("data-name");                      //Güvenlik amaçlı data-name attirubetesi siliniyor.
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var inputlar = dokuman.DocumentNode.SelectNodes("//input[@data-name]");
                            if (inputlar != null)
                            {
                                foreach (HtmlNode node in inputlar)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    string nodeType = node.Attributes["type"].Value;
                                                    if (nodeType == "text" || nodeType == "email" || nodeType == "password" || nodeType == "hidden")
                                                    {
                                                        node.SetAttributeValue("value", veri.ToString());
                                                    }
                                                    else if (nodeType == "radio" || nodeType == "checkbox")
                                                    {
                                                        if (node.Attributes["value"].Value == veri.ToString())
                                                        {
                                                            node.SetAttributeValue("checked", "checked");
                                                        }
                                                    }
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var divler = dokuman.DocumentNode.SelectNodes("//div[@data-name]");
                            if (divler != null)
                            {
                                foreach (HtmlNode node in divler)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var imgs = dokuman.DocumentNode.SelectNodes("//img[@data-name]");
                            if (imgs != null)
                            {
                                foreach (HtmlNode node in imgs)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.SetAttributeValue("src", veri.ToString());
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var textarealar = dokuman.DocumentNode.SelectNodes("//textarea[@data-name]");
                            if (textarealar != null)
                            {
                                foreach (HtmlNode node in textarealar)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml = veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }


                            var lis = dokuman.DocumentNode.SelectNodes("//li[@data-name]");
                            if (lis != null)
                            {
                                foreach (HtmlNode node in lis)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var tds = dokuman.DocumentNode.SelectNodes("//td[@data-name]");
                            if (tds != null)
                            {
                                foreach (HtmlNode node in tds)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var spanlar = dokuman.DocumentNode.SelectNodes("//span[@data-name]");
                            if (spanlar != null)
                            {
                                foreach (HtmlNode node in spanlar)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null || nodeDataName.ToString() != String.Empty)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var sources = dokuman.DocumentNode.SelectNodes("//source[@data-name]");
                            if (sources != null)
                            {
                                foreach (HtmlNode node in sources)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.SetAttributeValue("src", veri.ToString());
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var iframes = dokuman.DocumentNode.SelectNodes("//iframe[@data-name]");
                            if (iframes != null)
                            {
                                foreach (HtmlNode node in iframes)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.SetAttributeValue("src", veri.ToString());
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var labels = dokuman.DocumentNode.SelectNodes("//label[@data-name]");
                            if (labels != null)
                            {
                                foreach (HtmlNode node in labels)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var selects = dokuman.DocumentNode.SelectNodes("//select[@data-name]/option");
                            if (selects != null)
                            {
                                foreach (HtmlNode node in selects)
                                {
                                    object nodeDataName = node.ParentNode.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    if (node.Attributes["value"].Value == veri.ToString())
                                                    {
                                                        node.SetAttributeValue("selected", "");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            //Select optionları seçildikten sonra kalan ve seçilen selectlerin data-name attributeler siliniyor.
                            var selects2 = dokuman.DocumentNode.SelectNodes("//select[@data-name]");
                            if (selects2 != null)
                            {
                                foreach (HtmlNode node in selects2)
                                {
                                    node.Attributes.Remove("data-name");
                                }
                            }

                            var a = dokuman.DocumentNode.SelectNodes("//a[@data-name]");
                            if (a != null)
                            {
                                foreach (HtmlNode node in a)
                                {
                                    //a tagının hem href hemde yazılacak bir text alanı olduğu için bu iki parametreli alıyor. ÖRNEK: KULLANICI_ID, KULLANICI_ADI
                                    //0.indis = href, 1.indis = text alanı
                                    object   nodeDataName  = node.Attributes["data-name"].Value;
                                    string[] nodeDataNames = nodeDataName.ToString().Trim().Split(','); //Boşluklar temizlenip virgül ile ayrılıyor değerler.

                                    if (nodeDataNames != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            try
                                            {
                                                if (nodeDataName.ToString().IndexOf(",") == -1)
                                                {
                                                    if (prop.Name == nodeDataName.ToString())
                                                    {
                                                        Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                        string href = null;
                                                        try
                                                        {
                                                            href = node.Attributes["href"].Value;
                                                        }
                                                        catch
                                                        {
                                                            href = "";
                                                        }
                                                        node.SetAttributeValue("href", href + veri.ToString());
                                                    }
                                                }
                                                else
                                                {
                                                    if (prop.Name == nodeDataNames[1].Trim())
                                                    {
                                                        Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);

                                                        if (veri != null)
                                                        {
                                                            node.InnerHtml += veri.ToString();
                                                        }
                                                    }
                                                    else if (prop.Name == nodeDataNames[0].Trim())
                                                    {
                                                        Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                        string href = null;
                                                        try
                                                        {
                                                            href = node.Attributes["href"].Value;
                                                        }
                                                        catch
                                                        {
                                                            href = "";
                                                        }
                                                        node.SetAttributeValue("href", href + veri.ToString());
                                                    }
                                                }
                                            }
                                            catch
                                            {
                                            }
                                        }
                                    }
                                    node.Attributes.Remove("data-name");
                                }
                            }

                            var headers = dokuman.DocumentNode.SelectNodes("//*[self::h1[@data-name] or self::h2[@data-name] or self::h3[@data-name] or self::h4[@data-name] or self::h5[@data-name] or self::h6[@data-name]]");
                            if (headers != null)
                            {
                                foreach (HtmlNode node in headers)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.InnerHtml += veri.ToString();
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var progress = dokuman.DocumentNode.SelectNodes("//progress[@data-name]");
                            if (progress != null)
                            {
                                foreach (HtmlNode node in progress)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.SetAttributeValue("value", veri.ToString());
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            var meters = dokuman.DocumentNode.SelectNodes("//meter[@data-name]");
                            if (meters != null)
                            {
                                foreach (HtmlNode node in meters)
                                {
                                    object nodeDataName = node.Attributes["data-name"].Value;
                                    if (nodeDataName != null)
                                    {
                                        foreach (PropertyInfo prop in props)
                                        {
                                            if (prop.Name == nodeDataName.ToString())
                                            {
                                                Object veri = ds.Tables[0].Rows[i].Field <Object>(prop.Name);
                                                if (veri != null)
                                                {
                                                    node.SetAttributeValue("value", veri.ToString());
                                                    node.Attributes.Remove("data-name");
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            tempHTML += dokuman.DocumentNode.OuterHtml;
                            dokuman.LoadHtml(html);
                        }
                        ds = new DataSet();
                        ds.Dispose();
                        output.Write(tempHTML);
                        output.RenderEndTag();
                        output.EndRender();
                    }
                    else
                    {
                        //ds kaynağında hiç kayıt yok ise.
                        output.Write(html);
                        output.RenderEndTag();
                        output.EndRender();
                    }
                }
                else
                {
                    //SQL Attributesi boş ise
                    output.Write(html);
                    output.RenderEndTag();
                    output.EndRender();
                }
            }
            catch (Exception hata)
            {
                output.RenderBeginTag("div");
                html = "<p style='color:red;'><strong>Hata:</strong> " + hata + "</p>";
                output.Write(html);
                output.RenderEndTag();
                output.EndRender();
            }
            finally
            {
                tempHTML = "";
                html     = "";
            }
        }