コード例 #1
0
ファイル: ProductList.cs プロジェクト: fizikci/Cinar
        protected override IDatabaseEntity[] GetContentList()
        {
            Entities.Content content = Provider.Content;
            FilterParser filterForContent = new FilterParser(this.filter, "Content");
            string whereMevcutIcerik = "and Content.Id<>" + (content == null ? 0 : content.Id);

            string where = filterForContent.GetWhere();
            string sql = @"
                select distinct top " + this.HowManyItems + @"
                    Content.Id,
                    Content.ClassName,
                    Content.Hierarchy,
                    Content.Title,
                    Content.SpotTitle,
                    TCategoryId.Title as CategoryName,
                    Content.PublishDate,
                    TAuthorId.Name as AuthorName,
                    Content.Picture,
                    Content.Description,
                    " + (this.ShowMetin ? "Content.Metin," : "") + @"
                    Content.ShowInPage,
                    Product.ListPrice,
                    Product.DiscountRate
                from Content
                    inner join Content as TCategoryId ON Content.CategoryId = TCategoryId.Id
                    inner join Product ON Product.ContentId = Content.Id
                    left join Author as TAuthorId ON TAuthorId.Id = Content.AuthorId
                where Content.Visible=1 " + (this.showCurrentContent ? "" : whereMevcutIcerik) + (where != "" ? " AND " + where : "") + @"
                order by " + this.OrderBy + " " + (this.Ascending ? "asc" : "desc");

            IDatabaseEntity[] contents = Provider.Database.ReadList(typeof(Entities.Content), sql, filterForContent.GetParams()).SafeCastToArray<IDatabaseEntity>();
            return contents;
        }
コード例 #2
0
ファイル: ContentListByFilter.cs プロジェクト: fizikci/Cinar
        protected override IDatabaseEntity[] GetContentList()
        {
            Entities.Content content = Provider.Content;
            FilterParser filterForContent = new FilterParser(this.filter, "Content");
            string whereMevcutIcerik = "and Content.Id<>" + (content == null ? 0 : content.Id);

            string where = filterForContent.GetWhere();
            string sql = String.Format(@"
                select distinct top " + this.HowManyItems + @"
                    Content.Id,
                    Content.CategoryId,
                    Content.ClassName,
                    Content.Hierarchy,
                    Content.Title,
                    Content.SpotTitle,
                    Content.PublishDate,
                    Content.Description,
                    {0}
                    {1}
                    {2}
                    {3}
                    {4}
                    Content.ShowInPage
                from Content
                    {5}
                    {6}
                    {7}
                where
                    Content.Visible=1
                    {8}
                order by {9} {10}",
                           this.ShowPicture ? (this.WhichPicture == "Content.Picture2" ? "Content.Picture2,Content.Picture," : this.WhichPicture + ",") : "",
                           this.ShowMetin ? "Content.Metin," : "",
                           (this.ShowAuthor || this.WhichPicture.Contains("Author")) ? "TAuthorId.Name as AuthorName," : "",
                           (this.ShowSource || this.WhichPicture.Contains("Source")) ? "TSourceId.Name as SourceName," : "",
                           this.ShowCategory ? "TCategoryId.Title as CategoryName," : "",
                           this.ShowCategory ? "inner join Content as TCategoryId ON Content.CategoryId = TCategoryId.Id" : "",
                           (this.ShowAuthor || this.WhichPicture.Contains("Author")) ? "left join Author as TAuthorId ON TAuthorId.Id = Content.AuthorId" : "",
                           (this.ShowSource || this.WhichPicture.Contains("Source")) ? "left join Source as TSourceId ON TSourceId.Id = Content.SourceId" : "",
                           (this.showCurrentContent ? "" : whereMevcutIcerik) + (where != "" ? " AND " + where : ""),
                           this.OrderBy,
                           this.Ascending ? "asc" : "desc"
                           );

            IDatabaseEntity[] contents = Provider.Database.ReadList(typeof(Entities.Content), sql, filterForContent.GetParams()).SafeCastToArray<IDatabaseEntity>();
            return contents;
        }
コード例 #3
0
ファイル: ContentListByTag.cs プロジェクト: fizikci/Cinar
        protected override IDatabaseEntity[] GetContentList()
        {
            Entities.Content content = Provider.Content;
            FilterParser filterForContent = new FilterParser(this.filter, "Content");
            string whereMevcutIcerik = "and Content.Id<>" + (content == null ? 0 : content.Id);

            string tagJoin = "inner join ContentTag ON Content.Id = ContentTag.ContentId and ContentTag.TagId=" + (Provider.Tag != null ? Provider.Tag.Id : 0);

            string where = filterForContent.GetWhere();
            string sql = String.Format(@"
                select distinct top " + this.HowManyItems + @"
                    Content.Id,
                    Content.CategoryId,
                    Content.ClassName,
                    Content.Hierarchy,
                    Content.Title,
                    Content.SpotTitle,
                    TCategoryId.Title as CategoryName,
                    Content.PublishDate,
                    TAuthorId.Name as AuthorName,
                    TSourceId.Name as SourceName,
                    {0},
                    Content.Description,
                    {1}
                    Content.ShowInPage
                from Content
                    inner join Content as TCategoryId ON Content.CategoryId = TCategoryId.Id
                    {5}
                    left join Author as TAuthorId ON TAuthorId.Id = Content.AuthorId
                    left join Source as TSourceId ON TSourceId.Id = Content.SourceId
                where
                    Content.Visible=1
                    {2}
                order by {3} {4}",
                           this.WhichPicture,
                           this.ShowMetin ? "Content.Metin," : "",
                           (this.showCurrentContent ? "" : whereMevcutIcerik) + (where != "" ? " AND " + where : ""),
                           this.OrderBy,
                           this.Ascending ? "asc" : "desc",
                           Provider.Tag != null ? tagJoin : "");

            IDatabaseEntity[] contents = Provider.Database.ReadList(typeof(Entities.Content), sql, filterForContent.GetParams()).SafeCastToArray<IDatabaseEntity>();
            return contents;
        }
コード例 #4
0
        protected override IDatabaseEntity[] GetContentList()
        {
            Entities.Content content          = Provider.Content;
            FilterParser     filterForContent = new FilterParser(this.filter, "Content");

            string whereMevcutIcerik = "and Content.Id<>" + (content == null ? 0 : content.Id);

            string ids           = "";
            string showPictureOf = this.groupBy == "CategoryId" ? "Content" : ("T" + this.groupBy);

            string where = filterForContent.GetWhere();
            string    distSQL = @"
                        select top " + this.howManyItems + @"
                            Content." + groupBy + @" as GroupId,
                            max(Content.Id) as Id
                        from Content
	                        "     + (groupBy == "AuthorId" ? "inner" : "left") + @" join Author as TAuthorId ON TAuthorId.Id = Content.AuthorId
	                        "     + (groupBy == "SourceId" ? "inner" : "left") + @" join Source as TSourceId ON TSourceId.Id = Content.SourceId
	                        "     + (groupBy == "CategoryId" ? "inner" : "left") + @" join Content as TCategoryId ON TCategoryId.Id = Content.CategoryId
                        where 
                             Content.Visible=1 " + (this.showCurrentContent ? "" : whereMevcutIcerik) + (where != "" ? " AND " + where : "") + @"
                        group by Content." + groupBy;
            DataTable dt      = Provider.Database.GetDataTable(distSQL, filterForContent.GetParams());

            if (dt == null || dt.Rows.Count == 0)
            {
                throw new Exception(Provider.GetResource("There is no content with this criteria."));
            }

            ArrayList al = new ArrayList();

            foreach (DataRow dr in dt.Rows)
            {
                al.Add(dr["Id"].ToString());
            }
            ids = String.Join(",", (string[])al.ToArray(typeof(String)));

            string sql = @"
                        select 
                            Content.Id, 
                            Content.Title,
                            Content.ClassName,
                            Content.Hierarchy,
                            Content.PublishDate,
                            TAuthorId.Name as AuthorName,
                            TSourceId.Name as SourceName,
                            TCategoryId.Title as CategoryName,
                            Content.ShowInPage,
                            Content.Description,
                            " + (this.ShowMetin ? "Content.Metin," : "") + @"
                            " + showPictureOf + @".Picture
                        from Content
	                        "     + (groupBy == "AuthorId" ? "inner" : "left") + @" join Author as TAuthorId ON TAuthorId.Id = Content.AuthorId
	                        "     + (groupBy == "SourceId" ? "inner" : "left") + @" join Source as TSourceId ON TSourceId.Id = Content.SourceId
	                        "     + (groupBy == "CategoryId" ? "inner" : "left") + @" join Content as TCategoryId ON TCategoryId.Id = Content.CategoryId
                        where 
                            Content.Id in (" + ids + @")
                        order by " + this.OrderBy + " " + (this.Ascending ? "asc" : "desc");

            return(Provider.Database.ReadList(typeof(Entities.Content), sql).SafeCastToArray <IDatabaseEntity>());
        }
コード例 #5
0
ファイル: Admin.cs プロジェクト: fizikci/Cinar
        private void newEntity()
        {
            string error = "";
            string where = context.Request["filter"] ?? "";
            string entityName = context.Request["entityName"];
            Type entityType = Provider.GetEntityType(entityName);
            if (entityType != null)
            {
                IDatabaseEntity entity = Provider.CreateEntity(entityType);
                if (!string.IsNullOrEmpty(where))
                {
                    FilterParser filterParser = new FilterParser(where, entityName);
                    where = filterParser.GetWhere();
                    foreach (var item in filterParser.GetNameValuePairs())
                        entity.SetMemberValue(item.Key, item.Value);
                }
                context.Response.Write(@"{ success: true, data: " + entity.ToJSON() + "}");
                return;
            }
            else
                error = "Entity tipi bulunamadı.";

            context.Response.Write(@"{ success: false, errorMessage: " + error.ToJS() + "}");
        }
コード例 #6
0
ファイル: Admin.cs プロジェクト: fizikci/Cinar
        private void saveEntity()
        {
            string id = context.Request["Id"];
            string where = context.Request["filter"];
            string entityName = context.Request["entityName"];
            int mid = 0;
            if (!Int32.TryParse(id, out mid))
            {
                context.Response.Write("{success:false, errorMessage:'ID geçersiz!'}");
                return;
            }

            // bu istisnai durum, sadece konfigürasyon veritabanına kaydedilmiyor
            if (entityName == "Configuration")
            {
                Provider.Configuration.SetFieldsByPostData(context.Request.Form);
                Provider.Configuration.Save();
                context.Response.Write("{success:true}");
                return;
            }

            // entitiyi kaydedelim
            BaseEntity entity = null;
            if (mid > 0)
                entity = (BaseEntity)Provider.Database.Read(Provider.GetEntityType(entityName), mid);
            else
                entity = Provider.CreateEntity(entityName);
            entity.SetFieldsByPostData(context.Request.Form);
            if (!string.IsNullOrEmpty(where))
            {
                FilterParser filterParser = new FilterParser(where, entityName);
                where = filterParser.GetWhere();
                foreach (var item in filterParser.GetNameValuePairs())
                    if(string.IsNullOrEmpty(context.Request.Form[item.Key]))
                        entity.SetMemberValue(item.Key, item.Value);
            }
            entity.Save();

            // entitiye ait Lang kayıtlarını kaydedelim
            Type langEntityType = Provider.GetEntityType(entityName + "Lang");
            if (langEntityType != null)
            {
                Dictionary<int, NameValueCollection> langEntities = new Dictionary<int, NameValueCollection>();
                Dictionary<int, string> langEntityFieldSum = new Dictionary<int, string>();
                for (int i = 0; i < context.Request.Form.Count; i++)
                {
                    string key = context.Request.Form.GetKey(i);
                    if (key.Contains("_lang_"))
                    {
                        string[] parts = key.Split(new string[] { "_lang_" }, StringSplitOptions.None);
                        int langId = int.Parse(parts[1]);
                        string fieldName = parts[0];
                        string fieldVal = context.Request.Form[key];

                        if (!langEntities.ContainsKey(langId))
                            langEntities.Add(langId, new NameValueCollection());
                        langEntities[langId].Add(fieldName, fieldVal);

                        if (!langEntityFieldSum.ContainsKey(langId))
                            langEntityFieldSum.Add(langId, "");
                        langEntityFieldSum[langId] += fieldVal;
                    }
                }
                // içi boş olan langEntitileri kaldıralım
                foreach (var item in langEntityFieldSum)
                    if (item.Value.Trim() == "")
                        langEntities.Remove(item.Key);

                foreach (var item in langEntities)
                {
                    BaseEntity langEntity = (BaseEntity)Provider.Database.Read(langEntityType, entityName + "Id = {0} AND LangId={1}", entity.Id, item.Key);
                    if (langEntity == null)
                        langEntity = Provider.CreateEntity(langEntityType);
                    langEntity.SetFieldsByPostData(item.Value);
                    langEntity.SetMemberValue(entityName + "Id", entity.Id);
                    langEntity.SetMemberValue("LangId", item.Key);
                    langEntity.Save();
                }
            }

            context.Response.Write("{success:true}");
        }
コード例 #7
0
        internal override string show()
        {
            StringBuilder sb = new StringBuilder();

            if (String.IsNullOrEmpty(EntityName))
            {
                return(Provider.GetResource("Select entity"));
            }

            Cinar.Database.Table tbl = Provider.Database.Tables[EntityName];
            if (tbl == null)
            {
                return(Provider.GetResource("The table [entityName] coulnd't be found").Replace("[entityName]", EntityName));
            }

            string         pageUrl   = Provider.Request.Url.Scheme + "://" + Provider.Request.Url.Authority + Provider.Request.RawUrl;
            CinarUriParser uriParser = new CinarUriParser(pageUrl);

            if (!String.IsNullOrEmpty(Provider.Request["delete"]))
            {
                deleteEntity();
                Provider.Response.Redirect(Provider.Request["returnUrl"], true);
                return(String.Empty); //***
            }

            FilterParser filterParser = new FilterParser(this.Filter, EntityName);

            string where = filterParser.GetWhere();

            string sql = "";

            if (string.IsNullOrWhiteSpace(this.SQL))
            {
                sql = String.Format(@"
                    select
                        {0}
                    from
                        {1}
                    where
                        {2} {3}
                    order by
                        {4} {5}",
                                    "*",
                                    this.EntityName,
                                    defaultWhere,
                                    String.IsNullOrEmpty(where) ? "" : ("and " + where),
                                    this.OrderBy,
                                    this.Ascending ? "asc" : "desc");

                if (!ShowPaging)
                {
                    sql = Provider.Database.AddLimitOffsetToSQL(sql, HowManyItems, Offset);
                }
            }
            else
            {
                Interpreter engine = Provider.GetInterpreter(SQL, this);
                engine.Parse();
                engine.Execute();
                sql = engine.Output;

                if (ShowPaging && sql.ToLowerInvariant().Contains("limit"))
                {
                    return("Do not use limit in SQL with paging. DataList does it.");
                }

                if (!sql.ToLowerInvariant().Contains("order by"))
                {
                    sql += " order by " + this.OrderBy + " " + (this.Ascending ? "asc":"desc");
                }

                if (!ShowPaging && !sql.ToLowerInvariant().Contains("limit"))
                {
                    sql = Provider.Database.AddLimitOffsetToSQL(sql, HowManyItems, Offset);
                }
            }

            string countSQL = "";

            if (ShowPaging)
            {
                countSQL = "SELECT count(*) " + sql.Substring(sql.IndexOf("from", StringComparison.InvariantCultureIgnoreCase));
                if (countSQL.LastIndexOf("order by", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("order by", StringComparison.InvariantCultureIgnoreCase));
                }
                if (countSQL.LastIndexOf("group by", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("group by", StringComparison.InvariantCultureIgnoreCase));
                }
                if (countSQL.LastIndexOf("having", StringComparison.InvariantCultureIgnoreCase) > -1)
                {
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("having", StringComparison.InvariantCultureIgnoreCase));
                }

                sql = Provider.Database.AddPagingToSQL(sql,
                                                       HowManyItems,
                                                       pageNo);
            }

            data = Provider.Database.GetDataTable(sql, filterParser.GetParams());

            Provider.Translate(EntityName, data);

            if (data.Rows.Count == 0)
            {
                return("");
            }
            else
            {
                sb.Append(base.show());
            }

            // paging
            if (this.ShowPaging)
            {
                /*
                 *  <ul class="pagination mbn mtn">
                 *      <li><a href="#"><i class="fa fa-angle-double-left"></i></a></li>
                 *      <li><a href="#"><i class="fa fa-angle-left"></i></a></li>
                 *      <li class="active"><a href="#">1</a></li>
                 *      <li><a href="#">2</a></li>
                 *      <li><a href="#">...</a></li>
                 *      <li><a href="#">15</a></li>
                 *      <li><a href="#"><i class="fa fa-angle-right"></i></a></li>
                 *      <li><a href="#"><i class="fa fa-angle-double-right"></i></a></li>
                 *  </ul>
                 */

                string prevPageLink = "", nextPageLink = "";
                uriParser = new CinarUriParser(pageUrl);
                if (AjaxPaging)
                {
                    uriParser.Path = "/GetModuleHtml.ashx";
                    uriParser.QueryPart["name"] = "DataList";
                    uriParser.QueryPart["id"]   = this.Id.ToString();
                }
                if (pageNo > 0)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = (pageNo - 1).ToString();
                    prevPageLink = String.Format("<li><a href=\"{0}\"{1}>{2}</a></li>",
                                                 AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                                                 AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                                                 LabelPrevPage == "Previous Page" ? Provider.GetModuleResource("Previous Page") : LabelPrevPage);
                }

                int    count             = Provider.Database.GetInt(countSQL, filterParser.GetParams());
                string pagingWithNumbers = ""; //"<div class='pagingWithNumbers'>";
                for (int i = 0; i < Math.Ceiling((decimal)count / (decimal)HowManyItems); i++)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = i.ToString();
                    pagingWithNumbers += String.Format("<li class=\"{3}\"><a href=\"{0}\"{1}>{2}</a></li>",
                                                       AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                                                       AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                                                       i + 1,
                                                       pageNo == i ? "active":"");
                }
                //pagingWithNumbers += "</div>";

                if ((pageNo + 1) * HowManyItems < count)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = (pageNo + 1).ToString();
                    nextPageLink = String.Format("<li><a href=\"{0}\"{1}>{2}</a></li>",
                                                 AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                                                 AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                                                 LabelNextPage == "Next Page" ? Provider.GetModuleResource("Next Page") : LabelNextPage);
                }

                if (!string.IsNullOrWhiteSpace(prevPageLink) || !string.IsNullOrWhiteSpace(nextPageLink))
                {
                    sb.AppendFormat("<ul class=\"pagination mbn mtn\">{0} {1} {2}</ul>", prevPageLink, pagingWithNumbers, nextPageLink);
                }
            }

            return(sb.ToString());
        }
コード例 #8
0
ファイル: Admin.cs プロジェクト: fizikci/Cinar
        private void getList()
        {
            string entityName = context.Request["entityName"];
            string where = context.Request["extraFilter"] ?? "";
            string orderBy = (context.Request["sort"] ?? "") + " " + (context.Request["dir"] ?? "");
            if (orderBy != null) orderBy = orderBy.Replace("__", ".");
            string page = String.IsNullOrEmpty(context.Request["start"]) ? "0" : context.Request["start"];
            string limit = String.IsNullOrEmpty(context.Request["limit"]) ? "20" : context.Request["limit"];
            int fieldNo = 0;

            while (context.Request.Form["f_" + fieldNo] != null)
            {
                string op = context.Request.Form["o_" + fieldNo];
                string field = context.Request.Form["f_" + fieldNo];
                string val = context.Request.Form["c_" + fieldNo];
                where += (where == "" ? "" : " AND ") + field + op + val;
                fieldNo++;
            }

            FilterParser filterParser = new FilterParser(where, entityName);
            where = filterParser.GetWhere();
            object[] parameters = filterParser.GetParams();

            DataTable dt = Provider.ReadList(Provider.GetEntityType(entityName), Int32.Parse(page) / Int32.Parse(limit), Int32.Parse(limit), orderBy, where, parameters);
            int totalCount = Provider.ReadListTotalCount(Provider.GetEntityType(entityName), where, parameters);

            List<string> jsonItems = new List<string>();
            foreach (DataRow dr in dt.Rows)
            {
                string jsonItem = "{";

                foreach (DataColumn dc in dr.Table.Columns)
                    jsonItem += string.Format("{0}:{1},", dc.ColumnName.Replace(".", "__").ToJS(), dr[dc].ToJS());
                jsonItem = jsonItem.Remove(jsonItem.Length - 1, 1);
                jsonItem += "}";
                jsonItems.Add(jsonItem);
            }

            string res = "{root:[" + string.Join(",", jsonItems.ToArray()) + "], totalCount:" + totalCount + "}";
            context.Response.Write(res);
        }
コード例 #9
0
ファイル: EntityInfo.cs プロジェクト: fizikci/Cinar
        private void getEntityList()
        {
            string entityName = context.Request["entityName"];
            string orderBy = context.Request["orderBy"] ?? "OrderNo";
            string orderAsc = context.Request["orderAsc"] ?? "1";
            Type tip = Provider.GetEntityType(entityName);
            string filter = context.Request["filter"] ?? "";

            FilterParser filterParser = new FilterParser(filter, entityName);
            filter = filterParser.GetWhere();

            string where = "where " + (String.IsNullOrEmpty(filter) ? "1=1" : "(" + filter + ")");

            IDatabaseEntity[] entities = currentDatabase.ReadList(tip, "select * from [" + entityName + "] " + where + " order by " + orderBy + (orderAsc == "1" ? "" : " desc"), filterParser.GetParams()).SafeCastToArray<IDatabaseEntity>();

            context.Response.Write(entities.ToJSON());
        }
コード例 #10
0
ファイル: EntityInfo.cs プロジェクト: fizikci/Cinar
        private void getGridList()
        {
            string entityName = context.Request["entityName"];
            string where = context.Request["extraFilter"] ?? "";
            string orderBy = context.Request["orderBy"] ?? "";
            string page = String.IsNullOrEmpty(context.Request["page"]) ? "0" : context.Request["page"];
            string limit = String.IsNullOrEmpty(context.Request["limit"]) ? "20" : context.Request["limit"];
            int fieldNo = 0;

            Type entityType = Provider.GetEntityType(entityName);
            BaseEntity sampleEntity = Provider.CreateEntity(entityType);

            while (context.Request.Form["f_" + fieldNo] != null)
            {
                string op = context.Request.Form["o_" + fieldNo];
                string field = context.Request.Form["f_" + fieldNo];
                string val = context.Request.Form["c_" + fieldNo];
                where += (where == "" ? "" : " AND ") + field + op + val;
                fieldNo++;
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["search"]))
            {
                string search = context.Request.Form["search"];
                if (!search.Contains("%")) search = "%" + search + "%";
                where += " AND " + sampleEntity.GetNameColumn() + "like" + search;
            }

            FilterParser filterParser = new FilterParser(where, entityName);
            where = filterParser.GetWhere();

            DataTable dt = Provider.ReadList(entityType, Int32.Parse(page), Int32.Parse(limit), orderBy, where, filterParser.GetParams());

            context.Response.Write("<table class=\"bk-grid\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\">\n");
            if (dt != null)
            {
                context.Response.Write("\t<tr>\n");
                foreach (DataColumn dc in dt.Columns)
                {
                    if (dc.ColumnName == "_CinarRowNumber") continue; //***
                    string columnName = dc.ColumnName;
                    string columnTitle = Provider.TranslateColumnName(entityName, columnName);
                    context.Response.Write("\t\t<th id=\"h_" + dc.ColumnName + "\">" + columnTitle + "</th>\n");
                }
                context.Response.Write("\t</tr>\n");
            }
            if (dt != null)
            {
                if (dt.Rows.Count == 0)
                    context.Response.Write("\t<tr><td style=\"padding:30px;text-align:center\" colspan=\"50\">" + Provider.GetResource("No record") + "</td></tr>\n");
                else
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        DataRow dr = dt.Rows[i];
                        context.Response.Write("\t<tr id=\"r_" + dr[0] + "\">\n");
                        foreach (DataColumn dc in dt.Columns)
                        {
                            if (dc.ColumnName == "_CinarRowNumber") continue; //***

                            object valObj = dr[dc.ColumnName];
                            string dispVal = "";
                            if (dr.IsNull(dc))
                                dispVal = "";
                            else if (dc.DataType == typeof(Boolean))
                                dispVal = ((bool)valObj) ? Provider.GetResource("Yes") : Provider.GetResource("No");
                            else if (dc.DataType == typeof(String))
                            {
                                string str = Regex.Replace(valObj.ToString(), "<.*?>", string.Empty);
                                if (str.Length > 50)
                                    dispVal = CMSUtility.HtmlEncode(str.StrCrop(50)); // str.Substring(0, 50) + "..."
                                else
                                    dispVal = str;
                            }
                            else if (dc.DataType == typeof(DateTime))
                            {
                                dispVal = ((DateTime)valObj).ToString(Provider.Configuration.DefaultDateFormat);
                            }
                            else
                                dispVal = valObj.ToString();
                            context.Response.Write("\t\t<td value=\"" + CMSUtility.HtmlEncode(valObj) + "\">" + dispVal + "</td>\n");
                        }
                        context.Response.Write("\t</tr>\n");
                    }
            }
            context.Response.Write("</table>");
        }
コード例 #11
0
ファイル: Grid.cs プロジェクト: fizikci/Cinar
        internal override string show()
        {
            StringBuilder sb = new StringBuilder();

            if (String.IsNullOrEmpty(EntityName))
                return Provider.GetResource("Select entity");

            Cinar.Database.Table tbl = Provider.Database.Tables[EntityName];
            if(tbl==null)
                return Provider.GetResource("The table [entityName] coulnd't be found").Replace("[entityName]", EntityName);

            string pageUrl = Provider.Request.Url.Scheme + "://" + Provider.Request.Url.Authority + Provider.Request.RawUrl;
            CinarUriParser uriParser = new CinarUriParser(pageUrl);

            if (!String.IsNullOrEmpty(Provider.Request["delete"]))
            {
                deleteEntity();
                uriParser.QueryPart.Remove("delete");
                pageUrl = uriParser.ToString();
            }

            BaseEntity testEntity = Provider.CreateEntity(EntityName);

            if (String.IsNullOrEmpty(ShowFields))
                ShowFields = String.Format("{0},Visible", testEntity.GetNameColumn());

            StringBuilder sbFrom = new StringBuilder();
            sbFrom.AppendFormat("[{0}]\n", EntityName);

            // generate SQL
            string[] showFieldsArr = ShowFields.Split(',');
            string[] showFieldsArrWithAs = new string[showFieldsArr.Length];
            for (int i = 0; i < showFieldsArr.Length; i++)
            {
                string field = showFieldsArr[i];
                PropertyInfo pi = testEntity.GetType().GetProperty(field);
                EditFormFieldPropsAttribute attrib = (EditFormFieldPropsAttribute)CMSUtility.GetAttribute(pi, typeof(EditFormFieldPropsAttribute));
                ColumnDetailAttribute fieldProps = (ColumnDetailAttribute)CMSUtility.GetAttribute(pi, typeof(ColumnDetailAttribute));

                string caption = Provider.GetResource(pi.DeclaringType.Name + "." + pi.Name);

                if (fieldProps.References != null)
                {
                    BaseEntity testRefEntity = Provider.CreateEntity(fieldProps.References.Name);
                    showFieldsArrWithAs[i] = "T"+field + "." + testRefEntity.GetNameColumn() + " as [" + caption + "]";

                    sbFrom.AppendFormat("\tleft join [{0}] as {1} ON {1}.{2} = [{3}].{4}\n", fieldProps.References.Name, "T"+field, "Id", EntityName, field);
                }
                else
                    showFieldsArrWithAs[i] = EntityName + "." + field + " as [" + caption + "]";
            }
            ShowFields = String.Join(",", showFieldsArrWithAs);
            ShowFields = EntityName+".Id," + ShowFields;

            FilterParser filterParser = new FilterParser(this.Filter, EntityName);
            string where = filterParser.GetWhere();

            int pageNo = 0;
            Int32.TryParse(Provider.Request["pageNo"], out pageNo);

            string sql = Provider.Database.AddPagingToSQL(String.Format(@"
                select
                    {0}
                from
                    {1}
                where
                    1=1 {2}
                order by
                    {3} {4}
            ",
                                        ShowFields,
                                        sbFrom.ToString(),
                                        String.IsNullOrEmpty(where) ? "" : ("and " + where),
                                        EntityName + "." + this.OrderBy,
                                        this.Ascending ? "asc" : "desc"),
                                        HowManyItems,
                                        pageNo);

            DataTable dt = Provider.Database.GetDataTable(sql, filterParser.GetParams());

            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");

            // header
            sb.Append("<tr class=\"header\">\n");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                if (i == 0)
                    continue;
                string colName = dt.Columns[i].ColumnName;
                string img = "";
                uriParser.QueryPart["orderBy"] = showFieldsArr[i - 1];
                if (this.OrderBy == showFieldsArr[i - 1])
                {
                    uriParser.QueryPart["ascending"] = (!this.Ascending).ToString();
                    img = this.Ascending ? " (asc)" : " (desc)";
                }
                else
                    uriParser.QueryPart["ascending"] = "True";
                sb.AppendFormat("<td><a href=\"{0}\">{1}</a>{2}</td>\n", uriParser.ToString(), colName, img);
            }
            if (this.Editable) sb.AppendFormat("<td>{0}</td>\n", "&nbsp;");
            if (this.Deletable) sb.AppendFormat("<td>{0}</td>\n", "&nbsp;");
            sb.Append("</tr>\n");

            string nameField = testEntity.GetNameColumn();

            // data
            uriParser = new CinarUriParser(pageUrl);
            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("<tr class=\"data\">\n");
                string editUrl = this.EditPage + "?item=" + dr[0] + "&returnUrl=" + Provider.Server.UrlEncode(Provider.Request.RawUrl);
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    if (i == 0)
                        continue;
                    object data = (dr.IsNull(i) || dr[i].Equals("")) ? "&nbsp;" : dr[i];
                    if (showFieldsArr[i-1] == nameField && this.Editable)
                        data = "<a href=\"" + editUrl + "\">" + data + "</a>";
                    if (dr.Table.Columns[i].DataType == typeof(bool))
                        data = ((bool)data) ? Provider.GetResource("Yes") : Provider.GetResource("No");
                    sb.AppendFormat("<td>{0}</td>\n", data);
                }
                if (this.Deletable)
                {
                    uriParser.QueryPart["delete"] = dr[0].ToString();
                    sb.AppendFormat("<td><span class=\"cbtn cdelete\" onclick=\"if(confirm('Kayýt silinecek!')) location.href='{0}'\"></span></td>\n", uriParser.ToString());
                }
                if (this.Editable)
                    sb.AppendFormat("<td><span class=\"cbtn cedit\" onclick=\"location.href='{0}'\"></span></td>\n", editUrl);
                sb.Append("</tr>\n");
            }

            // paging
            string prevPageLink = "", nextPageLink = "";
            uriParser = new CinarUriParser(pageUrl);
            if (pageNo > 0)
            {
                uriParser.QueryPart["pageNo"] = (pageNo - 1).ToString();
                prevPageLink = String.Format("<a href=\"{0}\"><< {1}</a>&nbsp;&nbsp;", uriParser.Uri.ToString(), Provider.GetModuleResource("Previous Page"));
            }
            if (dt.Rows.Count == HowManyItems)
            {
                uriParser.QueryPart["pageNo"] = (pageNo + 1).ToString();
                nextPageLink = String.Format("&nbsp;&nbsp;<a href=\"{0}\">{1} >></a>", uriParser.Uri.ToString(), Provider.GetModuleResource("Next Page"));
            }

            sb.AppendFormat("<tr class=\"footer\"><td colspan=\"100\">{0} {1}</td></tr>\n", prevPageLink, nextPageLink);
            sb.Append("</table>\n");

            if (!String.IsNullOrEmpty(NewRecordLink)) {
                sb.AppendFormat("<p class=\"newRec\"><a href=\"{0}\">{1}</a></p>\n", this.EditPage + "?returnUrl=" + Provider.Server.UrlEncode(Provider.Request.RawUrl), NewRecordLink);
            }

            return sb.ToString();
        }
コード例 #12
0
ファイル: DataList.cs プロジェクト: fizikci/Cinar
        internal override string show()
        {
            StringBuilder sb = new StringBuilder();

            if (String.IsNullOrEmpty(EntityName))
                return Provider.GetResource("Select entity");

            Cinar.Database.Table tbl = Provider.Database.Tables[EntityName];
            if (tbl == null)
                return Provider.GetResource("The table [entityName] coulnd't be found").Replace("[entityName]", EntityName);

            string pageUrl = Provider.Request.Url.Scheme + "://" + Provider.Request.Url.Authority + Provider.Request.RawUrl;
            CinarUriParser uriParser = new CinarUriParser(pageUrl);

            if (!String.IsNullOrEmpty(Provider.Request["delete"]))
            {
                deleteEntity();
                Provider.Response.Redirect(Provider.Request["returnUrl"], true);
                return String.Empty; //***
            }

            FilterParser filterParser = new FilterParser(this.Filter, EntityName);
            string where = filterParser.GetWhere();

            string sql = "";
            if (string.IsNullOrWhiteSpace(this.SQL))
            {
                sql = String.Format(@"
                    select
                        {0}
                    from
                        {1}
                    where
                        {2} {3}
                    order by
                        {4} {5}",
                                     "*",
                                     this.EntityName,
                                     defaultWhere,
                                     String.IsNullOrEmpty(where) ? "" : ("and " + where),
                                     this.OrderBy,
                                     this.Ascending ? "asc" : "desc");

                if (!ShowPaging)
                    sql = Provider.Database.AddLimitOffsetToSQL(sql, HowManyItems, Offset);
            }
            else
            {
                Interpreter engine = Provider.GetInterpreter(SQL, this);
                engine.Parse();
                engine.Execute();
                sql = engine.Output;

                if (ShowPaging && sql.ToLowerInvariant().Contains("limit"))
                    return "Do not use limit in SQL with paging. DataList does it.";

                if (!sql.ToLowerInvariant().Contains("order by"))
                    sql += " order by " + this.OrderBy + " " + (this.Ascending ? "asc":"desc");

                if (!ShowPaging && !sql.ToLowerInvariant().Contains("limit"))
                    sql = Provider.Database.AddLimitOffsetToSQL(sql, HowManyItems, Offset);
            }

            string countSQL = "";
            if (ShowPaging)
            {
                countSQL = "SELECT count(*) " + sql.Substring(sql.IndexOf("from", StringComparison.InvariantCultureIgnoreCase));
                if (countSQL.LastIndexOf("order by", StringComparison.InvariantCultureIgnoreCase) > -1)
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("order by", StringComparison.InvariantCultureIgnoreCase));
                if (countSQL.LastIndexOf("group by", StringComparison.InvariantCultureIgnoreCase) > -1)
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("group by", StringComparison.InvariantCultureIgnoreCase));
                if (countSQL.LastIndexOf("having", StringComparison.InvariantCultureIgnoreCase) > -1)
                    countSQL = countSQL.Substring(0, countSQL.LastIndexOf("having", StringComparison.InvariantCultureIgnoreCase));

                sql = Provider.Database.AddPagingToSQL(sql,
                        HowManyItems,
                        pageNo);
            }

            data = Provider.Database.GetDataTable(sql, filterParser.GetParams());

            Provider.Translate(EntityName, data);

            if (data.Rows.Count == 0)
                return "";
            else
                sb.Append(base.show());

            // paging
            if (this.ShowPaging)
            {

                /*
                    <ul class="pagination mbn mtn">
                        <li><a href="#"><i class="fa fa-angle-double-left"></i></a></li>
                        <li><a href="#"><i class="fa fa-angle-left"></i></a></li>
                        <li class="active"><a href="#">1</a></li>
                        <li><a href="#">2</a></li>
                        <li><a href="#">...</a></li>
                        <li><a href="#">15</a></li>
                        <li><a href="#"><i class="fa fa-angle-right"></i></a></li>
                        <li><a href="#"><i class="fa fa-angle-double-right"></i></a></li>
                    </ul>
                 */

                string prevPageLink = "", nextPageLink = "";
                uriParser = new CinarUriParser(pageUrl);
                if (AjaxPaging)
                {
                    uriParser.Path = "/GetModuleHtml.ashx";
                    uriParser.QueryPart["name"] = "DataList";
                    uriParser.QueryPart["id"] = this.Id.ToString();
                }
                if (pageNo > 0)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = (pageNo - 1).ToString();
                    prevPageLink = String.Format("<li><a href=\"{0}\"{1}>{2}</a></li>",
                        AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                        AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                        LabelPrevPage == "Previous Page" ? Provider.GetModuleResource("Previous Page") : LabelPrevPage);
                }

                int count = Provider.Database.GetInt(countSQL, filterParser.GetParams());
                string pagingWithNumbers = ""; //"<div class='pagingWithNumbers'>";
                for (int i = 0; i < Math.Ceiling((decimal) count / (decimal)HowManyItems); i++)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = i.ToString();
                    pagingWithNumbers += String.Format("<li class=\"{3}\"><a href=\"{0}\"{1}>{2}</a></li>",
                        AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                        AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                        i + 1,
                        pageNo==i ? "active":"");
                }
                //pagingWithNumbers += "</div>";

                if ((pageNo+1)*HowManyItems<count)
                {
                    uriParser.QueryPart["pageNo" + this.Id] = (pageNo + 1).ToString();
                    nextPageLink = String.Format("<li><a href=\"{0}\"{1}>{2}</a></li>",
                        AjaxPaging ? "javascript:void()" : uriParser.Uri.ToString(),
                        AjaxPaging ? " onclick=\"showDataListPage('" + uriParser.Uri + "', " + this.Id + ");\"" : "",
                        LabelNextPage == "Next Page" ? Provider.GetModuleResource("Next Page") : LabelNextPage);
                }

                if (!string.IsNullOrWhiteSpace(prevPageLink) || !string.IsNullOrWhiteSpace(nextPageLink))
                    sb.AppendFormat("<ul class=\"pagination mbn mtn\">{0} {1} {2}</ul>", prevPageLink, pagingWithNumbers, nextPageLink);
            }

            return sb.ToString();
        }
コード例 #13
0
ファイル: ContentDisplay.cs プロジェクト: fizikci/Cinar
        private Content getContent()
        {
            if (this.filter == "")
                return Provider.Content; //***

            FilterParser filterForContent = new FilterParser(this.filter, "Content");

            string where = filterForContent.GetWhere();
            string sql = @"
                select distinct top 1
                    *
                from
                    Content
                where
                    Content.Visible=1" + (where != "" ? " AND " + where : "");

            IDatabaseEntity[] contents = Provider.Database.ReadList(typeof(Entities.Content), sql, filterForContent.GetParams()).SafeCastToArray<IDatabaseEntity>();
            Provider.Translate(contents);

            return contents.Length > 0 ? (Entities.Content)contents[0] : null;
        }
コード例 #14
0
ファイル: Provider.cs プロジェクト: fizikci/Cinar
        public static IDatabaseEntity[] GetIdNameList(string entityName, string extraWhere, string simpleWhere)
        {
            Type tip = Provider.GetEntityType(entityName);
            BaseEntity sampleEntity = Provider.CreateEntity(entityName);

            extraWhere = extraWhere.Replace("_nameField_", sampleEntity.GetNameColumn());

            FilterParser filterParser = new FilterParser(extraWhere, entityName);
            extraWhere = filterParser.GetWhere();

            string where = "where " + (String.IsNullOrEmpty(simpleWhere) ? "1=1" : simpleWhere) + (String.IsNullOrEmpty(extraWhere) ? "" : " AND (" + extraWhere + ")");

            IDatabaseEntity[] entities = Provider.Database.ReadList(tip, "select Id, [" + sampleEntity.GetNameColumn() + "] from [" + entityName + "]" + where + " order by [" + sampleEntity.GetNameColumn() + "]", filterParser.GetParams()).SafeCastToArray<IDatabaseEntity>();
            return entities;
        }
コード例 #15
0
        internal override string show()
        {
            StringBuilder sb = new StringBuilder();

            if (String.IsNullOrEmpty(EntityName))
            {
                return(Provider.GetResource("Select entity"));
            }

            Cinar.Database.Table tbl = Provider.Database.Tables[EntityName];
            if (tbl == null)
            {
                return(Provider.GetResource("The table [entityName] coulnd't be found").Replace("[entityName]", EntityName));
            }

            string         pageUrl   = Provider.Request.Url.Scheme + "://" + Provider.Request.Url.Authority + Provider.Request.RawUrl;
            CinarUriParser uriParser = new CinarUriParser(pageUrl);

            if (!String.IsNullOrEmpty(Provider.Request["delete"]))
            {
                deleteEntity();
                uriParser.QueryPart.Remove("delete");
                pageUrl = uriParser.ToString();
            }

            BaseEntity testEntity = Provider.CreateEntity(EntityName);

            if (String.IsNullOrEmpty(ShowFields))
            {
                ShowFields = String.Format("{0},Visible", testEntity.GetNameColumn());
            }

            StringBuilder sbFrom = new StringBuilder();

            sbFrom.AppendFormat("[{0}]\n", EntityName);

            // generate SQL
            string[] showFieldsArr       = ShowFields.Split(',');
            string[] showFieldsArrWithAs = new string[showFieldsArr.Length];
            for (int i = 0; i < showFieldsArr.Length; i++)
            {
                string       field = showFieldsArr[i];
                PropertyInfo pi    = testEntity.GetType().GetProperty(field);
                EditFormFieldPropsAttribute attrib     = (EditFormFieldPropsAttribute)CMSUtility.GetAttribute(pi, typeof(EditFormFieldPropsAttribute));
                ColumnDetailAttribute       fieldProps = (ColumnDetailAttribute)CMSUtility.GetAttribute(pi, typeof(ColumnDetailAttribute));

                string caption = Provider.GetResource(pi.DeclaringType.Name + "." + pi.Name);

                if (fieldProps.References != null)
                {
                    BaseEntity testRefEntity = Provider.CreateEntity(fieldProps.References.Name);
                    showFieldsArrWithAs[i] = "T" + field + "." + testRefEntity.GetNameColumn() + " as [" + caption + "]";

                    sbFrom.AppendFormat("\tleft join [{0}] as {1} ON {1}.{2} = [{3}].{4}\n", fieldProps.References.Name, "T" + field, "Id", EntityName, field);
                }
                else
                {
                    showFieldsArrWithAs[i] = EntityName + "." + field + " as [" + caption + "]";
                }
            }
            ShowFields = String.Join(",", showFieldsArrWithAs);
            ShowFields = EntityName + ".Id," + ShowFields;

            FilterParser filterParser = new FilterParser(this.Filter, EntityName);

            string where = filterParser.GetWhere();

            int pageNo = 0;

            Int32.TryParse(Provider.Request["pageNo"], out pageNo);

            string sql = Provider.Database.AddPagingToSQL(String.Format(@"
                select
                    {0}
                from
                    {1}
                where
                    1=1 {2}
                order by
                    {3} {4}
            ",
                                                                        ShowFields,
                                                                        sbFrom.ToString(),
                                                                        String.IsNullOrEmpty(where) ? "" : ("and " + where),
                                                                        EntityName + "." + this.OrderBy,
                                                                        this.Ascending ? "asc" : "desc"),
                                                          HowManyItems,
                                                          pageNo);

            DataTable dt = Provider.Database.GetDataTable(sql, filterParser.GetParams());

            sb.Append("<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n");

            // header
            sb.Append("<tr class=\"header\">\n");
            for (int i = 0; i < dt.Columns.Count; i++)
            {
                if (i == 0)
                {
                    continue;
                }
                string colName = dt.Columns[i].ColumnName;
                string img     = "";
                uriParser.QueryPart["orderBy"] = showFieldsArr[i - 1];
                if (this.OrderBy == showFieldsArr[i - 1])
                {
                    uriParser.QueryPart["ascending"] = (!this.Ascending).ToString();
                    img = this.Ascending ? " (asc)" : " (desc)";
                }
                else
                {
                    uriParser.QueryPart["ascending"] = "True";
                }
                sb.AppendFormat("<td><a href=\"{0}\">{1}</a>{2}</td>\n", uriParser.ToString(), colName, img);
            }
            if (this.Editable)
            {
                sb.AppendFormat("<td>{0}</td>\n", "&nbsp;");
            }
            if (this.Deletable)
            {
                sb.AppendFormat("<td>{0}</td>\n", "&nbsp;");
            }
            sb.Append("</tr>\n");

            string nameField = testEntity.GetNameColumn();

            // data
            uriParser = new CinarUriParser(pageUrl);
            foreach (DataRow dr in dt.Rows)
            {
                sb.Append("<tr class=\"data\">\n");
                string editUrl = this.EditPage + "?item=" + dr[0] + "&returnUrl=" + Provider.Server.UrlEncode(Provider.Request.RawUrl);
                for (int i = 0; i < dt.Columns.Count; i++)
                {
                    if (i == 0)
                    {
                        continue;
                    }
                    object data = (dr.IsNull(i) || dr[i].Equals("")) ? "&nbsp;" : dr[i];
                    if (showFieldsArr[i - 1] == nameField && this.Editable)
                    {
                        data = "<a href=\"" + editUrl + "\">" + data + "</a>";
                    }
                    if (dr.Table.Columns[i].DataType == typeof(bool))
                    {
                        data = ((bool)data) ? Provider.GetResource("Yes") : Provider.GetResource("No");
                    }
                    sb.AppendFormat("<td>{0}</td>\n", data);
                }
                if (this.Deletable)
                {
                    uriParser.QueryPart["delete"] = dr[0].ToString();
                    sb.AppendFormat("<td><span class=\"cbtn cdelete\" onclick=\"if(confirm('Kayýt silinecek!')) location.href='{0}'\"></span></td>\n", uriParser.ToString());
                }
                if (this.Editable)
                {
                    sb.AppendFormat("<td><span class=\"cbtn cedit\" onclick=\"location.href='{0}'\"></span></td>\n", editUrl);
                }
                sb.Append("</tr>\n");
            }

            // paging
            string prevPageLink = "", nextPageLink = "";

            uriParser = new CinarUriParser(pageUrl);
            if (pageNo > 0)
            {
                uriParser.QueryPart["pageNo"] = (pageNo - 1).ToString();
                prevPageLink = String.Format("<a href=\"{0}\"><< {1}</a>&nbsp;&nbsp;", uriParser.Uri.ToString(), Provider.GetModuleResource("Previous Page"));
            }
            if (dt.Rows.Count == HowManyItems)
            {
                uriParser.QueryPart["pageNo"] = (pageNo + 1).ToString();
                nextPageLink = String.Format("&nbsp;&nbsp;<a href=\"{0}\">{1} >></a>", uriParser.Uri.ToString(), Provider.GetModuleResource("Next Page"));
            }

            sb.AppendFormat("<tr class=\"footer\"><td colspan=\"100\">{0} {1}</td></tr>\n", prevPageLink, nextPageLink);
            sb.Append("</table>\n");

            if (!String.IsNullOrEmpty(NewRecordLink))
            {
                sb.AppendFormat("<p class=\"newRec\"><a href=\"{0}\">{1}</a></p>\n", this.EditPage + "?returnUrl=" + Provider.Server.UrlEncode(Provider.Request.RawUrl), NewRecordLink);
            }

            return(sb.ToString());
        }