private static string GenrateCategory(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID, bool needHeader) { StringBuilder sb = new StringBuilder(); FieldCategory priceDetailCategroy = allGategory.Find(t => t.ID == "7"); FieldCategory termsConditionsCategory = allGategory.Find(t => t.ID == "8"); FieldCategory VVItermsConditionsCategory = allGategory.Find(t => t.ID == "9"); FieldCategory VVIpriceDetailCategroy = allGategory.Find(t => t.ID == "15"); String GRole = fc.AllowedRoles; string[] GategoryRoles = GRole.Split(','); if (!GategoryRoles.Contains("ALL")) { AccessServiceReference.Role[] role = BI.SGP.BLL.Utils.AccessControl.CurrentLogonUser.Roles; List<string> CurrRole = new List<string>(); if (role != null) { foreach (AccessServiceReference.Role r in role) { CurrRole.Add(r.Name); } } List<string> ExcepCurrRole = GategoryRoles.Except(CurrRole).ToList(); if (ExcepCurrRole.Count > 0) { return string.Empty; } } ID++; string fcactivity = fc.ActivityID; if (needHeader) { if (fcactivity != null) { string[] curractivitys = fcactivity.Split(','); if (curractivitys.Contains(ActivityID)) { sb.Append(@"<div class=""panel panel-default""> <div class=""panel-heading""> <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle collapsed""> <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i> <i class=""icon-user bigger-130""></i> " + fc.CategoryName + @":</a> </div>"); sb.Append(@"<div class=""panel-collapse collapse"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">"); } else { sb.Append(@"<div class=""panel panel-default""> <div class=""panel-heading""> <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle""> <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i> <i class=""icon-user bigger-130""></i> " + fc.CategoryName + @":</a> </div>"); sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">"); } } else { sb.Append(@"<div class=""panel panel-default""> <div class=""panel-heading""> <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle""> <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i> <i class=""icon-user bigger-130""></i> " + fc.CategoryName + @":</a> </div>"); sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">"); } } sb.Append(@"<table>"); { FieldInfoCollecton enablefields = new FieldInfoCollecton(); foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields) { if (fi.Enable == 1) { enablefields.Add(fi); } } double RowCount = enablefields.Count; int colSize = 8; if (fc.CategoryName == "Closure Status") { colSize = 6; sb.Append("<thead style='width:100%'><tr><th style='width:15%'></th><th style='width:18.3333%'></th><th style='width:15%'></th><th style='width:18.3333%'></th><th style='width:15%'></th><th style='width:18.3333%'></th></tr></thead>"); } else if (fc.ID == "5") //价格区域 { colSize = 6; sb.Append("<thead style='width:100%'><tr><th style='width:20%'></th><th style='width:13%'></th><th style='width:20%'></th><th style='width:13%'></th><th style='width:20%'></th><th style='width:14%'></th></tr></thead>"); } else if (fc.ID == "9") { colSize = 10; sb.Append("<thead style='width:100%'><tr><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th><th style='width:10% !important'></th></tr></thead>"); } else { sb.Append("<thead style='width:100%'><tr><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th><th style='width:10%'></th><th style='width:15%'></th></tr></thead>"); } sb.Append("<tbody style='width:100%'>"); int colSpanTotal = 0; for (int i = 0; i < RowCount; i++) { if (colSpanTotal == 0) { sb.Append("<tr>"); } colSpanTotal++; int curSpan; if (enablefields[i].ColSpan == 0) { curSpan = 1; } else if (enablefields[i].ColSpan > (colSize - 1)) { curSpan = colSize - 1; } else { curSpan = enablefields[i].ColSpan; } colSpanTotal += curSpan; if (colSpanTotal <= colSize) { sb.Append(GenerateField(enablefields[i])); } if (colSpanTotal == colSize) { sb.Append("</tr>"); colSpanTotal = 0; } if (colSpanTotal > colSize) { sb.Append("</tr>"); colSpanTotal = 0; i--; } } sb.Append("</tbody>"); sb.Append("</table>"); //价格区域 if (fc.ID == "5") { //绘制价格表格 //sb.AppendLine("<div style='padding:5px;'>"); sb.Append(GenerateCategoryForPriceDetail(priceDetailCategroy)); //sb.AppendLine("</div>"); //绘制Terms & Conditions头部 sb.AppendFormat(@" <div class='panel-heading' style='background:#f7f7f7;font-weight:bold;text-align:center'> {0} </div>" , termsConditionsCategory.CategoryName); //绘制Terms & Conditions主体 string s = GenrateCategory(ref ID, allGategory, termsConditionsCategory, data, ActivityID, false); sb.AppendLine(s); } if (fc.ID == "15") { //绘制价格表格 //sb.AppendLine("<div style='padding:5px;'>"); sb.Append(GenerateCategoryForVerticalDetail(VVIpriceDetailCategroy)); //sb.AppendLine("</div>"); } if (fc.ID == "4") { //绘制Terms & Conditions头部 sb.AppendFormat(@" <div class='panel-heading' style='background:#f7f7f7;font-weight:bold;text-align:center'> {0} </div>", VVItermsConditionsCategory.CategoryName); //绘制Terms & Conditions主体 string s = GenrateCategory(ref ID, allGategory, VVItermsConditionsCategory, data, ActivityID, false); sb.AppendLine(s); } } if (needHeader) { sb.Append(@"</div></div></div>"); } return sb.ToString(); }
private static string GenratePrintPage(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID) { StringBuilder sb = new StringBuilder(); sb.Append(@"<div><h3 align=""center"">" + fc.CategoryName + "</h3></div>"); sb.Append(@"<table style=""width:98%"" id=""listTable"" border=""1"" align=""center"" cellpadding=""0"" cellspacing=""0"" bordercolor=""#000000"" >"); FieldInfoCollecton enablefields = new FieldInfoCollecton(); foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields) { if (fi.Enable == 1) { enablefields.Add(fi); } } double RowCount = enablefields.Count; int colSize = 4; int colSpanTotal = 0; for (int i = 0; i < RowCount; i++) { if (colSpanTotal == 0) { sb.Append(@"<tr style=""height:25px"">"); } colSpanTotal++; int curSpan; if (enablefields[i].ColSpan == 0) { curSpan = 1; } else if (enablefields[i].ColSpan > (colSize - 1)) { curSpan = colSize - 1; } else { curSpan = enablefields[i].ColSpan; } colSpanTotal += curSpan; if (colSpanTotal <= colSize) { sb.Append(UIManager.GeneratePrintField(enablefields[i])); } if (colSpanTotal == colSize) { sb.Append("</tr>"); colSpanTotal = 0; } if (colSpanTotal > colSize) { sb.Append("</tr>"); colSpanTotal = 0; i--; } } sb.Append("</table>"); return sb.ToString(); }
private static string GenrateCategory(ref int ID, List<FieldCategory> allGategory, FieldCategory fc, object data, string ActivityID) { StringBuilder sb = new StringBuilder(); ID++; sb.Append(@"<div class=""panel panel-default""> <div class=""panel-heading""> <a href=""#faq-1-" + ID.ToString() + @""" data-parent=""#faq-list-" + ID.ToString() + @""" data-toggle=""collapse"" class=""accordion-toggle""> <i class=""pull-right icon-chevron-down"" data-icon-hide=""icon-chevron-down"" data-icon-show=""icon-chevron-left""></i> <i class=""icon-user bigger-130""></i> " + fc.CategoryName + @":</a> </div>"); sb.Append(@"<div class=""panel-collapse in"" id=""faq-1-" + ID.ToString() + @""" style=""height: auto;""><div class=""panel-body"">"); sb.Append(@"<form id='fm' method='post'><table>"); FieldInfoCollecton enablefields = new FieldInfoCollecton(); foreach (BI.SGP.BLL.DataModels.FieldInfo fi in fc.Fields) { if (fi.Enable == 1) { enablefields.Add(fi); } } double RowCount = enablefields.Count; int colSize = 4; sb.Append(@"<input type=""hidden"" id=""ID"" name=""ID"" value=""" + ActivityID + @""" /><tbody style=""width:100%"">"); int colSpanTotal = 0; for (int i = 0; i < RowCount; i++) { if (colSpanTotal == 0) { sb.Append("<tr>"); } colSpanTotal++; int curSpan; if (enablefields[i].ColSpan == 0) { curSpan = 1; } else if (enablefields[i].ColSpan > (colSize - 1)) { curSpan = colSize - 1; } else { curSpan = enablefields[i].ColSpan; } colSpanTotal += curSpan; if (colSpanTotal <= colSize) { sb.Append(UIManager.GenerateField(enablefields[i])); } if (colSpanTotal == colSize) { sb.Append("</tr>"); colSpanTotal = 0; } if (colSpanTotal > colSize) { sb.Append("</tr>"); colSpanTotal = 0; i--; } } sb.Append("</tbody>"); sb.Append("</form></table>"); sb.Append(@"</div></div></div>"); return sb.ToString(); }
public static FieldInfoCollecton GetSubFields(string subFieldType, FieldInfoCollecton AllFields) { FieldInfoCollecton fields = new FieldInfoCollecton(); foreach (FieldInfo f in fields) { if (String.Compare(f.SubDataType, subFieldType, true) == 0) { fields.Add(f); } } return fields; }