public bool UpdatebreakerData(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 { BreakerPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); if (!UseAccess) { if (!eBreaker.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eBreaker.AccessInsert failed"); } //if (!Atend.Base.Equipment.EOperation.SentFromLocalToAccess(eBreaker.XCode, (int)Atend.Control.Enum.ProductType.Breaker, eBreaker.Code, aTransaction, aConnection)) //{ // throw new System.Exception("operation failed"); //} } BreakerPack.IsExistance = Existance; BreakerPack.ProductCode = eBreaker.Code; BreakerPack.ProjectCode = ProjectCode; BreakerPack.Number = ""; if (BreakerPack.AccessUpdate(aTransaction, aConnection)) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);// id); atinfo.ProductCode = eBreaker.Code; atinfo.Insert(); ChangeComment(Atend.Global.Acad.UAcad.GetEntityGroup(selectedObjectId), eBreaker.Comment); } else { throw new System.Exception("BreakerPack.AccessInsert2 failed"); } if (!DKeyStatus.Update(aTransaction, aConnection)) { throw new System.Exception("dKeyStatus.AccessUpdate Failed"); } if (!UseAccess) { //if (Br.Code == -1) //{ //WENT TO //if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToAccess(eBreaker.XCode, (int)Atend.Control.Enum.ProductType.Breaker, eBreaker.Code, aTransaction, aConnection)) //{ // throw new System.Exception("SentFromLocalToAccess failed"); //} //} } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateBreaker 01(transaction) : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateBreaker 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); return(true); }
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); }