private void btnOk_Click(object sender, EventArgs e) { Atend.Global.Acad.DrawEquips.AcDrawDisConnector DrawDisConnector = new Atend.Global.Acad.DrawEquips.AcDrawDisConnector(); Atend.Base.Design.DKeyStatus keystatus = Atend.Base.Design.DKeyStatus.SelectByNodeCode(NodeCode); if (Validation()) { if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == false) { DrawDisConnector.UseAccess = true; DrawDisConnector.eDisConnector = Atend.Base.Equipment.EDisconnector.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); } else if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value)) { DrawDisConnector.UseAccess = false; DrawDisConnector.eDisConnector = Atend.Base.Equipment.EDisconnector.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawDisConnector.Existance = status.ACode; if (rdbClose.Checked) { keystatus.IsClosed = true; } else { keystatus.IsClosed = false; } DrawDisConnector.DKeyStatus = keystatus; if (cboProjCode.Items.Count == 0) { DrawDisConnector.ProjectCode = 0; } else { DrawDisConnector.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawDisConnector.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); //DrawDisConnector.EXCode = dpack.Code; if (DrawDisConnector.UpdateDisConnectorData(dpack.Code)) { ed.WriteMessage("Update DisConnector Success \n"); AllowToclose = true; this.Close(); } else { AllowToclose = false; } } else { AllowToclose = false; } }
public void BindDataToOwnControl(int Code) { for (int i = 0; i < gvEquipStatus.Rows.Count; i++) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvEquipStatus.Rows[i].Cells[1]; chk.Value = 0; } chkIsDefault.Checked = false; selectedEquipStatus = Code; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Code); txtCode.Text = status.ACode.ToString(); txtName.Text = status.Name; txtPrice.Text = status.PricePercent.ToString(); txtExecutePrice.Text = status.ExecutePricePercent.ToString(); txtWagePrice.Text = status.WagePricePercent.ToString(); if (status.IsDefault) { chkIsDefault.Checked = true; } for (int i = 0; i < gvEquipStatus.Rows.Count; i++) { for (int j = 0; j < status.ArraySub.Count; j++) { if (Convert.ToInt32(status.ArraySub[j].ToString()) == Convert.ToInt32(gvEquipStatus.Rows[i].Cells[0].Value.ToString())) { DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvEquipStatus.Rows[i].Cells[1]; chk.Value = 1; } } } }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; if (Validation()) { List <Atend.Base.Equipment.EDBPhuse> list = new List <Atend.Base.Equipment.EDBPhuse>(); System.Data.DataTable dt; Atend.Global.Acad.DrawEquips.AcDrawDB DrawDB = new Atend.Global.Acad.DrawEquips.AcDrawDB(); if (Convert.ToBoolean(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[5].Value) == false) { DrawDB.UseAccess = true; DrawDB.EDB = Atend.Base.Equipment.EDB.AccessSelectByCode(Convert.ToInt32(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[0].Value.ToString())); dt = Atend.Base.Equipment.EDBPhuse.AccessSelectByDBCode(Convert.ToInt32(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[0].Value.ToString())); foreach (DataRow dr in dt.Rows) { list.Add(Atend.Base.Equipment.EDBPhuse.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()))); } } else if (Convert.ToBoolean(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[5].Value)) { DrawDB.UseAccess = false; DrawDB.EDB = Atend.Base.Equipment.EDB.SelectByXCode(new Guid(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[1].Value.ToString())); dt = Atend.Base.Equipment.EDBPhuse.SelectByDBXCode(new Guid(gvStreetBox.Rows[gvStreetBox.CurrentRow.Index].Cells[1].Value.ToString())); foreach (DataRow dr in dt.Rows) { list.Add(Atend.Base.Equipment.EDBPhuse.SelectByXCode(new Guid(dr["XCode"].ToString()))); } } DrawDB.eDBPhuse = list; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawDB.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawDB.ProjectCode = 0; } else { DrawDB.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawDB.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (DrawDB.UpdateDBData(dpack.Code)) { ed.WriteMessage("Update DB Success \n"); AllowClose = true; this.Close(); } } else { AllowClose = false; } }
private void btnOk_Click_1(object sender, EventArgs e) { Atend.Global.Acad.DrawEquips.AcDrawConductor DrawConductor = new Atend.Global.Acad.DrawEquips.AcDrawConductor(); if (Validation()) { if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[8].Value) == false)//Access { //ed.WriteMessage("Access Update\n"); DrawConductor.UseAccess = true; Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode( Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString())); DrawConductor.eConductorTip = CondTip; } else { //ed.WriteMessage("*******Local Update\n"); DrawConductor.UseAccess = false; DrawConductor.eConductors = new List <Atend.Base.Equipment.EConductor>(); Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode( new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); //ed.WriteMessage("condTip.Name={0}\n", CondTip.Name); DrawConductor.eConductorTip = CondTip; //ed.WriteMessage("CondTip.PhaseProductXCode={0}\n", CondTip.PhaseProductXCode); Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.PhaseProductXCode); //ed.WriteMessage("CondPhase.Name={0}\n", CondPhase.Name); DrawConductor.eConductors.Add(CondPhase); //ed.WriteMessage("***\n"); Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.NeutralProductXCode); DrawConductor.eConductors.Add(CondNeutral); Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.SelectByXCode( CondTip.NightProductXCode); DrawConductor.eConductors.Add(CondNight); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawConductor.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawConductor.ProjectCode = 0; } else { DrawConductor.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawConductor.UpdateConductorData(NodeCode, obj, Convert.ToDouble(txtLenght.Text)); } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.EBus eBus; if (Convert.ToBoolean(gvBus.Rows[gvBus.CurrentRow.Index].Cells["IsSql"].Value) == false)//Access { Atend.Base.Acad.AcadGlobal.BusData.UseAccess = true; eBus = Atend.Base.Equipment.EBus.AccessSelectByCode(Convert.ToInt32(gvBus.Rows[gvBus.CurrentRow.Index].Cells[0].Value)); } else { Atend.Base.Acad.AcadGlobal.BusData.UseAccess = false; eBus = Atend.Base.Equipment.EBus.SelectByXCode(new Guid(gvBus.Rows[gvBus.CurrentRow.Index].Cells[1].Value.ToString())); } if (eBus.Code != -1) { Atend.Base.Acad.AcadGlobal.BusData.eBus = eBus; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.BusData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.BusData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.BusData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawBreaker DrawBreaker = new Atend.Global.Acad.DrawEquips.AcDrawBreaker(); Atend.Base.Design.DKeyStatus keystatus = Atend.Base.Design.DKeyStatus.SelectByNodeCode(NodeCode); if (Validation()) { if (Convert.ToBoolean(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[2].Value) == false) { DrawBreaker.UseAccess = true; DrawBreaker.eBreaker = Atend.Base.Equipment.EBreaker.AccessSelectByCode(Convert.ToInt32(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[1].Value.ToString())); } else if (Convert.ToBoolean(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[2].Value)) { DrawBreaker.UseAccess = false; DrawBreaker.eBreaker = Atend.Base.Equipment.EBreaker.SelectByXCode(new Guid(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[0].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawBreaker.Existance = status.ACode; if (rdbClose.Checked) { keystatus.IsClosed = true; } else { keystatus.IsClosed = false; } DrawBreaker.DKeyStatus = keystatus; if (cboProjCode.Items.Count == 0) { DrawBreaker.ProjectCode = 0; } else { DrawBreaker.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawBreaker.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (DrawBreaker.UpdatebreakerData(dpack.Code)) { ed.WriteMessage("Update Breaker Success \n"); AllowClose = true; this.Close(); } } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.EHeaderCabel Header; if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[3].Value) == false)//Access { //MessageBox.Show("لطفا هادی دیگری انتخاب کنید", "انتخاب هادی صحیح نمی باشد ", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); Atend.Base.Acad.AcadGlobal.HeaderCableData.UseAccess = true; Header = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode( Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value)); } else { Atend.Base.Acad.AcadGlobal.HeaderCableData.UseAccess = false; Header = Atend.Base.Equipment.EHeaderCabel.SelectByXCode( new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Acad.AcadGlobal.HeaderCableData.eHeaderCable = Header; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.HeaderCableData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.HeaderCableData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.HeaderCableData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.EBreaker breaker; bool useAccess = false; if (Convert.ToBoolean(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[2].Value) == false) { ed.WriteMessage("selected breaker code: {0} \n", gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[1].Value.ToString()); breaker = Atend.Base.Equipment.EBreaker.AccessSelectByCode(Convert.ToInt32(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[1].Value.ToString())); useAccess = true; } else { ed.WriteMessage("selected breaker Xcode: {0} \n", gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[0].Value.ToString()); breaker = Atend.Base.Equipment.EBreaker.SelectByXCode(new Guid(gvBreaker.Rows[gvBreaker.CurrentRow.Index].Cells[0].Value.ToString())); useAccess = false; } Atend.Base.Acad.AcadGlobal.BreakerData.UseAccess = useAccess; Atend.Base.Acad.AcadGlobal.BreakerData.eBreaker = breaker; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.BreakerData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.BreakerData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.BreakerData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.ERod rod; bool useAccess = false; //int Existance = 0; if (Convert.ToBoolean(gvRod.Rows[gvRod.CurrentRow.Index].Cells[2].Value) == false) { rod = Atend.Base.Equipment.ERod.AccessSelectByCode(Convert.ToInt32(gvRod.Rows[gvRod.CurrentRow.Index].Cells[1].Value.ToString())); useAccess = true; } else { rod = Atend.Base.Equipment.ERod.SelectByXCode(new Guid(gvRod.Rows[gvRod.CurrentRow.Index].Cells[0].Value.ToString())); useAccess = false; } Atend.Base.Acad.AcadGlobal.RodData.UseAccess = useAccess; Atend.Base.Acad.AcadGlobal.RodData.eRod = rod; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.RodData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.RodData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.RodData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.EMeasuredJackPanel MeasuredJackPanel = new Atend.Base.Equipment.EMeasuredJackPanel(); bool useAccess = false; if (Convert.ToBoolean(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[4].Value) == false) { MeasuredJackPanel = Atend.Base.Equipment.EMeasuredJackPanel.AccessSelectByCode(Convert.ToInt32(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[0].Value.ToString())); useAccess = true; } else if (Convert.ToBoolean(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[4].Value) == true) { MeasuredJackPanel = Atend.Base.Equipment.EMeasuredJackPanel.SelectByXCode(new Guid(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[1].Value.ToString())); useAccess = false; } Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.eMeasuredJackPanel = MeasuredJackPanel; Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.UseAccess = useAccess; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist1.SelectedValue)); Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.Existance = status.ACode; if (cboProjCode1.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.MeasuredJackPanelData.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist1.SelectedValue.ToString()); if (cboProjCode1.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { //Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper DrawSelfKeeper = new Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper(); if (Validation()) { if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value) == false) { DrawSelfKeeper.UseAccess = true; DrawSelfKeeper.eSelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value)) { DrawSelfKeeper.UseAccess = false; Atend.Base.Equipment.ESelfKeeperTip selfkeepertip = new Atend.Base.Equipment.ESelfKeeperTip(); ed.WriteMessage("SelectByXCode={0}\n", gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString()); selfkeepertip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString())); DrawSelfKeeper.eSelfKeeperTip = selfkeepertip; ed.WriteMessage("SelefKipperTip.XCOde={0}\n", selfkeepertip.XCode); List <Atend.Base.Equipment.ESelfKeeper> list = new List <Atend.Base.Equipment.ESelfKeeper>(); list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.PhaseProductxCode)); list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NeutralProductxCode)); list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NightProductxCode)); DrawSelfKeeper.eSelfKeepers = list; } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawSelfKeeper.Existance = status.ACode; if (cboProject.Items.Count == 0) { DrawSelfKeeper.ProjectCode = 0; } else { DrawSelfKeeper.ProjectCode = Convert.ToInt32(cboProject.SelectedValue); } DrawSelfKeeper.SelectedObjectId = BranchObj; DrawSelfKeeper.UpdateSelfKeeperData(Convert.ToDouble(txtLenght.Text), BranchCode); //if (DrawSelfKeeper.UpdateSelfKeeperData()) // ed.WriteMessage("Update SelfKeeper Success \n"); } }
private void btnOK_Click(object sender, EventArgs e) { if (Validation()) { Atend.Global.Acad.DrawEquips.AcDrawConsol DrawConsol = new Atend.Global.Acad.DrawEquips.AcDrawConsol(); if (Convert.ToBoolean(gvConsol.SelectedRows[0].Cells["IsSql"].Value)) { DrawConsol.UseAccess = false; DrawConsol.eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(gvConsol.SelectedRows[0].Cells[0].Value.ToString())); } else { DrawConsol.UseAccess = true; DrawConsol.eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(gvConsol.SelectedRows[0].Cells["IsSql"].Value)); } DrawConsol.ConsolConut = Convert.ToInt32(txtCount.Text); Atend.Base.Base.BEquipStatus statusConsol = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(CboIsExist.SelectedValue)); DrawConsol.Existance = statusConsol.ACode; if (CboProjCode.Items.Count == 0) { DrawConsol.ProjectCode = 0; } else { DrawConsol.ProjectCode = Convert.ToInt32(CboProjCode.SelectedValue); } if (!DrawConsol.UpdateConsolData(NodeCode, obj)) { ed.WriteMessage("ویرایش اطلاعات با موفقیت انجام نشد\n"); } else { AllowClose = true; Close(); } } }
private void btnOk_Click_1(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; if (Validation()) { Atend.Global.Acad.DrawEquips.AcDrawMeasuredJackPanel MeasuredJackPanel = new Atend.Global.Acad.DrawEquips.AcDrawMeasuredJackPanel(); if (Convert.ToBoolean(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[4].Value) == false) { MeasuredJackPanel.UseAccess = true; MeasuredJackPanel.eMeasuredJackPanel = Atend.Base.Equipment.EMeasuredJackPanel.AccessSelectByCode(Convert.ToInt32(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[4].Value)) { MeasuredJackPanel.UseAccess = false; MeasuredJackPanel.eMeasuredJackPanel = Atend.Base.Equipment.EMeasuredJackPanel.SelectByXCode(new Guid(gvMeasuredJackPanel.Rows[gvMeasuredJackPanel.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist1.SelectedValue)); MeasuredJackPanel.Existance = status.ACode; if (cboProjCode1.Items.Count == 0) { MeasuredJackPanel.ProjectCode = 0; } else { MeasuredJackPanel.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue); } MeasuredJackPanel.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (MeasuredJackPanel.UpdateMeasuredJackPanelData(dpack.Code)) { ed.WriteMessage("Update MeasuredJackPanel Success \n"); AllowClose = true; this.Close(); } } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Global.Acad.DrawEquips.AcDrawGround ground = new Atend.Global.Acad.DrawEquips.AcDrawGround(); if (Convert.ToBoolean(gvGround.Rows[gvGround.CurrentRow.Index].Cells[3].Value) == false) { ground.UseAccess = true; ground.eGround = Atend.Base.Equipment.EGround.AccessSelectByCode(Convert.ToInt32(gvGround.Rows[gvGround.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvGround.Rows[gvGround.CurrentRow.Index].Cells[3].Value)) { ground.UseAccess = false; ground.eGround = Atend.Base.Equipment.EGround.SelectByXCode(new Guid(gvGround.Rows[gvGround.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist1.SelectedValue)); ground.Existance = status.ACode; if (cboProjCode1.Items.Count == 0) { ground.ProjectCode = 0; } else { ground.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue); } ground.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (ground.UpdateGroundData(dpack.Code)) { ed.WriteMessage("Update Ground Success \n"); AllowClose = true; this.Close(); } } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { Atend.Global.Acad.DrawEquips.AcDrawGroundCabel DrawGroundCabel = new Atend.Global.Acad.DrawEquips.AcDrawGroundCabel(); if (Validation()) { if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[4].Value) == false) { DrawGroundCabel.UseAccess = true; DrawGroundCabel.eGroundCabelTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); } else if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[4].Value)) { DrawGroundCabel.UseAccess = false; Atend.Base.Equipment.EGroundCabelTip GroundCabeltip = new Atend.Base.Equipment.EGroundCabelTip(); ed.WriteMessage("SelectByXCode={0}\n", gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString()); GroundCabeltip = Atend.Base.Equipment.EGroundCabelTip.SelectByXCode(new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString())); DrawGroundCabel.eGroundCabelTip = GroundCabeltip; ed.WriteMessage("GroundCabelTip.XCOde={0}\n", GroundCabeltip.XCode); List <Atend.Base.Equipment.EGroundCabel> list = new List <Atend.Base.Equipment.EGroundCabel>(); list.Add(Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundCabeltip.PhaseProductXCode)); list.Add(Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundCabeltip.NeutralProductXCode)); DrawGroundCabel.eGroundCabels = list; } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawGroundCabel.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawGroundCabel.ProjectCode = 0; } else { DrawGroundCabel.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawGroundCabel.SelectedObjID = BranchObj; DrawGroundCabel.UpdateGroundCabelData(Convert.ToDouble(txtLenght.Text), BranchCode); //if (DrawSelfKeeper.UpdateSelfKeeperData()) // ed.WriteMessage("Update SelfKeeper Success \n"); } }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawHeaderCabel DrawHeaderCabel = new Atend.Global.Acad.DrawEquips.AcDrawHeaderCabel(); if (Validation()) { if (Convert.ToBoolean(gvHeaderCabel.Rows[gvHeaderCabel.CurrentRow.Index].Cells[3].Value) == false) { DrawHeaderCabel.UseAccess = true; DrawHeaderCabel.eHeaderCabel = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(Convert.ToInt32(gvHeaderCabel.Rows[gvHeaderCabel.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvHeaderCabel.Rows[gvHeaderCabel.CurrentRow.Index].Cells[3].Value)) { DrawHeaderCabel.UseAccess = false; DrawHeaderCabel.eHeaderCabel = Atend.Base.Equipment.EHeaderCabel.SelectByXCode(new Guid(gvHeaderCabel.Rows[gvHeaderCabel.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawHeaderCabel.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawHeaderCabel.ProjectCode = 0; } else { DrawHeaderCabel.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawHeaderCabel.SelectedObjectId = objID; if (DrawHeaderCabel.UpdateHeaderCabelData(NodeCode)) { ed.WriteMessage("Update HeaderCable Success \n"); } } }
private void btnOk_Click(object sender, EventArgs e) { btnCancel.Focus(); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Clear(); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Clear(); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Clear(); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Clear(); int projectcode = 0; int Existance = 0; if (Validation()) { dtsub = (System.Data.DataTable)gvSubEquip.DataSource; if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true) { Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false; Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; txtName.Text = AirPost.Name; txtCapacity.Text = AirPost.Capacity.ToString(); foreach (DataRow dr1 in dtsub.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr1["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr1["IsExistance"].ToString()); if (dr1["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString()); } if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr1["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); } if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr1["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerProjectCode.Add(projectcode); } } ////////////////////// //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false; //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue); //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); //txtName.Text = AirPost.Name; //txtCapacity.Text = AirPost.Capacity.ToString(); //for (int i = 0; i < gvSubEquip.Rows.Count; i++) //{ // //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3]; // //if (c.Value.ToString() == "موجود-موجود") // //{ // // Existance = 0; // //} // //if (c.Value.ToString() == "موجود-مستعمل") // //{ // // Existance = 1; // //} // //if (c.Value.ToString() == "موجود-اسقاط") // //{ // // Existance = 2; // //} // //if (c.Value.ToString() == "موجود-جابجایی") // //{ // // Existance = 3; // //} // //if (c.Value.ToString() == "پیشنهادی-نو") // //{ // // Existance = 4; // //} // //if (c.Value.ToString() == "پیشنهادی-جابجایی") // //{ // // Existance = 5; // //} // //ed.WriteMessage("Type={0}\n", gvSubEquip.Rows[i].Cells[5].Value.ToString()); // //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6]; // //projectcode = Convert.ToInt32(cPCode.Value); // if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) // { // Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) // { // Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } //} } else { ed.WriteMessage("It Is Access Wquipment\n"); Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true; Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; txtName.Text = AirPost.Name; txtCapacity.Text = AirPost.Capacity.ToString(); foreach (DataRow dr1 in dtsub.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr1["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr1["IsExistance"].ToString()); if (dr1["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString()); } if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr1["Code"])); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); } if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr1["Code"])); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerProjectCode.Add(projectcode); } } /////////////////////// //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true; //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue); //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); //txtName.Text = AirPost.Name; //txtCapacity.Text = AirPost.Capacity.ToString(); //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true; //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue); //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); //txtName.Text = AirPost.Name; //txtCapacity.Text = AirPost.Capacity.ToString(); //for (int i = 0; i < gvSubEquip.Rows.Count; i++) //{ // DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3]; // if (c.Value.ToString() == "موجود-موجود") // { // Existance = 0; // } // if (c.Value.ToString() == "موجود-مستعمل") // { // Existance = 1; // } // if (c.Value.ToString() == "موجود-اسقاط") // { // Existance = 2; // } // if (c.Value.ToString() == "موجود-جابجایی") // { // Existance = 3; // } // if (c.Value.ToString() == "پیشنهادی-نو") // { // Existance = 4; // } // if (c.Value.ToString() == "پیشنهادی-جابجایی") // { // Existance = 5; // } // DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6]; // projectcode = Convert.ToInt32(cPCode.Value); // if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) // { // //Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString())); // Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(gvSubEquip.Rows[i].Cells[0].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) // { // ed.WriteMessage("@Code{0}\n", gvSubEquip.Rows[i].Cells[0].Value); // ed.WriteMessage("@XCode{0}\n", gvSubEquip.Rows[i].Cells[1].Value); // Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(gvSubEquip.Rows[i].Cells[0].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } //} } Atend.Base.Base.BEquipStatus status02 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.AirPostData.Existance = status02.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowToclose = true; } else { AllowToclose = false; } ed.WriteMessage("Finish btnOK\n"); }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[2].Value) == false)//Access { Atend.Base.Equipment.EGroundCabelTip GroundCabelTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); if (GroundCabelTip.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabelTip = GroundCabelTip; Atend.Base.Acad.AcadGlobal.GroundCableData.UseAccess = true; Atend.Base.Equipment.EGroundCabel GroundPhase = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(GroundCabelTip.PhaseProductCode); if (GroundPhase.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabels.Add(GroundPhase); Atend.Base.Equipment.EGroundCabel GroundNeutral = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(GroundCabelTip.NeutralProductCode); if (GroundNeutral.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabels.Add(GroundNeutral); } else { return; } } else { return; } } else { return; } } else { Atend.Base.Equipment.EGroundCabelTip GroundCabelTip = Atend.Base.Equipment.EGroundCabelTip.SelectByXCode(new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value.ToString())); if (GroundCabelTip.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabelTip = GroundCabelTip; Atend.Base.Acad.AcadGlobal.GroundCableData.UseAccess = false; Atend.Base.Equipment.EGroundCabel GroundPhase = Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundCabelTip.PhaseProductXCode); if (GroundPhase.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabels.Add(GroundPhase); Atend.Base.Equipment.EGroundCabel GroundNeutral = Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundCabelTip.NeutralProductXCode); if (GroundNeutral.Code != -1) { Atend.Base.Acad.AcadGlobal.GroundCableData.eGroundCabels.Add(GroundNeutral); } else { return; } } else { return; } } else { return; } } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.GroundCableData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.GroundCableData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.GroundCableData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawKhazan DrawKhazan = new Atend.Global.Acad.DrawEquips.AcDrawKhazan(); if (Validation()) { if (Convert.ToBoolean(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[3].Value) == false) { DrawKhazan.UseAccess = true; DrawKhazan.eKhazanTip = Atend.Base.Equipment.EKhazanTip.AccessSelectByCode(Convert.ToInt32(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[4].Value.ToString())); } else if (Convert.ToBoolean(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[3].Value)) { DrawKhazan.UseAccess = false; DrawKhazan.eKhazanTip = Atend.Base.Equipment.EKhazanTip.SelectByXCode(new Guid(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[0].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawKhazan.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawKhazan.ProjectCode = 0; } else { DrawKhazan.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawKhazan.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (DrawKhazan.UpdateKhazanData(dpack.Code)) { ed.WriteMessage("Update Khazan Success \n"); AllowClose = true; this.Close(); } } //Extra //if (gvBankKhazan.Rows.Count > 0) //{ // Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; // //ed.WriteMessage(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString() + "\n"); // //ed.WriteMessage(gvBankKhazan.SelectedRows[0].Index.ToString() + "\n"); // Atend.Base.Design.DPackage Pakage = Atend.Base.Design.DPackage.AccessSelectByCode(DpakageCode); // //**EDIT** // Pakage.ProductCode = Convert.ToInt32(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString()); // //Pakage.ProductCode = new Guid(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString()); // if (Pakage.AccessUpdate()) // { // //ed.WriteMessage("OK"); // //Atend.Base.Acad.AT_INFO // //Code = Convert.ToInt32(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString()); // Code = new Guid(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString()); // AllowClose = true; // this.Close(); // } // else // MessageBox.Show("انجام ويرايش امكانپذير نيست"); //} //if (Validation()) //{ // //DataTable KhazanTipTable = Atend.Base.Equipment.EKhazanTip.SelectByCode( // // Convert.ToInt32(gvBankKhazan.CurrentRow.Index)); // Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip.Count = 1; // Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip.Type = (int)Atend.Control.Enum.ProductType.BankKhazan; // Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip.ProductCode = Convert.ToInt32( // gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells["Column7"].Value); // Atend.Base.Design.DPackage dPackge; // DataTable dt = (DataTable)gvKhazan.DataSource; // foreach (DataRow dr in dt.Rows) // { // dPackge = new Atend.Base.Design.DPackage(); // dPackge.Count = Convert.ToInt32(dr["Count"]); // dPackge.Type=Convert.ToInt32(dr["Type"]); // dPackge.ProductCode = Convert.ToInt32(Atend.Control.Enum.ProductType.Khazan); // Atend.Base.Acad.AcadGlobal.dPackageForKhazan.Add(dPackge); // } // AllowClose = true; //} //else //{ // AllowClose = false; //} }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; if (Validation()) { bool useAccess = false; int projectcode = 0; List <Atend.Base.Equipment.EConsol> list = new List <Atend.Base.Equipment.EConsol>(); ArrayList consoluse = new ArrayList(); ArrayList consolexis = new ArrayList(); ArrayList consolcount = new ArrayList(); ArrayList ConsolProjCode = new ArrayList(); ArrayList DelConsol = new ArrayList(); Atend.Base.Equipment.EConsol eConsol = new Atend.Base.Equipment.EConsol(); int Existance = 0; Atend.Base.Equipment.EPole ePole = new Atend.Base.Equipment.EPole(); Atend.Base.Equipment.EPoleTip ePoletip = new Atend.Base.Equipment.EPoleTip(); //ed.WriteMessage("IsSqlSelected={0}\n", gvPoleTip.SelectedRows[0].Cells[2].Value.ToString()); Atend.Base.Equipment.EHalter halt = new Atend.Base.Equipment.EHalter(); if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == true) { ePoletip = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString())); ePole = Atend.Base.Equipment.EPole.SelectByXCode(ePoletip.PoleXCode); useAccess = false; if (ePoletip.HalterCount != 0) { halt = Atend.Base.Equipment.EHalter.SelectByXCode(ePoletip.HalterXID); } } else { ePoletip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));//gvPoleTip.SelectedRows[0].Cells[1].Value ePole = Atend.Base.Equipment.EPole.AccessSelectByCode(ePoletip.PoleCode); useAccess = true; if (ePoletip.HalterCount != 0) { halt = Atend.Base.Equipment.EHalter.AccessSelectByCode(ePoletip.HalterID); } } foreach (DataRow dr in dtLastConsol.Rows) { DelConsol.Add(dr["Code"].ToString()); } //if (ePole.Shape == 0) //{ // ed.WriteMessage("**********I AM IN Shape=0\n"); // shape = 0; // Atend.Global.Acad.DrawEquips.AcDrawCirclePole ACDCP = new Atend.Global.Acad.DrawEquips.AcDrawCirclePole(); // ACDCP.ePole = ePole; // ACDCP.ePoleTip = ePoletip; // ACDCP.UseAccess = useAccess; // ACDCP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); // ACDCP.Existance = Convert.ToByte(cboIsExist.SelectedValue); // ACDCP.HalterExistance = Convert.ToByte(cboHIsExistance.SelectedValue); // ACDCP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); // ACDCP.Height = Convert.ToInt32(txtHeight.Text); // ACDCP.eHalter = halt; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear(); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Clear(); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Clear(); // ed.WriteMessage("oo\n"); // ACDCP.eConsols.Clear(); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Clear(); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Clear(); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterType = ePoletip.HalterID; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.Factor = ePoletip.Factor; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.Existance = Convert.ToByte(cboIsExist.SelectedValue); // //Atend.Base.Acad.AcadGlobal.CirclePoleData.UseAccess = useAccess; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.ePole = ePole; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.ePoleTip = ePoletip; // //Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); // foreach (DataRow dr in dtgvPoleConsol.Rows) // { // if (Convert.ToInt32(dr["Count"].ToString()) != 0) // { // //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; // //Existance = Convert.ToInt32(c.Value); // //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; // //projectcode = Convert.ToInt32(cPCode.Value); // if (Convert.ToBoolean(dr["IsSql"].ToString())) // { // ed.WriteMessage("LocalConsolXCODE={0}\n", dr["XCode"].ToString()); // eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid( // dr["XCode"].ToString())); // ed.WriteMessage("Consol.NAme={0}\n", eConsol.Name); // ACDCP.eConsols.Add(eConsol); // ed.WriteMessage("HH\n"); // ACDCP.eConsolUseAccess.Add(false); // ed.WriteMessage("AA\n"); // ACDCP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); // ed.WriteMessage("Ab\n"); // ACDCP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString())); // ed.WriteMessage("Ac\n"); // ACDCP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); // } // else // { // ed.WriteMessage("Access Consol\n"); // eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32( // dr["AccessCode"].ToString())); // ACDCP.eConsols.Add(eConsol); // ACDCP.eConsolUseAccess.Add(true); // ACDCP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); // ed.WriteMessage("eConsolExistance={0}\n", Existance); // ACDCP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString())); // ACDCP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); // } // } // } // ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Count); // if (ACDCP.UpdatePoleDataTip(objID, DelConsol, NodeCode)) // { // AllowClose = true; // return; // } //} //else //{ // shape = 1; // ed.WriteMessage("TYPE={0}\n", ePole.Type); // if (ePole.Type == 2) // { // Atend.Global.Acad.DrawEquips.AcDrawPolygonPole ACDP = new Atend.Global.Acad.DrawEquips.AcDrawPolygonPole(); // ed.WriteMessage("***************Type=2\n"); // Type = 2; // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Clear(); // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterType = ePoletip.HalterID; // //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.Factor = ePoletip.Factor; // ACDP.Existance = Convert.ToByte(cboIsExist.SelectedValue); // ACDP.UseAccess = useAccess; // ACDP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); // ACDP.ePole = ePole; // ACDP.ePoleTip = ePoletip; // ACDP.HalterExistance = Convert.ToByte(cboHIsExistance.SelectedValue); // ACDP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); // ACDP.Height = Convert.ToInt32(txtHeight.Text); // ACDP.eHalter = halt; // foreach (DataRow dr in dtgvPoleConsol.Rows) // { // if (Convert.ToInt32(dr["Count"].ToString()) != 0) // { // //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; // //Existance = Convert.ToInt32(c.Value); // //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; // //projectcode = Convert.ToInt32(cPCode.Value); // ed.WriteMessage("***IsSQL={0}\n",dr["IsSql"].ToString()); // if (Convert.ToBoolean(dr["IsSql"].ToString())) // { // eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid( // dr["XCode"].ToString())); // ACDP.eConsols.Add(eConsol); // ACDP.eConsolUseAccess.Add(false); // ACDP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); // ed.WriteMessage("eConsolExistance={0}\n", Existance); // ACDP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString())); // ACDP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); // } // else // { // eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32( // dr["AccessCode"].ToString())); // ACDP.eConsols.Add(eConsol); // ACDP.eConsolUseAccess.Add(true); // ACDP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); // ed.WriteMessage("eConsolExistance={0}\n", Existance); // ACDP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString())); // ACDP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); // } // } // } // if (ACDP.UpdatePoleDataTip(objID, DelConsol, NodeCode)) // { // AllowClose = true; // return; // } // //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Count); // } // //if (ePole.Type == 3) // //{ //Type = 3; Atend.Global.Acad.DrawEquips.AcDrawPole ADP = new Atend.Global.Acad.DrawEquips.AcDrawPole(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Clear(); //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterType = ePoletip.HalterID; //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.Factor = ePoletip.Factor; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue.ToString())); ADP.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { ADP.ProjectCode = 0; } else { ADP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } ADP.UseAccess = useAccess; ADP.ePoleTip = ePoletip; ADP.ePole = ePole; Atend.Base.Base.BEquipStatus statusHalter = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExistance.SelectedValue.ToString())); ADP.HalterExist = statusHalter.ACode; if (cboHProjectCode.Items.Count == 0) { ADP.HalterProjectCode = 0; } else { ADP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); } ADP.Height = Convert.ToInt32(txtHeight.Text); ADP.eHalter = halt; ADP.eHalterCount = Convert.ToInt32(txtHalterCount.Text); foreach (DataRow dr in dtgvPoleConsol.Rows) { if (Convert.ToInt32(dr["Count"].ToString()) != 0) { //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; //Existance = Convert.ToInt32(c.Value); //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; //projectcode = Convert.ToInt32(cPCode.Value); if (Convert.ToBoolean(dr["IsSql"].ToString())) { eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid( dr["XCode"].ToString())); ADP.eConsols.Add(eConsol); ADP.eConsolUseAccess.Add(false); ADP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); Atend.Base.Base.BEquipStatus status2 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); ADP.eConsolExistance.Add(status2.ACode); if (dr["ProjectCode"].ToString() == "") { ADP.eConsolProjectCode.Add(0); } else { ADP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); } } else { eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32( dr["AccessCode"].ToString())); ADP.eConsols.Add(eConsol); ADP.eConsolUseAccess.Add(true); ADP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); Atend.Base.Base.BEquipStatus status2 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); ADP.eConsolExistance.Add(status2.ACode); if (dr["ProjectCode"].ToString() == "") { ADP.eConsolProjectCode.Add(0); } else { ADP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString())); } } } } if (ADP.UpdatePoleDataTip(objID, DelConsol, NodeCode)) { AllowClose = true; return; } //} //} //AllowClose = true; } else { AllowClose = false; } }
private void Save() { txtName.Focus(); Atend.Base.Base.BEquipStatus EquipStatus = new Atend.Base.Base.BEquipStatus(); EquipStatus.Name = txtName.Text; EquipStatus.ACode = Convert.ToInt32(txtCode.Text); EquipStatus.PricePercent = Convert.ToDouble(txtPrice.Text); EquipStatus.ExecutePricePercent = Convert.ToDouble(txtExecutePrice.Text); EquipStatus.WagePricePercent = Convert.ToDouble(txtWagePrice.Text); if (chkIsDefault.Checked) { EquipStatus.UnBindIsDedefault(); EquipStatus.IsDefault = true; } else { EquipStatus.IsDefault = false; } ArrayList array = new ArrayList(); for (int i = 0; i < gvEquipStatus.Rows.Count; i++) { Atend.Base.Base.BWorkOrder workorder = new Atend.Base.Base.BWorkOrder(); DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvEquipStatus.Rows[i].Cells[1]; if (Convert.ToBoolean(chk.Value)) { array.Add(gvEquipStatus.Rows[i].Cells[0].Value.ToString()); } } EquipStatus.ArraySub = array; if (selectedEquipStatus != 0) { if (!Atend.Base.Base.BStatusWorkOrder.DeleteXWithEquipStatusCode(selectedEquipStatus)) { MessageBox.Show("خطا در حذف ", "خطا"); return; } } if (selectedEquipStatus == 0) { if (EquipStatus.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { EquipStatus.Code = selectedEquipStatus; if (EquipStatus.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells["IsSql"].Value) == false)//Access { Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = true; Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode( Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value)); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip; Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.PhaseProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase); Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.NeutralProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral); Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.NightProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight); } else { Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = false; Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode( new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString())); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip; Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.PhaseProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase); Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.NeutralProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral); Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.NightProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.SelfKeeperData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Sag = 0; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Order = 0; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.DesignCode = Atend.Control.Common.SelectedDesignCode; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.ProductType = (int)Atend.Control.Enum.ProductType.SelfKeeper; //Atend.Base.Acad.AcadGlobal.dBranch.ProductCode = (int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value; //////Atend.Base.Acad.AcadGlobal.dBranch.XCode = new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString()); //if (chkIsExist.CheckState == CheckState.Unchecked && cboIsExist.SelectedIndex == 0) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 0; //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 0) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 1; //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 1) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 2; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = chkIsExist.Checked; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Number = Atend.Base.Equipment.ESelfKeeperTip.SelectByCode((int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value).Description; AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; if (Validation()) { //Atend.Base.Base.BEquipStatus statusaaaa = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); gvPoleTip.Focus(); bool useAccess = false; int projectcode = 0; Atend.Base.Equipment.EConsol eConsol = new Atend.Base.Equipment.EConsol(); int Existance = 0; Atend.Base.Equipment.EPole ePole = new Atend.Base.Equipment.EPole(); Atend.Base.Equipment.EPoleTip ePoletip = new Atend.Base.Equipment.EPoleTip(); Atend.Base.Equipment.EHalter Halt = new Atend.Base.Equipment.EHalter(); if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == true) { ePoletip = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString())); ePole = Atend.Base.Equipment.EPole.SelectByXCode(ePoletip.PoleXCode); useAccess = false; Halt = Atend.Base.Equipment.EHalter.SelectByXCode(ePoletip.HalterXID); } else { //ed.WriteMessage("Access\n"); ePoletip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString())); ePole = Atend.Base.Equipment.EPole.AccessSelectByCode(ePoletip.PoleCode); useAccess = true; Halt = Atend.Base.Equipment.EHalter.AccessSelectByCode(ePoletip.HalterID); } if (ePole.Shape == 0) { shape = 0; Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterType = ePoletip.HalterID; Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.Factor = ePoletip.Factor; Atend.Base.Acad.AcadGlobal.CirclePoleData.UseAccess = useAccess; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.CirclePoleData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.CirclePoleData.ePole = ePole; Atend.Base.Acad.AcadGlobal.CirclePoleData.ePoleTip = ePoletip; Atend.Base.Acad.AcadGlobal.CirclePoleData.Height = Convert.ToDouble(txtHeight.Text); Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterExistance = statusHalteer.ACode; if (cboHProjectCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.CirclePoleData.eHalter = Halt; Atend.Base.Acad.AcadGlobal.CirclePoleData.eHalterCount = ePoletip.HalterCount; //for (int i = 0; i < gvConsol.Rows.Count; i++) foreach (DataRow dr in dtgvPoleConsol.Rows) { if (Convert.ToInt32(dr["Count"].ToString()) != 0) { //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = statusPole.ACode; if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; if (!useAccess) { eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Add(false); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Add(projectcode); } else { eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Add(true); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Add(projectcode); } } } } else { shape = 1; //ed.WriteMessage("*******EPOLe.Type={0}\n", ePole.Type); if (ePole.Type == 2) { //ed.WriteMessage("Type=2\n"); Type = 2; Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterType = ePoletip.HalterID; Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.Factor = ePoletip.Factor; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.PolygonPoleData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.PolygonPoleData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.PolygonPoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.PolygonPoleData.UseAccess = useAccess; Atend.Base.Acad.AcadGlobal.PolygonPoleData.Height = Convert.ToDouble(txtHeight.Text); Atend.Base.Acad.AcadGlobal.PolygonPoleData.ePole = ePole; Atend.Base.Acad.AcadGlobal.PolygonPoleData.ePoleTip = ePoletip; Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterExistance = statusHalteer.ACode; if (cboHProjectCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.PolygonPoleData.eHalter = Halt; Atend.Base.Acad.AcadGlobal.PolygonPoleData.eHalterCount = ePoletip.HalterCount; //for (int i = 0; i < gvConsol.Rows.Count; i++) foreach (DataRow dr in dtgvPoleConsol.Rows) { if (Convert.ToInt32(dr["Count"].ToString()) != 0) { //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = statusPole.ACode; if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; if (!useAccess) { eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid( dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Add(false); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); //ed.WriteMessage("eConsolExistance={0}\n", Existance); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Add(projectcode); } else { eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32( dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Add(true); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); //ed.WriteMessage("eConsolExistance={0}\n", Existance); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Add(projectcode); } } } //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Count); } else //if (ePole.Type == 3) { Type = 3; //ed.WriteMessage("Type=3\n"); Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterCount = ePoletip.HalterCount; //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterType = ePoletip.HalterID; Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.Factor = ePoletip.Factor; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.PoleData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.PoleData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.PoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.PoleData.UseAccess = useAccess; Atend.Base.Acad.AcadGlobal.PoleData.ePoleTip = ePoletip; Atend.Base.Acad.AcadGlobal.PoleData.ePole = ePole; Atend.Base.Acad.AcadGlobal.PoleData.Height = Convert.ToDouble(txtHeight.Text); Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.PoleData.HalterExistance = statusHalteer.ACode; if (cboHProjectCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.PoleData.HalterProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.PoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue); } Atend.Base.Acad.AcadGlobal.PoleData.eHalter = Halt; Atend.Base.Acad.AcadGlobal.PoleData.eHalterCount = ePoletip.HalterCount; //for (int i = 0; i < gvConsol.Rows.Count; i++) foreach (DataRow dr in dtgvPoleConsol.Rows) { if (Convert.ToInt32(dr["Count"].ToString()) != 0) { //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3]; Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = statusPole.ACode; if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5]; if (!useAccess) { eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Add(false); Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); //ed.WriteMessage("eConsolExistance={0}\n", Existance); Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Add(projectcode); } else { eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Add(eConsol); Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Add(true); Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString())); Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Add(projectcode); } } } //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Count); } } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { if (HeaderIsSelected == false) { Atend.Base.Equipment.EKablsho kablsho; if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[3].Value) == false)//Access { kablsho = Atend.Base.Equipment.EKablsho.AccessSelectByCode(Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value)); Atend.Base.Acad.AcadGlobal.KablshoData.UseAccess = true; } else { kablsho = Atend.Base.Equipment.EKablsho.SelectByXCode(new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); Atend.Base.Acad.AcadGlobal.KablshoData.UseAccess = false; } Atend.Base.Acad.AcadGlobal.KablshoData.eKablsho = kablsho; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.KablshoData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.KablshoData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.KablshoData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { Atend.Base.Equipment.EHeaderCabel Header; if (Convert.ToBoolean(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[3].Value) == false)//Access { Atend.Base.Acad.AcadGlobal.HeaderCableData.UseAccess = true; Header = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(Convert.ToInt32(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[0].Value)); } else { Atend.Base.Acad.AcadGlobal.HeaderCableData.UseAccess = false; Header = Atend.Base.Equipment.EHeaderCabel.SelectByXCode(new Guid(gvConductor.Rows[gvConductor.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Acad.AcadGlobal.HeaderCableData.eHeaderCable = Header; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.HeaderCableData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.HeaderCableData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.HeaderCableData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } } else { AllowClose = false; } }
private void btnOk_Click(object sender, EventArgs e) { txtCapacity.Focus(); int projectcode = 0; int Existance = 0; if (Validation()) { List <Atend.Base.Equipment.EJackPanelWeek> JackPanelWeeks = new List <Atend.Base.Equipment.EJackPanelWeek>(); List <Atend.Base.Equipment.ETransformer> Transformers = new List <Atend.Base.Equipment.ETransformer>(); ArrayList JackPanelWeekExistance = new ArrayList(); ArrayList TransformerExistance = new ArrayList(); ArrayList JackPanelWeekProjectCode = new ArrayList(); ArrayList TransformerProjectCode = new ArrayList(); //Atend.Global.Acad.DrawEquips.AcDrawAirPost AirPost = new Atend.Global.Acad.DrawEquips.AcDrawAirPost(); dtSuEquip = (System.Data.DataTable)gvSubEquip.DataSource; //## //## Atend.Base.Base.BEquipStatus statusAir = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); AirPost.Existance = statusAir.ACode; //Convert.ToInt32(cboIsExist.SelectedValue); if (cboProjCode.Items.Count == 0) { AirPost.ProjectCode = 0; } else { AirPost.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } AirPost.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); //AllowToclose = true; //if (AirPost.UpdateAirPostData(dpack.Code)) //{ // AllowToclose = true; // this.Close(); //} //else //{ // AllowToclose = false; //} if (Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()) != selecetdProductCode) { if (MessageBox.Show("آیا مایل به حذف پست موجود و \nجایگزین کردن پست جدید می باشید", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { //Draw&Save if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true) { Atend.Base.Equipment.EAirPost airPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); AirPost.UseAccess = false; AirPost.eAirPost = airPost; foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString())); JackPanelWeekExistance.Add(Existance); JackPanelWeeks.Add(jackPanelWeek); JackPanelWeekProjectCode.Add(projectcode); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString())); TransformerExistance.Add(Existance); Transformers.Add(transformer); TransformerProjectCode.Add(projectcode); } } } else { Atend.Base.Equipment.EAirPost airPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); AirPost.UseAccess = true; AirPost.eAirPost = airPost; foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); JackPanelWeekExistance.Add(Existance); JackPanelWeeks.Add(jackPanelWeek); JackPanelWeekProjectCode.Add(projectcode); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); TransformerExistance.Add(Existance); Transformers.Add(transformer); TransformerProjectCode.Add(projectcode.ToString()); } } } AirPost.eJackPanelWeeks = JackPanelWeeks; AirPost.eJackPanelWeekExistance = JackPanelWeekExistance; AirPost.eJackPanelWeekProjectCode = JackPanelWeekProjectCode; AirPost.eTransformers = Transformers; AirPost.eTransformerExistance = TransformerExistance; AirPost.eTransformerProjectCode = TransformerProjectCode; if (AirPost.UpdateAirPostData(dpack.Code)) { AirPost.DrawAirPost(); AllowToclose = true; this.Close(); } else { AllowToclose = false; } } else { AllowToclose = false; } } else { //SaveWithoutDrawAllowToclose = false foreach (DataRow dr in dtSuEquip.Rows) { dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["Isexistance"].ToString())).ACode; } if (!AirPost.UpdateAirPostWithoutDraw(dpack.Code, dtSuEquip)) { Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification(); notification.Title = "خطا"; notification.Msg = "خطا در ویرایش پست هوایی"; notification.ShowStatusBarBalloon(); AllowToclose = false; } else { AllowToclose = true; } } } else { AllowToclose = false; } //OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO //Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Clear(); //Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Clear(); //Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Clear(); //Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Clear(); //int projectcode = 0; //int Existance = 0; //if (Validation()) //{ // dtsub = (System.Data.DataTable)gvSubEquip.DataSource; // if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true) // { // ed.WriteMessage("It Is Local Wquipment\n"); // Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false; // Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; // Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue); // Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); // txtName.Text = AirPost.Name; // txtCapacity.Text = AirPost.Capacity.ToString(); // foreach (DataRow dr1 in dtsub.Rows) // { // Existance = Convert.ToInt32(dr1["IsExistance"].ToString()); // projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString()); // if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) // { // Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr1["XCode"].ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) // { // Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr1["XCode"].ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // } // } // else // { // ed.WriteMessage("It Is Access Wquipment\n"); // Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); // Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true; // Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost; // Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue); // Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); // txtName.Text = AirPost.Name; // txtCapacity.Text = AirPost.Capacity.ToString(); // foreach (DataRow dr1 in dtsub.Rows) // { // Existance = Convert.ToInt32(dr1["IsExistance"].ToString()); // projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString()); // if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) // { // Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr1["Code"])); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) // { // Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr1["Code"])); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance); // Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer); // Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode); // } // } // } // AllowToclose = true; //} //else //{ // AllowToclose = false; //} }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; txtAdvanceType.Focus(); int projectcode = 0; int Existance = 0; if (Validation()) { List <Atend.Base.Equipment.EJAckPanel> JackPanelMiddles = new List <Atend.Base.Equipment.EJAckPanel>(); List <Atend.Base.Equipment.EJackPanelWeek> JackPanelWeeks = new List <Atend.Base.Equipment.EJackPanelWeek>(); List <Atend.Base.Equipment.ETransformer> Transformers = new List <Atend.Base.Equipment.ETransformer>(); ArrayList JackPanelMiddleExistance = new ArrayList(); ArrayList JackPanelWeekExistance = new ArrayList(); ArrayList TransformerExistance = new ArrayList(); ArrayList JackPanelMiddleProjectCode = new ArrayList(); ArrayList JackPanelWeekProjectCode = new ArrayList(); ArrayList TransformerProjectCode = new ArrayList(); dtSuEquip = (System.Data.DataTable)gvSubEquip.DataSource; //## //## Atend.Base.Base.BEquipStatus statusGround = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); GroundPost.Existance = statusGround.ACode; //Convert.ToInt32(cboIsExist.SelectedValue); if (cboProjCode.Items.Count == 0) { GroundPost.ProjectCode = 0; } else { GroundPost.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } //MessageBox.Show(ObjID.ToString()); GroundPost.SelectedObjectId = ObjID; Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); //AllowToclose = true; //if (GroundPost.UpdateGroundPostData(dpack.Code)) //{ // AllowToclose = true; // this.Close(); //} //else //{ // AllowToclose = false; //} if (Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()) != selectedProductCode) { if (MessageBox.Show("آیا مایل به حذف پست موجود و \nجایگزین کردن پست جدید می باشید", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true) { Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = false; //Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost; GroundPost.UseAccess = false; GroundPost.eGroundPost = groundPost; //for (int i = 0; i < gvSubEquip.Rows.Count; i++) foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6]; //ed.WriteMessage("Type={0}\n", gvSubEquip.Rows[i].Cells[5].Value.ToString()); if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel)) { Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(dr["XCode"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode); JackPanelMiddleExistance.Add(Existance); JackPanelMiddles.Add(jackPanel); JackPanelMiddleProjectCode.Add(projectcode); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode); JackPanelWeekExistance.Add(Existance); JackPanelWeeks.Add(jackPanelWeek); JackPanelWeekProjectCode.Add(projectcode.ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode); TransformerExistance.Add(Existance); Transformers.Add(transformer); TransformerProjectCode.Add(projectcode.ToString()); } } } else { Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = true; //Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost; GroundPost.UseAccess = true; GroundPost.eGroundPost = groundPost; //for (int i = 0; i < gvSubEquip.Rows.Count; i++) foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { projectcode = 0; } else { projectcode = Convert.ToInt32(dr["ProjectCode"].ToString()); } //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6]; if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel)) { Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode); JackPanelMiddleExistance.Add(Existance); JackPanelMiddles.Add(jackPanel); JackPanelMiddleProjectCode.Add(projectcode.ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { //Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString())); Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek); //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode); JackPanelWeekExistance.Add(Existance); JackPanelWeeks.Add(jackPanelWeek); JackPanelWeekProjectCode.Add(projectcode.ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer); //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode); TransformerExistance.Add(Existance); Transformers.Add(transformer); TransformerProjectCode.Add(projectcode.ToString()); } } } GroundPost.eJackPanelMiddles = JackPanelMiddles; GroundPost.eJackPanelMiddleExistance = JackPanelMiddleExistance; GroundPost.eJackPanelMiddleProjectCode = JackPanelMiddleProjectCode; GroundPost.eJackPanelWeeks = JackPanelWeeks; GroundPost.eJackPanelWeekExistance = JackPanelWeekExistance; GroundPost.eJackPanelWeekProjectCode = JackPanelWeekProjectCode; GroundPost.eTransformers = Transformers; GroundPost.eTransformerExistance = TransformerExistance; GroundPost.eTransformerProjectCode = TransformerProjectCode; if (GroundPost.UpdateGroundPostData(dpack.Code)) { GroundPost.DrawGroundPost(); AllowToclose = true; this.Close(); } else { AllowToclose = false; } } else { AllowToclose = false; } } else { //SaveWithoutDrawAllowToclose = false foreach (DataRow dr in dtSuEquip.Rows) { dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["Isexistance"].ToString())).ACode; } if (!GroundPost.UpdateGroundPostWithoutDraw(dpack.Code, dtSuEquip)) { Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification(); notification.Title = "خطا"; notification.Msg = "خطا در ویرایش پست زمینی"; notification.ShowStatusBarBalloon(); AllowToclose = false; } else { AllowToclose = true; } } } else { AllowToclose = false; } //Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //if (!Atend.Global.Desig.NodeTransaction.DeleteGroundPost(GPCode)) //{ // ed.WriteMessage("\nEXIT\n"); // return; //} //if (Validation()) //{ // Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode( // new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); // //**EDIT** // //GroundPostProductCode = groundPost.Code; // GroundPostProductCode = groundPost.XCode; // DataTable dtWeekJackPanel = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)); // DataTable dtMiddleJAckanel = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel)); // DataTable dtTransform = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)); // transformerCount = dtTransform.Rows.Count; // MiddlejackPanelCount = dtMiddleJAckanel.Rows.Count; // MiddlejackPanelCount = 0; // foreach (DataRow dr in dtMiddleJAckanel.Rows) // { // int MiddleCounter = Convert.ToInt32(dr["Count"]); // for (int i = 1; i <= MiddleCounter; i++) // { // arMiddleJAckPAnel.Add(dr["ProductCode"].ToString()); // MiddlejackPanelCount++; // } // } // //WeekJackPAnelCount = dtWeekJackPanel.Rows.Count; // WeekJackPAnelCount = 0; // foreach (DataRow dr in dtWeekJackPanel.Rows) // { // int WeekCounter = Convert.ToInt32(dr["Count"]); // for (int i = 1; i <= WeekCounter; i++) // { // arweekJackPanel.Add(dr["ProductCode"]); // WeekJackPAnelCount++; // } // } // transformerCount = 0; // foreach (DataRow dr in dtTransform.Rows) // { // int TransformerCounter = Convert.ToInt32(dr["Count"]); // for (int i = 1; i <= TransformerCounter; i++) // { // arTransformer.Add(dr["ProductCode"]); // transformerCount++; // } // } // //PostCode = Convert.ToInt32(gvDisconnector.SelectedRows[0].Cells[0].Value.ToString()); // PostCode = new Guid(gvDisconnector.SelectedRows[0].Cells[0].Value.ToString()); // AllowToclose = true; //} }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawRod DrawRod = new Atend.Global.Acad.DrawEquips.AcDrawRod(); if (Validation()) { if (Convert.ToBoolean(gvRod.Rows[gvRod.CurrentRow.Index].Cells[5].Value) == false) { DrawRod.UseAccess = true; DrawRod.ERod = Atend.Base.Equipment.ERod.AccessSelectByCode(Convert.ToInt32(gvRod.Rows[gvRod.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvRod.Rows[gvRod.CurrentRow.Index].Cells[5].Value)) { DrawRod.UseAccess = false; DrawRod.ERod = Atend.Base.Equipment.ERod.SelectByXCode(new Guid(gvRod.Rows[gvRod.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawRod.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawRod.ProjectCode = 0; } else { DrawRod.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawRod.SelectedObjectId = ObjID; ed.WriteMessage("SelectedObj={0}\n", DrawRod.SelectedObjectId); Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode); if (DrawRod.UpdateRodData(dpack.Code)) { ed.WriteMessage("Update Rod Success \n"); AllowClose = true; this.Close(); } } //if (gvRod.Rows.Count > 0) //{ // Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; // //ed.WriteMessage(gvRod.SelectedRows[0].Cells["Column1"].Value.ToString() + "\n"); // //ed.WriteMessage(gvRod.SelectedRows[0].Index.ToString()+ "\n"); // Atend.Base.Design.DPackage Pakage = Atend.Base.Design.DPackage.AccessSelectByCode(DpakageCode); // Pakage.ProductCode = Convert.ToInt32(gvRod.SelectedRows[0].Cells["Column1"].Value.ToString()); // if (Pakage.AccessUpdate()) // { // //ed.WriteMessage("OK"); // //Atend.Base.Acad.AT_INFO // Code = new Guid(gvRod.SelectedRows[0].Cells[0].Value.ToString()); // AllowClose = true; // this.Close(); // } // else // MessageBox.Show("انجام ويرايش امكانپذير نيست"); //} }
private void btnOk_Click(object sender, EventArgs e) { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Global.Acad.DrawEquips.AcDrawKalamp DrawKlamp = new Atend.Global.Acad.DrawEquips.AcDrawKalamp(); if (Validation()) { if (Convert.ToBoolean(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[3].Value) == false) { DrawKlamp.UseAccess = true; DrawKlamp.eClamp = Atend.Base.Equipment.EClamp.AccessSelectByCode(Convert.ToInt32(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[0].Value.ToString())); } else if (Convert.ToBoolean(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[3].Value)) { DrawKlamp.UseAccess = false; DrawKlamp.eClamp = Atend.Base.Equipment.EClamp.SelectByXCode(new Guid(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[1].Value.ToString())); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); DrawKlamp.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { DrawKlamp.ProjectCode = 0; } else { DrawKlamp.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } DrawKlamp.SelectedObjectId = objID; if (DrawKlamp.UpdateKalampData(NodeCode)) { ed.WriteMessage("Update Kalamp Success \n"); } } //////////////////////////////// //if (Validation()) //{ // Atend.Base.Design.DPackage Package = Atend.Base.Design.DPackage.AccessSelectByCode(DPackageCode); // Package.ProductCode = Convert.ToInt32(gvClamp.SelectedRows[0].Cells["XCode"].Value.ToString()); // if (Convert.ToBoolean(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[3].Value)) // { // //UseAccess = false // Atend.Base.Equipment.EClamp clamp = Atend.Base.Equipment.EClamp.SelectByXCode(new Guid(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[1].Value.ToString())); // if (clamp.AccessInsert()) // { // Package.NodeCode = clamp.XCode; // if (Package.AccessInsert()) // { // Code = new Guid(gvClamp.SelectedRows[0].Cells["XCode"].Value.ToString()); // this.Close(); // } // else // MessageBox.Show("انجام ويرايش امكانپذير نيست"); // } // else // MessageBox.Show("انجام ويرايش امكانپذير نيست"); // } // else if (Convert.ToBoolean(gvClamp.Rows[gvClamp.CurrentRow.Index].Cells[3].Value) == false) // { // //UseAccess = true // if (Package.AccessUpdate()) // { // Code = new Guid(gvClamp.SelectedRows[0].Cells["XCode"].Value.ToString()); // this.Close(); // } // else // MessageBox.Show("انجام ويرايش امكانپذير نيست"); // } // //Atend.Base.Acad.AcadGlobal.ClampData.Existance = Convert.ToByte(cboIsExist.SelectedIndex); //} }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { Atend.Base.Equipment.EStreetBox streetbox; List <Atend.Base.Equipment.EStreetBoxPhuse> list = new List <Atend.Base.Equipment.EStreetBoxPhuse>(); bool useAccess = false; if (Convert.ToBoolean(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[5].Value) == false) { streetbox = Atend.Base.Equipment.EStreetBox.AccessSelectByCode(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString())); useAccess = true; DataTable dt = Atend.Base.Equipment.EStreetBoxPhuse.AccessSelectByStreetBoxCode(Convert.ToInt32(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[0].Value.ToString())); foreach (DataRow dr in dt.Rows) { list.Add(Atend.Base.Equipment.EStreetBoxPhuse.AccessSelectByCode(Convert.ToInt32(dr["StreetBoxCode"].ToString()))); } } else //if (Convert.ToBoolean(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[5].Value) == true) { streetbox = Atend.Base.Equipment.EStreetBox.SelectByXCode(new Guid(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[1].Value.ToString())); useAccess = false; DataTable dt = Atend.Base.Equipment.EStreetBoxPhuse.SelectByStreetBoxXCode(new Guid(dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells[1].Value.ToString())); foreach (DataRow dr in dt.Rows) { list.Add(Atend.Base.Equipment.EStreetBoxPhuse.SelectByXCode(new Guid(dr["XCode"].ToString()))); } } Atend.Base.Acad.AcadGlobal.StreetBoxData.eStreetBoxPhuse = list; Atend.Base.Acad.AcadGlobal.StreetBoxData.UseAccess = useAccess; Atend.Base.Acad.AcadGlobal.StreetBoxData.eStreetBox = streetbox; Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist1.SelectedValue)); Atend.Base.Acad.AcadGlobal.StreetBoxData.Existance = status.ACode; if (cboProjCode1.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.StreetBoxData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.StreetBoxData.ProjectCode = Convert.ToInt32(cboProjCode1.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist1.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } AllowClose = true; } else { AllowClose = false; } }
//public void BindDataTocboInGrid() //{ // DataTable dt = Atend.Control.Common.StatuseCode.Copy(); // DataGridViewComboBoxColumn c = (DataGridViewComboBoxColumn)gvSubEquip.Columns["Column9"]; // c.DataSource = dt; // c.DisplayMember = "Name"; // c.ValueMember = "Code"; // DataTable dt2 = Atend.Base.Base.BProjectCode.SelectAll(); // DataGridViewComboBoxColumn c2 = (DataGridViewComboBoxColumn)gvSubEquip.Columns["Column12"]; // c2.DataSource = dt2; // c2.DisplayMember = "Name"; // c2.ValueMember = "Code"; //} //private void chkIsExist_CheckedChanged(object sender, EventArgs e) //{ // if (chkIsExist.Checked) // { // cboIsExist.Items.Clear(); // cboIsExist.Items.Add("برکناری-مستعمل"); // cboIsExist.Items.Add("برکناری-اسقات"); // } // else if (chkIsExist.CheckState == CheckState.Unchecked) // { // cboIsExist.Items.Clear(); // cboIsExist.Items.Add("نصب"); // } // cboIsExist.SelectedIndex = 0; // cboIsExist.Refresh(); //} //In Use private void btnOk_Click(object sender, EventArgs e) { Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Clear(); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Clear(); int ProjectCode; int Existance = 0; if (Validation()) { dtSuEquip = (DataTable)gvSubEquip.DataSource; //ed.WriteMessage("btnOK Click\n"); //ed.WriteMessage("IsSql={0}\n", gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value); if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true) { //ed.WriteMessage("It Is Local Wquipment\n"); Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = false; Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost; //for (int i = 0; i < gvSubEquip.Rows.Count; i++) foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { ProjectCode = 0; } else { ProjectCode = Convert.ToInt32(dr["ProjectCode"].ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel)) { Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer); } } } else { //ed.WriteMessage("It Is Access Wquipment\n"); Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = true; Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost; //for (int i = 0; i < gvSubEquip.Rows.Count; i++) foreach (DataRow dr in dtSuEquip.Rows) { Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString())); Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString()); if (dr["ProjectCode"].ToString() == "") { ProjectCode = 0; } else { ProjectCode = Convert.ToInt32(dr["ProjectCode"].ToString()); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel)) { Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel)) { Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek); } if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer)) { Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString())); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(ProjectCode); Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer); } } } Atend.Base.Base.BEquipStatus status02 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.GroundPostData.Existance = status02.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.GroundPostData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.GroundPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } } //ed.WriteMessage("Finish btnOK\n"); }