internal void AddWorkReportComps(List <WRComponent> comps, string wrid) { if (comps == null || comps.Count < 1) { return; } for (int i = 0; i < comps.Count; i++) { WRComponent comp = comps[i]; if (string.IsNullOrWhiteSpace(comp.ID)) { comp.ID = Guid.NewGuid().ToString(); } //新增一条数据 var insertStr = $@"INSERT INTO wrcomponents(id, content, wrcomponentmodelid, wrid, tenantid) VALUES ('{comp.ID}', '{comp.Content}', '{comp.Model.ID}', '{wrid}', '{Utils.GetTenantId()}')"; db.ExecSqlStatement(insertStr); } }
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); }