public string GetEditHtmlHead(ExcelUIViewDetailItem uiItem, List<ExcelTableSpec> tables, string viewName) { return ReplaceUiItemValue(EditHtmlHeadString, uiItem, tables, viewName); }
public string GetViewCsPopulate(ExcelUIViewDetailItem uiItem, List<ExcelTableSpec> tables, string viewName) { return ReplaceUiItemValue(ViewCsPopulateString, uiItem, tables, viewName); }
string ReplaceUiItemValue(string template, ExcelUIViewDetailItem uiItem, List<ExcelTableSpec> tables, string vieweName) { if (template == null) return ""; if (uiItem.ElementId!=null) template = template.Replace("{id}", uiItem.ElementId.Replace(".", "_")); else template = template.Replace("{id}", "item"+uiItem.RowNumber.ToString()); if (uiItem.RowNumber != null) template = template.Replace("{rownum}", uiItem.RowNumber.ToString()); if (uiItem.Caption != null) { template = template.Replace("{caption}", uiItem.Caption); template = template.Replace("*", "<span style=\"color: red\">*</span>"); } else template = template.Replace("{caption}", ""); if (uiItem.CustomStyle != null) template = template.Replace("{class}", uiItem.CustomStyle); else template = template.Replace("{class}", ""); if (uiItem.Width != 0) template = template.Replace("{width}", uiItem.Width.ToString()); else template = template.Replace("Width=\"{width}\"", ""); if (uiItem.Height != 0) template = template.Replace("{height}", uiItem.Height.ToString()); else template = template.Replace("Height=\"{height}\"", ""); if (uiItem.DataBinding != null) { template = template.Replace("{fieldname}", uiItem.DataBinding.Substring(uiItem.DataBinding.IndexOf(".")+1)); if (template.IndexOf("{lkudatasourceid}") >= 0) template = template.Replace("{lkudatasourceid}", "ds" + GetTableNameFK(tables, uiItem.DataBinding)); if (template.IndexOf("{datasourceid}") >= 0) template = template.Replace("{datasourceid}", "ds" + vieweName); if (template.IndexOf("{fieldtext}") >= 0) template = template.Replace("{fieldtext}", "" + GetFieldTextFK(tables, uiItem.DataBinding)); if (template.IndexOf("{fieldvalue}") >= 0) template = template.Replace("{fieldvalue}", "" + GetFieldValueFK(tables, uiItem.DataBinding)); } else { template = template.Replace("{fieldname}", ""); if (template.IndexOf("{lkudatasourceid}") >= 0) template = template.Replace("{lkudatasourceid}", "ds" + GetTableNameFK(tables, uiItem.DataBinding)); if (template.IndexOf("{datasourceid}") >= 0) template = template.Replace("{datasourceid}", "ds" + vieweName); if (template.IndexOf("{fieldtext}") >= 0) template = template.Replace("{fieldtext}", "fd" + uiItem.RowNumber.ToString()); if (template.IndexOf("{fieldvalue}") >= 0) template = template.Replace("{fieldvalue}", "fd" + uiItem.RowNumber.ToString()); } if (uiItem.LevelValue != null && uiItem.LevelValue.Trim() != "") template = template.Replace("{value}", uiItem.LevelValue); if (uiItem.ElementId != null && uiItem.ElementId != "") template = template.Replace("{idlayout}", "id=\"" + uiItem.ElementId + "\""); else template = template.Replace("{idlayout}", ""); // return template + "\r\n"; }
public string GetUpdateCs(ExcelUIViewDetailItem uiItem, List<ExcelTableSpec> tables, string viewName) { return ReplaceUiItemValue(UpdateCsString, uiItem, tables, viewName); }
string GetOnlyTableName(ExcelUIViewDetailItem fd) { if (fd.DataBinding.IndexOf(".") >= 0) return fd.DataBinding.Substring(0, fd.DataBinding.IndexOf(".")); else return ""; }
string GetOnlyFieldName(ExcelUIViewDetailItem fd) { if (fd.DataBinding.IndexOf(".") >= 0) return fd.DataBinding.Substring(fd.DataBinding.IndexOf(".") + 1); else return fd.DataBinding; }
string GetFormattingString(ExcelUIViewDetailItem item, string fieldname) { string str = ""; if (fieldname == null || fieldname.IndexOf(".") < 0) return ""; string tb = fieldname.Substring(0, fieldname.IndexOf(".")); string fd = fieldname.Substring(fieldname.IndexOf(".") + 1); if (item.TextAlignment!=null && item.TextAlignment.ToLower() == "right") { //ctlPROVINCE_CODE.Style.Add("text-align","right"); str += "\t\tctl" + fd + ".HorizontalAlign = HorizontalAlign.Right;\r\n"; } else if (item.TextAlignment != null && item.TextAlignment.ToLower() == "center") { str += "\t\tctl" + fd + ".HorizontalAlign = HorizontalAlign.Center;\r\n"; } if (item.Formats != null && item.Formats != "") { str += "\t\tctl" + fd + ".DisplayFormatString = \"" + item.Formats + "\";\r\n"; } return str; }
string GetFKTableName(ExcelUIViewDetailItem fd, ExcelConfiguration conf) { ExcelFieldSpec f = GetFieldSpec(conf, GetOnlyTableName(fd), GetOnlyFieldName(fd)); if (f.FieldForeignKey) return f.FieldForeignKeyTableName; else return ""; }