public bool UpdateRodData(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 { RodPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); //ed.WriteMessage("**RodPAck.Code={0}\n",RodPack.Code); if (!UseAccess) { if (!ERod.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eRod.AccessInsert failed"); } } RodPack.IsExistance = Existance; RodPack.ProductCode = ERod.Code; RodPack.ProjectCode = ProjectCode; RodPack.Number = ""; if (RodPack.AccessUpdate(aTransaction, aConnection)) { //ed.WriteMessage("ERod.Code={0},SelectedRod.ObjId={1}\n",ERod.Code,selectedObjectId); Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);// id); atinfo.ProductCode = ERod.Code; atinfo.Insert(); ChangeComment(selectedObjectId, ERod.Comment); } else { throw new System.Exception("RodPack.AccessInsert2 failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR Updaterod 01(transaction) : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateRod 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); return(true); }
public bool UpdateLightData(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 { LightPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); if (!UseAccess) { if (!eLight.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eLight.AccessInsert failed"); } } LightPack.IsExistance = Existance; LightPack.ProjectCode = ProjectCode; LightPack.ProductCode = eLight.Code; LightPack.Number = ""; if (LightPack.AccessUpdate(aTransaction, aConnection)) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId); atinfo.ProductCode = eLight.Code; atinfo.Insert(); ChangeComment(Atend.Global.Acad.UAcad.GetEntityGroup(selectedObjectId), eLight.Comment); } else { throw new System.Exception("LightPack.AccessInsert2 failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateLight 01(transaction) : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateLight 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); return(true); }
public bool UpdateKalampData(Guid NodeCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { ClampPack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (!UseAccess) { if (!eClamp.AccessInsert(aTransaction, aConnection, true, true))//aTransaction, aConnection))?? { throw new System.Exception("eClamp.AccessInsert failed"); } } ClampPack.IsExistance = Existance; ClampPack.ProductCode = eClamp.Code; ClampPack.ProjectCode = ProjectCode; if (ClampPack.AccessUpdate()) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId); atinfo.ProductCode = eClamp.Code; atinfo.Insert(); } else { throw new System.Exception("ClampPack.AccessInsert2 failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateKalampData 01 : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateKalampData 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); return(true); }
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 UpdateStreetBoxData(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 { StreetBoxPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); if (!UseAccess) { if (!eStreetBox.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eStreetBox.AccessInsert failed"); } else { foreach (Atend.Base.Equipment.EStreetBoxPhuse sbPhuses in eStreetBoxPhuse) { if (!sbPhuses.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eStreetBoxPhuse.AccessInsert failed"); } } } foreach (Atend.Base.Equipment.EStreetBoxPhuse SelectedStreetBoxPhuse in eStreetBoxPhuse) { Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(SelectedStreetBoxPhuse.PhuseXCode); if (phuse.Code != -1) { if (!phuse.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("ePhuse.AccesInsert failed"); } SelectedStreetBoxPhuse.PhuseCode = phuse.Code; SelectedStreetBoxPhuse.StreetBoxCode = eStreetBox.Code; if (!SelectedStreetBoxPhuse.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("EStreetBoxPhuseInsert failed"); } } else { throw new System.Exception("EPhuse.SelectByXCode failed"); } } } StreetBoxPack.IsExistance = Existance; StreetBoxPack.ProductCode = eStreetBox.Code; StreetBoxPack.ProjectCode = ProjectCode; StreetBoxPack.Number = ""; if (StreetBoxPack.AccessUpdate(aTransaction, aConnection)) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId); atinfo.ProductCode = eStreetBox.Code; atinfo.Insert(); } else { throw new System.Exception("StreetBoxPack.AccessInsert2 failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateStreetBox 01(transaction) : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateStreetBox 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); DeleteStreetBox(selectedObjectId); DrawStreetBoxUpdate(); aConnection.Close(); return(true); }
public bool UpdateKhazanData(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 { try { KhazanPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode); if (!UseAccess) { if (!eKhazanTip.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("KhazanTip.Insert failed"); } } KhazanPack.IsExistance = Existance; KhazanPack.ProjectCode = ProjectCode; KhazanPack.ProductCode = eKhazanTip.Code; KhazanPack.Number = ""; if (KhazanPack.AccessUpdate(aTransaction, aConnection)) { Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId); atinfo.ProductCode = eKhazanTip.Code; atinfo.Insert(); //Atend.Global.Acad.UAcad.ChangeMText(selectedObjectId, eKhazanTip.Name); ChangeComment(selectedObjectId, eKhazanTip.Description); } else { throw new System.Exception("KhazanPack.AccessInsert2 failed"); } //++++++++++++++++++++++++++++++ if (!UseAccess) { //WENT TO //if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToAccess(eKhazanTip.XCode, (int)Atend.Control.Enum.ProductType.BankKhazan, eKhazanTip.Code, aTransaction, aConnection)) //{ // throw new System.Exception("SentFromLocalToAccess failed"); //} } //++++++++++++++++++++++++++++++ } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateKhazanData(transaction) 001 : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR UpdateKhazanData(transaction) 01 : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR UpdateKhazanData 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); }