public RecordResultCollection ConvertTableToRecordResult(DataTable table) { var resultList = new RecordResultCollection(); var parentRows = table.Select("", "全路径 asc"); int sortNumber = 0; foreach (var item in parentRows) { sortNumber++; var result = new RecordResult(); result.SortNo = sortNumber; result.EntityName = Convert.ToString(item["实体名"]); result.EntityDesc = Convert.ToString(item["实体名"]); result.TempFullPath = Convert.ToString(item["全路径"]); result.DefaultValue = Convert.ToString(item["默认值"]); //result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false; result.FieldName = Convert.ToString(item["字段名"]); int fileLenth = Convert.ToInt32(item["字段长度"]); result.FieldType = SAPFileMapping.SAPFiledTypeToUEPFiledType(Convert.ToString(item["字段类型"]), ref fileLenth); item["字段长度"] = fileLenth; result.FieldDesc = Convert.ToString(item["字段描述"]); result.FieldLength = int.Parse(Convert.ToString(item["字段长度"])); result.DecimalLength = int.Parse(Convert.ToString(item["字段小数长度"])); result.IsStruct = item["字段类型"].ToString().Equals("STRUCTURE"); if (table.Columns.Contains("参数标识")) { switch (item["参数标识"].ToString()) { case "输入": result.ParamDirection = ParamDirectionEnum.Import; break; case "输出": result.ParamDirection = ParamDirectionEnum.Export; break; default: result.ParamDirection = ParamDirectionEnum.NotKnown; break; } } resultList.Add(result); } return(resultList); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Saplocalhost.WebServiceConnectSAP srv = new Saplocalhost.WebServiceConnectSAP(); var srv = new WebServiceConnectSAPSoapClient(); DataTable table = srv.GetEntityDefine("ZR521"); GridView1.DataSource = table; foreach (DataRow item in table.Rows) { string fileType = Convert.ToString(item["字段类型"]); int fileLenth = Convert.ToInt32(item["字段长度"]); SAPFileMapping.SAPFiledTypeToUEPFiledType(Convert.ToString(item["字段类型"]), ref fileLenth); item["字段类型"] = fileType; item["字段长度"] = fileLenth; } GridView1.DataBind(); } }
public ETLSapTableResultCollection GetDatas(DataTable table) { ETLSapTableResultCollection resultList = new ETLSapTableResultCollection(); var parentRows = table.Select(); int sortNumber = 0; foreach (var item in parentRows) { sortNumber++; ETLSapTableResult result = new ETLSapTableResult(); result.SortNo = sortNumber; result.EntityName = Convert.ToString(item["实体名"]); result.EntityDesc = Convert.ToString(item["实体描述"]); result.DefaultValue = Convert.ToString(item["默认值"]); result.IsMasterTable = Convert.ToString(item["主子标识"]) == "主" ? true : false; result.FieldName = Convert.ToString(item["字段名"]); result.IsPrimaryKey = bool.Parse(Convert.ToString(item["主键"])); if (result.IsPrimaryKey) { result.IsEnable = true; } int fileLenth = Convert.ToInt32(item["字段长度"]); result.FieldType = SAPFileMapping.SAPFiledTypeToUEPFiledType(Convert.ToString(item["字段类型"]), ref fileLenth);; item["字段长度"] = fileLenth; result.FieldDesc = Convert.ToString(item["字段描述"]); result.FieldLength = int.Parse(Convert.ToString(item["字段长度"])); resultList.Add(result); } return(resultList); }