public void saveData(FBSmartHelp model) { try { base.Db.BeginTransaction(); base.Db.Save <FBSmartHelp>(model); base.Db.Execute(new Sql(@" delete from FBSmartHelpCols where HelpID =@0 ", model.ID)); int i = 1; foreach (FBSmartHelpCols col in model.ColList) { if (string.IsNullOrEmpty(col.ID)) { col.ID = Guid.NewGuid().ToString(); } col.HelpID = model.ID; col.Ord = i.ToString(); base.Db.Save <FBSmartHelpCols>(col); i++; } saveDependence(model.ID, base.Db); FBMeta.UpdateMeataInfo(model.Name, model.Code, model.ID, base.Db);//更新元数据编号 this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void saveData(FBDataSource model) { try { base.Db.BeginTransaction(); base.Db.Save <FBDataSource>(model); base.Db.Execute(new Sql(@" delete from FBDataSourceCols where DSID =@0 ", model.ID)); foreach (FBDataSourceCols col in model.ColList) { if (string.IsNullOrEmpty(col.ID)) { col.ID = Guid.NewGuid().ToString(); } col.DSID = model.ID; base.Db.Save <FBDataSourceCols>(col); } FBMeta.UpdateMeataInfo(model.Name, model.Code, model.ID, base.Db);//更新元数据编号 this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
/// <summary> /// 列表删除模型 /// </summary> /// <param name="ModelID"></param> public void DeleteModelInfo(string ModelID) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(ModelID, base.Db); FBMeta.DeleteMetaData(ModelID, base.Db);//删除元数据 Sql sql = new Sql(@"delete from FBDataModel where ID=@0", ModelID); base.Db.Execute(sql); sql = new Sql(@"delete from FBMetaData where ID=@0", ModelID); base.Db.Execute(sql); sql = new Sql(@"delete from FBDataModelObjects where ModelID=@0", ModelID); base.Db.Execute(sql); sql = new Sql(@"delete from FBDataModelCols where ModelID=@0", ModelID); base.Db.Execute(sql); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void addData(FBComponent model) { try { this.Db.BeginTransaction(); base.Db.Save <FBComponent>(model);// 保存数据 明细表数据 FBMeta.AddMeataData(model.ID, model.Code, model.Name, "6", model.parentID, base.Db); this.Db.CompleteTransaction(); } catch (Exception ex) { this.Db.AbortTransaction(); throw ex; } }
public void addData(FBDataSource model) { try { this.Db.BeginTransaction(); base.Db.Save <FBDataSource>(model); FBMeta.AddMeataData(model.ID, model.Code, model.Name, "5", model.parentID, base.Db); this.Db.CompleteTransaction(); } catch (Exception ex) { this.Db.AbortTransaction(); throw ex; } }
public void deleteData(string helpid) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(helpid, base.Db); FBMeta.DeleteMetaData(helpid, base.Db);//删除元数据 base.Db.Execute(new NPoco.Sql("delete from FBSmartHelp where id=@0", helpid)); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void DeleteObject(string ID) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(ID, base.Db); FBMeta.DeleteMetaData(ID, base.Db); base.Db.Execute(new NPoco.Sql("delete from FBDataObject where id=@0", ID)); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void SaveAttr(FBDataModel model) { try { base.Db.BeginTransaction(); base.Db.Save <FBDataModel>(model); FBMeta.UpdateMeataInfo(model.Name, model.Code, model.ID, base.Db);//更新元数据编号 this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void AddObject(FBDataObject model) { try { base.Db.BeginTransaction(); FBMeta.AddMeataData(model.ID, model.Code, model.AiasName, "0", model.ParentID, base.Db); base.Save(model); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
/// <summary> /// 删除数据 /// </summary> /// <param name="id"></param> public void DeleteData(string id) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(id, base.Db); FBMeta.DeleteMetaData(id, base.Db); base.Remove(new NPoco.Sql("delete from FBDataObject where id=@id", id)); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
/// <summary> /// 删除自定义数据源 /// </summary> /// <param name="id"></param> public void deleteData(string id) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(id, base.Db); FBMeta.DeleteMetaData(id, base.Db);//删除元数据 base.Db.Execute(new NPoco.Sql("delete from FBDataSource where id=@0", id)); base.Db.Execute(new NPoco.Sql("delete from FBDataSourceCols where DSID=@0", id)); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
/// <summary> /// 删除表单 /// </summary> /// <param name="frmID"></param> public void deleteData(string frmID) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(frmID, base.Db); FBMeta.DeleteMetaData(frmID, base.Db);//删除元数据 base.Db.Execute(new NPoco.Sql("delete from FBForm where id=@0", frmID)); base.Db.Execute(new NPoco.Sql("delete from FBFormDS where FormID=@0", frmID)); base.Db.Execute(new NPoco.Sql("delete from FBFormToolBar where FormID=@0", frmID)); base.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
private void saveDependence(string ID, Database db) { var sql = new Sql(@" select ModelID from FBSmartHelp where ID=@0 ", ID); List <string> list = db.Fetch <string>(sql); List <FBMetaDependence> listSave = new List <FBMetaDependence>(); foreach (var item in list) { FBMetaDependence model = new FBMetaDependence(); model.SourceID = ID; model.TargetID = item.ToString(); listSave.Add(model); } FBMeta.SaveDependence(ID, listSave, db); }
/// <summary> /// 删除自定义数据源 /// </summary> /// <param name="id"></param> public void deleteData(string id) { try { base.Db.BeginTransaction(); FBMeta.deleteCheck(id, base.Db); FBMeta.DeleteMetaData(id, base.Db);//删除元数据 base.Db.Execute(new NPoco.Sql("delete from FBComponent where ID=@0", id)); base.Db.Execute(new NPoco.Sql("delete from FBCMPMethod where CMPID=@0", id)); base.Db.Execute(new NPoco.Sql("delete from FBCMPPara where CMPID=@0", id)); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
private void saveDependence(string ModelID, Database db) { var sql = new Sql(@" select ObjectID from FBDataModelObjects where ModelID=@0 union all select ObjectID from FBDataModelRealtions where ModelID = @0", ModelID); List <string> list = db.Fetch <string>(sql); List <FBMetaDependence> listSave = new List <FBMetaDependence>(); foreach (var item in list) { FBMetaDependence model = new FBMetaDependence(); model.SourceID = ModelID; model.TargetID = item.ToString(); listSave.Add(model); } FBMeta.SaveDependence(ModelID, listSave, db); }
public void saveData(FBComponent model) { try { base.Db.BeginTransaction(); base.Db.Save <FBComponent>(model); base.Db.Execute(new Sql(@" delete from FBCMPMethod where CMPID =@0 ", model.ID)); foreach (FBCMPMethod col in model.MethodList) { if (string.IsNullOrEmpty(col.ID)) { col.ID = Guid.NewGuid().ToString(); } col.CMPID = model.ID; base.Db.Save <FBCMPMethod>(col); base.Db.Execute(new Sql(@" delete from FBCMPPara where MethodID =@0 ", col.ID)); foreach (FBCMPPara para in col.ParaList) { if (string.IsNullOrEmpty(para.ID)) { para.ID = Guid.NewGuid().ToString(); } para.CMPID = model.ID; para.MethodID = col.ID; base.Db.Save <FBCMPPara>(para); } } FBMeta.UpdateMeataInfo(model.Name, model.Code, model.ID, base.Db);//更新元数据编号 this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void AddData(FBDataObject model) { try { base.BeginTransaction(); if (string.IsNullOrEmpty(model.TableName)) { model.TableName = model.Code; } base.Save(model); var list = model.ColList; if (string.IsNullOrEmpty(model.ID)) { model.ID = Guid.NewGuid().ToString(); } base.Db.Execute(new Sql("delete from FBDataObjectCols where ObjectID=@0", model.ID)); int i = 0; foreach (FBDataObjectCols col in list) { if (string.IsNullOrEmpty(col.ID)) { col.ID = Guid.NewGuid().ToString(); col.ObjectID = model.ID; } col.Ord = i.ToString(); i++; this.Db.Save <FBDataObjectCols>(col); } FBMeta.UpdateMeataInfo(model.AiasName, model.Code, model.ID, base.Db);//更新元数据编号 this.CompleteTransaction(); } catch (Exception ex) { this.AbortTransaction(); throw ex; } }
private void saveDependence(string frmID, string modelID, List <string> list, Database db) { if (!string.IsNullOrEmpty(modelID)) { list.Add(modelID); } List <FBMetaDependence> listSave = new List <FBMetaDependence>(); var sql = new Sql("select DSID from FBFormDS where FormID=@0", frmID); var list1 = db.Fetch <string>(sql); list = list.Union(list1).ToList <string>(); //剔除重复项 foreach (var item in list) { FBMetaDependence model = new FBMetaDependence(); model.SourceID = frmID; model.TargetID = item.ToString(); listSave.Add(model); } FBMeta.SaveDependence(frmID, listSave, db); }
public void moveMetaData(List <string> data, string targetID) { FBMeta.MoveMetaData(data, targetID, base.Db); }
public void renameFolder(string name, string id) { FBMeta.UpdateFolderName(name, id, base.Db); }
public void deleteMeta(string id) { FBMeta.DeleteMetaData(id, base.Db); }
public void AddModel(FBDataModel model) { try { base.Db.BeginTransaction(); //保存元数据 FBMetaData meta = new FBMetaData(); meta.ID = model.ID; meta.Type = "2"; meta.State = "1"; meta.Name = model.Name; meta.Code = model.Code; base.Db.Save <FBMetaData>(meta); //保存数据模型 base.Save(model); //获取数据对象信息 FBDataObject obj = new FBDataObject(); FBDataObjectService svr = new FBDataObjectService(this.context); List <FBDataObjectCols> list = new List <FBDataObjectCols>(); list = svr.GetColumn(model.MainObectID); obj = svr.GetModel(model.MainObectID); //保存主对象 FBDataModelObjects modelmain = new FBDataModelObjects(); modelmain.ID = Guid.NewGuid().ToString(); modelmain.ModelID = model.ID; modelmain.Code = obj.Code; modelmain.Name = obj.AiasName; modelmain.ObjectID = model.MainObectID; var listres = list.Where(p => p.IsPrimary == "1").ToList(); if (listres.Count <= 0) { throw new Exception("数据对象必须定义一个主键!"); } modelmain.PKCOLName = list.Where(p => p.IsPrimary == "1").ToList()[0].Code; modelmain.Level = "1"; modelmain.isMain = "1"; modelmain.Label = obj.Code; modelmain.ParentID = ""; base.Db.Save <FBDataModelObjects>(modelmain);//保存列信息 //保存子对象 foreach (FBDataObjectCols col in list) { FBDataModelCols mcol = new FBDataModelCols(); mcol.ID = Guid.NewGuid().ToString(); mcol.Code = col.Code; mcol.Name = col.Name; mcol.ModelID = model.ID; mcol.ModelObjectID = modelmain.ID; mcol.Label = col.Code; mcol.isCard = "1"; mcol.isList = "1"; mcol.isReadOnly = "0"; mcol.isRelated = "0"; mcol.isUpdate = "1"; mcol.isVirtual = "0"; mcol.VirtualExpress = ""; mcol.RelationID = ""; mcol.ParentID = ""; mcol.Length = col.Length.ToString(); mcol.DataType = col.DataType; mcol.isPrimary = col.IsPrimary; mcol.Ord = col.Ord; Db.Save <FBDataModelCols>(mcol); } FBMeta.AddMeataData(model.ID, model.Code, model.Name, "1", model.parentID, base.Db); this.Db.CompleteTransaction(); } catch (Exception ex) { base.Db.AbortTransaction(); throw ex; } }
public void addFolder(FBMetaData model) { FBMeta.AddMeataData(model, base.Db); }