private static void load_commit_test(PrjManager manager) { Prj_Sheet sheet = manager.SheetCRUD.Load_Sheet(2316); Prj_Sheet backup = ObjectCopier.Clone(sheet); Cld_FCBlock block = sheet.New_Cld_FCBlock(); block.AlgName = "added"; block.Sequence = 12; Cld_FCInput inpt = block.New_FCInput(); inpt.Description = "added desc"; inpt.PinName = "for test"; Cld_FCOutput output = block.New_FCOutput(); output.PinName = "for test output"; SheetDiffer diff = manager.SheetCRUD.CompareSheet(backup, sheet); manager.SheetCRUD.Commit_Sheet(diff); }
static void Main() { SessionManager sessionmanager = new SessionManager("hibernate_config.xml"); ISession session = sessionmanager.GetSession(); // 相关操作的接口 PrjManager manager = new PrjManager(session); //add your code bellow TDK.Core.Logic.URdoLib.URdoManager man = new TDK.Core.Logic.URdoLib.URdoManager(); StateManager sm = new StateManager(); for (int i = 169; i <= 179; i++) { Prj_Sheet sheet = manager.SheetCRUD.Load_Sheet(i, sm); Cld_FCBlock weiyuanke = sheet.New_Cld_FCBlock(); weiyuanke.FunctionName = "fortest"; manager.Save(weiyuanke); Cld_FCInput input = weiyuanke.New_FCInput(); Console.WriteLine(sheet.State); sheet.SheetName = "weiyuantafkjaljfl"; Console.WriteLine(sheet.State); Cld_FCBlock b = sheet.Cld_FCBlock_List[0] as Cld_FCBlock; Console.WriteLine(b.State); sheet.Cld_FCBlock_List.RemoveAt(0); Console.WriteLine(b.State); sheet.Cld_FCBlock_List.Add(b); Console.WriteLine(b.State); Cld_FCBlock temp = sheet.New_Cld_FCBlock(); Console.WriteLine(temp.State); sheet.Cld_FCBlock_List.Add(temp); Console.WriteLine(temp.State); } //GraphicsDocument.GenerateProjects(bll); // 产生xml文件的代码 //Prj_Sheet sheet = bll.manager.SheetCRUD.Load_Sheet(170); //Generate_Sheet_Xml(sheet, bll); //释放相关资源 //bll.Close(); Console.WriteLine("\nPress Enter to Exit !"); Console.ReadKey(); //以下为GUI运行 //Application.EnableVisualStyles(); //Application.SetCompatibleTextRenderingDefault(false); //Application.Run(new Form1()); }