private DataTable _GetMainTableStruct <T>(string TableName, int PageSelectIndex, bool SelectSelectDefault) { DataTable dataTable = new DataTable(); try { if (TableName != null) { dataTable = _GetTableStruct(TableName); Class_SelectAllModel mySelect = new Class_SelectAllModel(); switch (OperateType) { case "select": mySelect = this.class_AllModel as Class_SelectAllModel; #region 加入自定义Select列 DataColumn SelectSelect = new DataColumn("SelectSelect", typeof(bool)); DataColumn ParaName = new DataColumn("ParaName", typeof(string)); DataColumn MaxLegth = new DataColumn("MaxLegth", typeof(Int32)); DataColumn CaseWhen = new DataColumn("CaseWhen", typeof(string)); DataColumn ReturnType = new DataColumn("ReturnType", typeof(string)); DataColumn TrimSign = new DataColumn("TrimSign", typeof(bool)); DataColumn FunctionName = new DataColumn("FunctionName", typeof(string)); DataColumn WhereSelect = new DataColumn("WhereSelect", typeof(bool)); DataColumn WhereType = new DataColumn("WhereType", typeof(string)); DataColumn LogType = new DataColumn("LogType", typeof(string)); DataColumn WhereValue = new DataColumn("WhereValue", typeof(string)); DataColumn WhereTrim = new DataColumn("WhereTrim", typeof(bool)); DataColumn WhereIsNull = new DataColumn("WhereIsNull", typeof(bool)); DataColumn OrderSelect = new DataColumn("OrderSelect", typeof(bool)); DataColumn SortType = new DataColumn("SortType", typeof(string)); DataColumn SortNo = new DataColumn("SortNo", typeof(Int32)); DataColumn GroupSelect = new DataColumn("GroupSelect", typeof(bool)); DataColumn HavingSelect = new DataColumn("HavingSelect", typeof(bool)); DataColumn HavingFunction = new DataColumn("HavingFunction", typeof(string)); DataColumn HavingCondition = new DataColumn("HavingCondition", typeof(string)); DataColumn HavingValue = new DataColumn("HavingValue", typeof(string)); SelectSelect.DefaultValue = true; TrimSign.DefaultValue = true; WhereSelect.DefaultValue = false; WhereTrim.DefaultValue = true; WhereIsNull.DefaultValue = true; OrderSelect.DefaultValue = false; GroupSelect.DefaultValue = false; HavingSelect.DefaultValue = false; dataTable.Columns.Add(SelectSelect); dataTable.Columns.Add(ParaName); dataTable.Columns.Add(MaxLegth); dataTable.Columns.Add(CaseWhen); dataTable.Columns.Add(ReturnType); dataTable.Columns.Add(TrimSign); dataTable.Columns.Add(FunctionName); dataTable.Columns.Add(WhereSelect); dataTable.Columns.Add(WhereType); dataTable.Columns.Add(LogType); dataTable.Columns.Add(WhereValue); dataTable.Columns.Add(WhereTrim); dataTable.Columns.Add(WhereIsNull); dataTable.Columns.Add(OrderSelect); dataTable.Columns.Add(SortType); dataTable.Columns.Add(SortNo); dataTable.Columns.Add(GroupSelect); dataTable.Columns.Add(HavingSelect); dataTable.Columns.Add(HavingFunction); dataTable.Columns.Add(HavingCondition); dataTable.Columns.Add(HavingValue); #endregion break; case "insert": //mySelect = this.class_AllModel as Class_SelectAllModel; break; case "update": //mySelect = this.class_AllModel as Class_SelectAllModel; break; case "delete": //mySelect = this.class_AllModel as Class_SelectAllModel; break; default: break; } int Counter = 1; Class_Sub class_Mains = new Class_Sub(); class_Mains = mySelect.class_SubList[PageSelectIndex]; foreach (DataRow row in dataTable.Rows) { string myFieldName = row["FieldName"].ToString(); bool IsDefault = true; row.BeginEdit(); if (class_AllModel != null) { switch (OperateType) { case "select": { if (mySelect.class_SubList[PageSelectIndex].class_Fields.Count > 0) { int FindIndex = class_Mains.class_Fields.FindIndex(a => a.FieldName.Equals(myFieldName)); if (FindIndex > -1) { row["SelectSelect"] = class_Mains.class_Fields[FindIndex].SelectSelect; row["ParaName"] = class_Mains.class_Fields[FindIndex].ParaName == null ? row["FieldName"] : class_Mains.class_Fields[FindIndex].ParaName; row["MaxLegth"] = class_Mains.class_Fields[FindIndex].MaxLegth; row["CaseWhen"] = class_Mains.class_Fields[FindIndex].CaseWhen; row["ReturnType"] = class_Mains.class_Fields[FindIndex].ReturnType; row["TrimSign"] = class_Mains.class_Fields[FindIndex].TrimSign; row["FunctionName"] = class_Mains.class_Fields[FindIndex].FunctionName; row["WhereSelect"] = class_Mains.class_Fields[FindIndex].WhereSelect; row["WhereType"] = class_Mains.class_Fields[FindIndex].WhereType; row["LogType"] = class_Mains.class_Fields[FindIndex].LogType; row["WhereValue"] = class_Mains.class_Fields[FindIndex].WhereValue; row["WhereTrim"] = class_Mains.class_Fields[FindIndex].WhereTrim; row["WhereIsNull"] = class_Mains.class_Fields[FindIndex].WhereIsNull; row["OrderSelect"] = class_Mains.class_Fields[FindIndex].OrderSelect; row["SortType"] = class_Mains.class_Fields[FindIndex].SortType; row["SortNo"] = class_Mains.class_Fields[FindIndex].SortNo; row["GroupSelect"] = class_Mains.class_Fields[FindIndex].GroupSelect; row["HavingSelect"] = class_Mains.class_Fields[FindIndex].HavingSelect; row["HavingFunction"] = class_Mains.class_Fields[FindIndex].HavingFunction; row["HavingCondition"] = class_Mains.class_Fields[FindIndex].HavingCondition; row["HavingValue"] = class_Mains.class_Fields[FindIndex].HavingValue; IsDefault = false; } } if (IsDefault) { row["SortType"] = "升序"; row["LogType"] = "="; row["WhereType"] = "AND"; row["WhereValue"] = "参数"; row["ParaName"] = Class_Tool.GetFirstCodeLow(row["FieldName"].ToString()); row["MaxLegth"] = row["FieldLength"]; row["ReturnType"] = row["FieldType"]; row["SortNo"] = Counter++; } } break; case "insert": break; case "update": break; case "delete": break; default: break; } } row.EndEdit(); } if (dataTable.GetChanges() != null) { dataTable.AcceptChanges(); } return(dataTable); } else { return(null); } } catch (Exception e) { throw e; } finally { dataTable.Dispose(); } }
public string GetVueLower(string Content) { return(Class_Tool.GetVueString(Content)); }