public bool UpdateCatOutData(Guid EXCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbTransaction aTransaction; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { CatOutPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); if (!UseAccess) { if (!ECatOut.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eCatOut.AccessInsert failed"); } //if (!Atend.Base.Equipment.EOperation.SentFromLocalToAccess(ECatOut.XCode, (int)Atend.Control.Enum.ProductType.CatOut, ECatOut.Code, aTransaction, aConnection)) //{ // throw new System.Exception("operation failed"); //} } CatOutPack.IsExistance = Existance; CatOutPack.ProjectCode = ProjectCode; CatOutPack.ProductCode = ECatOut.Code; CatOutPack.Number = ""; if (CatOutPack.AccessUpdate(aTransaction, aConnection)) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId); atinfo.ProductCode = ECatOut.Code; atinfo.Insert(); } else { throw new System.Exception("CatOutPack.AccessInsert2 failed"); } if (!DKeyStatus.Update(aTransaction, aConnection)) { throw new System.Exception("dkeystatus.Update Failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateCatOut 01(transaction) : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateCatOut 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); return(true); }
private bool SaveCatOutData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; //ed.WriteMessage("~~~~~~~~~~~~~ Start Catout Save Data ~~~~~~~~~~~~~~\n"); try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { if (!UseAccess) { if (!ECatOut.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eCatOut.AccessInsert failed"); } } CatOutPack = new Atend.Base.Design.DPackage(); CatOutPack.Count = 1; CatOutPack.IsExistance = Existance; CatOutPack.ProductCode = ECatOut.Code; CatOutPack.Type = (int)Atend.Control.Enum.ProductType.CatOut; CatOutPack.ParentCode = Guid.Empty; CatOutPack.NodeCode = Guid.Empty; CatOutPack.LoadCode = 0; CatOutPack.Number = "Catout"; CatOutPack.ProjectCode = ProjectCode; if (!CatOutPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("dPack.AccessInsert failed"); } DKeyStatus = new Atend.Base.Design.DKeyStatus(); DKeyStatus.NodeCode = CatOutPack.Code; DKeyStatus.Type = (int)Atend.Control.Enum.ProductType.CatOut; DKeyStatus.IsClosed = false; if (!DKeyStatus.Insert(aTransaction, aConnection)) { throw new System.Exception("DKeyStatus.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveCatOutData 02 :{0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveCatOutData 01 :{0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.CatOutData.UseAccess = true; //UseAccess = true; #endregion //ed.WriteMessage("~~~~~~~~~~~~~ End Catout Save Data ~~~~~~~~~~~~~~\n"); return(true); }