private WRComponentModel AssemblyWRComponentModel(DataRow row) { WRComponentModel model = new WRComponentModel(); model.ID = row["modelid"].ToString(); model.Name = row["modelname"].ToString(); int order = -1; string orderStr = Convert.ToString(row["modelorder"]); if (!string.IsNullOrWhiteSpace(orderStr)) { int.TryParse(orderStr, out order); } model.Order = order; model.WorkReportType = new WRType() { ID = row["wrtypeid"].ToString(), Code = row["wrtypecode"].ToString(), Name = row["wrtypename"].ToString() }; model.ModelType = new ModelType() { ID = row["modeltypeid"].ToString(), Code = row["modeltypecode"].ToString(), Name = row["modeltypename"].ToString() }; return(model); }
private WRComponent AssamblyComponent(IDataReader reader) { WRComponentModel model = new WRComponentModel(); model.ID = reader["modelid"].ToString(); model.Name = reader["modelname"].ToString(); int order = -1; string orderStr = Convert.ToString(reader["modelorder"]); if (!string.IsNullOrWhiteSpace(orderStr)) { int.TryParse(orderStr, out order); } model.Order = order; model.WorkReportType = new WRType() { ID = reader["wrtypeid"].ToString(), Code = reader["wrtypecode"].ToString(), Name = reader["wrtypename"].ToString() }; model.ModelType = new ModelType() { ID = reader["modeltypeid"].ToString(), Code = reader["modeltypecode"].ToString(), Name = reader["modeltypename"].ToString() }; WRComponent comp = new WRComponent() { ID = reader["id"].ToString(), Content = reader["content"].ToString(), Model = model }; return(comp); }