private bool SaveBreakerData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { if (!UseAccess) { if (!eBreaker.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eBreaker.AccessInsert failed"); } } BreakerPack = new Atend.Base.Design.DPackage(); BreakerPack.Count = 1; BreakerPack.IsExistance = Existance; BreakerPack.ProductCode = eBreaker.Code; BreakerPack.Type = (int)Atend.Control.Enum.ProductType.Breaker; BreakerPack.ParentCode = Guid.Empty; BreakerPack.NodeCode = Guid.Empty; BreakerPack.LoadCode = 0; BreakerPack.Number = ""; BreakerPack.ProjectCode = ProjectCode; if (!BreakerPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("dPack.AccessInsert failed"); } DKeyStatus = new Atend.Base.Design.DKeyStatus(); DKeyStatus.NodeCode = BreakerPack.Code; DKeyStatus.Type = (int)Atend.Control.Enum.ProductType.Breaker;; DKeyStatus.IsClosed = false; if (!DKeyStatus.Insert(aTransaction, aConnection)) { throw new System.Exception("DKeyStatus.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveBreakerData 02 :{0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveBreakerData 01 :{0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.BreakerData.UseAccess = true; //UseAccess = true; #endregion return(true); }
private bool SaveMeasuredJackPanelData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { if (!UseAccess) { if (!eMeasuredJackPanel.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eMeasuredJackPanel.AccessInsert failed"); } //WENT TO //if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToAccess(eMeasuredJackPanel.XCode, (int)Atend.Control.Enum.ProductType.MeasuredJackPanel, eMeasuredJackPanel.Code, aTransaction, aConnection)) //{ // throw new System.Exception("SentFromLocalToAccess failed"); //} } MeasuredPack.Count = 1; MeasuredPack.IsExistance = Existance; MeasuredPack.LoadCode = 0; MeasuredPack.NodeCode = new Guid(); MeasuredPack.Number = "Measured"; MeasuredPack.ParentCode = new Guid(); MeasuredPack.ProductCode = eMeasuredJackPanel.Code; MeasuredPack.ProjectCode = ProjectCode; MeasuredPack.Type = (int)Atend.Control.Enum.ProductType.MeasuredJackPanel; if (!MeasuredPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("MeasuredPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveMeasuredJackPanelData 02: {0}", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveMeasuredJackPanelData 01: {0}", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.UseAccess = true; //UseAccess = true; #endregion return(true); }
//MOUSAVI private bool SaveKablshoData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { if (!UseAccess) { if (!eKablsho.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("EKablsho.AccessInsert failed"); } } KablshoPack = new Atend.Base.Design.DPackage(); KablshoPack.Count = 1; KablshoPack.IsExistance = Existance; KablshoPack.ProductCode = eKablsho.Code; KablshoPack.ProjectCode = ProjectCode; KablshoPack.LoadCode = 0; KablshoPack.Type = (int)Atend.Control.Enum.ProductType.KablSho; Atend.Control.Common.Counters.KablshoCounter++; KablshoPack.Number = string.Format("Kablsho{0}", Atend.Control.Common.Counters.KablshoCounter); if (!KablshoPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("KablshoPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveKablshoData 01 : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveKablshoData 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.KablshoData.UseAccess = true; UseAccess = true; #endregion return(true); }
private bool SaveGroundData(string NodeCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { if (!UseAccess) { if (!eGround.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eGround.AccessInsert failed"); } } //ed.WriteMessage("--->>>>----1\n"); GroundPack.Count = 1; GroundPack.IsExistance = Existance; GroundPack.LoadCode = 0; GroundPack.NodeCode = new Guid(); GroundPack.Number = "GROUND"; ed.WriteMessage("NodeCode:{0}\n", NodeCode); Atend.Base.Design.DPackage TempPackage = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(NodeCode), aTransaction, aConnection); if (TempPackage.Code == Guid.Empty) { TempPackage = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(NodeCode), aTransaction, aConnection); if (TempPackage.Code == Guid.Empty) { throw new System.Exception("GroundPack.AccessSelectByNodeCode failed"); } } GroundPack.ParentCode = TempPackage.Code; GroundPack.ProductCode = eGround.Code; GroundPack.ProjectCode = projectCode; GroundPack.Type = (int)Atend.Control.Enum.ProductType.Ground; if (!GroundPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("GroundPack.AccessInsert failed"); } //ed.WriteMessage("--->>>>----2\n"); } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveGroundData 02 : {0}\n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveGroundData 01 : {0}\n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.GroundData.UseAccess = true; //UseAccess = true; #endregion return(true); }
private bool SaveStreetBoxData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { //Atend.Base.Equipment.EStreetBox sb = Atend.Base.Equipment.EStreetBox.AccessSelectByXCode(eStreetBox.XCode); if (!UseAccess) { //if (sb.Code == -1) { if (!eStreetBox.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eStreetBox.AccessInsert failed"); } } //} //if (!UseAccess) //{ foreach (Atend.Base.Equipment.EStreetBoxPhuse SelectedStreetBoxPhuse in eStreetBoxPhuse) { //ed.WriteMessage("@@{0}\n", SelectedStreetBoxPhuse.PhuseXCode); //ed.WriteMessage("########## SelectedStreetBoxPhuse.PhuseXCode:{0}\n", SelectedStreetBoxPhuse.PhuseXCode); Atend.Base.Equipment.EPhuse phuse = Atend.Base.Equipment.EPhuse.SelectByXCode(SelectedStreetBoxPhuse.PhuseXCode); //ed.WriteMessage("########## phuse.Code:{0}\n", phuse.Code); if (phuse.Code != -1) { Atend.Base.Equipment.EPhusePole _EPhusePole = Atend.Base.Equipment.EPhusePole.SelectByXCode(phuse.PhusePoleXCode); if (_EPhusePole.Code != -1) { //ed.WriteMessage("112\n"); if (!_EPhusePole.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("AccessInsert failed PhusePole"); } } else { throw new System.Exception("Lack of data in StreetBox:Phuse:PhusePole"); } phuse.PhusePoleCode = _EPhusePole.Code; if (!phuse.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("ePhuse.AccesInsert failed"); } SelectedStreetBoxPhuse.PhuseCode = phuse.Code; SelectedStreetBoxPhuse.StreetBoxCode = eStreetBox.Code; //if (sb.Code == -1) // SelectedStreetBoxPhuse.StreetBoxCode = eStreetBox.Code; //else // SelectedStreetBoxPhuse.StreetBoxCode = sb.Code; if (!SelectedStreetBoxPhuse.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("EStreetBoxPhuseInsert failed"); } } else { throw new System.Exception("EPhuse.SelectByXCode failed"); } } } StreetBoxPack = new Atend.Base.Design.DPackage(); StreetBoxPack.Count = 1; StreetBoxPack.IsExistance = Existance; StreetBoxPack.NodeCode = Guid.Empty; StreetBoxPack.Number = "0"; StreetBoxPack.ParentCode = Guid.Empty; StreetBoxPack.ProjectCode = ProjectCode; StreetBoxPack.ProductCode = eStreetBox.Code; //if (sb.Code == -1) // StreetBoxPack.ProductCode = eStreetBox.Code; //else // StreetBoxPack.ProductCode = sb.Code; StreetBoxPack.Type = Convert.ToInt32(Atend.Control.Enum.ProductType.StreetBox); if (!StreetBoxPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("StreetBoxPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveStreetBoxData 02 :{0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveStreetBoxData 01 :{0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.StreetBoxData.UseAccess = true; UseAccess = true; #endregion return(true); }
private bool SaveLightData(Guid ParentCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aconnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aconnection.Open(); aTransaction = aconnection.BeginTransaction(); try { if (!UseAccess) { if (!eLight.AccessInsert(aTransaction, aconnection, true, true)) { throw new System.Exception("eLight.AccessInsert failed"); } } LightPack = new Atend.Base.Design.DPackage(); LightPack.Count = 1; LightPack.IsExistance = Existance; LightPack.LoadCode = 0; LightPack.NodeCode = new Guid(); LightPack.Number = "LIGHT"; LightPack.ParentCode = ParentCode; LightPack.ProductCode = eLight.Code; LightPack.ProjectCode = ProjectCode; LightPack.Type = (int)Atend.Control.Enum.ProductType.Light; if (!LightPack.AccessInsert(aTransaction, aconnection)) { throw new System.Exception("LightPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveLightData 01 :{0} \n", ex1.Message); aTransaction.Rollback(); aconnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveLightData 02 :{0} \n", ex.Message); aconnection.Close(); return(false); } aTransaction.Commit(); aconnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.LightData.UseAccess = true; //UseAccess = true; #endregion return(true); }
private bool SaveKalampData() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { //Atend.Base.Equipment.EClamp cl = Atend.Base.Equipment.EClamp.AccessSelectByXCode(eClamp.XCode); if (!UseAccess) { //if (cl.Code == -1) { if (!eClamp.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eClamp.AccessInsert failed"); } } } //ClampPack = new Atend.Base.Design.DPackage(); ClampPack.Count = 1; ClampPack.IsExistance = Existance; ClampPack.ProjectCode = ProjectCode; ed.WriteMessage("calamp.Isexistance={0}\n", ClampPack.IsExistance); ClampPack.ProductCode = eClamp.Code; //if (cl.Code == -1) // ClampPack.ProductCode = eClamp.Code; //else // ClampPack.ProductCode = cl.Code; ClampPack.Type = (int)Atend.Control.Enum.ProductType.Kalamp; Atend.Control.Common.Counters.ClampCounter++; ClampPack.Number = string.Format("Clamp{0}", Atend.Control.Common.Counters.ClampCounter); if (!ClampPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("ClampPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveKalampData 01 : {0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveKalampData 01 : {0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.ClampData.UseAccess = true; UseAccess = true; #endregion return(true); }
//private bool SaveRodData(string ParentCode) //{ // Guid Code = new Guid(ParentCode); // Atend.Base.Design.DPackage Package = Atend.Base.Design.DPackage.AccessSelectByNodeCode(Code); // Atend.Base.Acad.AcadGlobal.RodData.dPackageForRod.ParentCode = Package.Code; // if (Atend.Base.Acad.AcadGlobal.RodData.dPackageForRod.AccessInsert()) // { // System.Data.DataTable OperationTable = Atend.Base.Equipment.EOperation.SelectByProductCodeType(Atend.Base.Acad.AcadGlobal.RodData.dPackageForRod.ProductCode, Atend.Base.Acad.AcadGlobal.RodData.dPackageForRod.Type); // if (OperationTable.Rows.Count > 0) // foreach (DataRow OperationRow in OperationTable.Rows) // { // //ed.WriteMessage("\n115\n"); // Atend.Base.Design.DPackage P = new Atend.Base.Design.DPackage(); // P.ParentCode = Atend.Base.Acad.AcadGlobal.RodData.dPackageForRod.Code; // P.Type = (int)Atend.Control.Enum.ProductType.Operation; // P.ProductCode = Convert.ToInt32(OperationRow["ProductId"].ToString()); // P.Count = 1; // if (P.AccessInsert()) // { //ed.WriteMessage("\n116\n"); // } // else // throw new System.Exception("Operation Transaction"); // } // else // { // //ed.WriteMessage("\n1167\n"); // } // return true; // } // else // return false; //} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ private bool SaveRodData(string NodeCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction aTransaction; try { aConnection.Open(); aTransaction = aConnection.BeginTransaction(); try { //Atend.Base.Equipment.ERod ro = Atend.Base.Equipment.ERod.AccessSelectByXCode(ERod.XCode); if (!UseAccess) { //if (ro.Code == -1) { if (!ERod.AccessInsert(aTransaction, aConnection, true, true)) { throw new System.Exception("eRod.AccessInsert failed"); } } } Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(NodeCode)); RodPack.Count = 1; RodPack.IsExistance = Existance; RodPack.ProductCode = ERod.Code; //if (ro.Code == -1) // RodPack.ProductCode = ERod.Code; //else // RodPack.ProductCode = ro.Code; RodPack.Type = (int)Atend.Control.Enum.ProductType.Rod; RodPack.ParentCode = dPack.Code; RodPack.LoadCode = 0; RodPack.Number = ""; RodPack.ProjectCode = ProjectCode; if (!RodPack.AccessInsert(aTransaction, aConnection)) { throw new System.Exception("RodPack.AccessInsert failed"); } } catch (System.Exception ex1) { ed.WriteMessage("ERROR SaveRodData 02 :{0} \n", ex1.Message); aTransaction.Rollback(); aConnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("ERROR SaveRodData 01 :{0} \n", ex.Message); aConnection.Close(); return(false); } aTransaction.Commit(); aConnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.RodData.UseAccess = true; //UseAccess = true; #endregion return(true); }
private bool SaveKhazanData(string ParentCode) { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; OleDbConnection aconnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction atransaction; try { aconnection.Open(); atransaction = aconnection.BeginTransaction(); try { //Atend.Base.Equipment.EKhazan kh = Atend.Base.Equipment.EKhazan.AccessSelectByXCode(eKhazanTip.XCode); if (!UseAccess) { if (!eKhazanTip.AccessInsert(atransaction, aconnection, true, true)) { throw new System.Exception("eKhazanTip.AccessInsert failed"); } } Guid Code = new Guid(ParentCode); Atend.Base.Design.DPackage Package = Atend.Base.Design.DPackage.AccessSelectByNodeCode(Code, atransaction, aconnection); KhazanPack.ParentCode = Package.Code; KhazanPack.Type = (int)Atend.Control.Enum.ProductType.BankKhazan; KhazanPack.LoadCode = 0; KhazanPack.IsExistance = Existance; KhazanPack.Number = ""; KhazanPack.ProductCode = eKhazanTip.Code; KhazanPack.ProjectCode = ProjectCode; if (!KhazanPack.AccessInsert(atransaction, aconnection)) { throw new System.Exception("KhazanPack.AccessInsert failed"); } //ed.WriteMessage("~~~~~~~~~~~ SAVE KHAZAN FINISHED ~~~~~~~~~~\n"); } catch (System.Exception ex1) { ed.WriteMessage("SaveKhazanData 02: {0} \n", ex1.Message); atransaction.Rollback(); aconnection.Close(); return(false); } } catch (System.Exception ex) { ed.WriteMessage("SaveKhazanData 01 : {0} \n", ex.Message); aconnection.Close(); return(false); } atransaction.Commit(); aconnection.Close(); #region Not to Get Green Atend.Base.Acad.AcadGlobal.KhazanData.UseAccess = true; //UseAccess = true; #endregion return(true); }