Пример #1
0
        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;
            }
        }
Пример #2
0
        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();
                }
            }
        }
Пример #3
0
        private void frmEditDrawBreaker02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            dtMerge = Atend.Base.Equipment.EBreaker.SelectAllAndMerge();
            Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            selecetedProductCode = dpack.ProductCode;

            Atend.Base.Design.DKeyStatus keystatus = Atend.Base.Design.DKeyStatus.SelectByNodeCode(NodeCode);
            ed.WriteMessage("keyStataus.IsClosed={0}\n", keystatus.IsClosed);
            if (keystatus.IsClosed)
            {
                rdbClose.Checked = true;
            }
            else
            {
                rdbOpen.Checked = true;
            }

            gvBreaker.AutoGenerateColumns = false;
            gvBreaker.DataSource          = dtMerge;

            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("Code,XCode", new object[2] {
                dpack.ProductCode, "00000000-0000-0000-0000-000000000000"
            }, dtMerge, gvBreaker, this);
            ChangeColor();
            for (int i = 0; i < gvBreaker.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvBreaker.Rows[i].Cells[1].Value.ToString()) == selecetedProductCode && Convert.ToBoolean(gvBreaker.Rows[i].Cells[2].Value.ToString()) == false)
                {
                    gvBreaker.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }


            BindDataToCboIsExist();
            //BindDataTocboProjCode();

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;
        }
Пример #4
0
        private bool SaveBreakerData()
        {
            Editor           ed          = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
            OleDbTransaction aTransaction;

            try
            {
                aConnection.Open();
                aTransaction = aConnection.BeginTransaction();

                try
                {
                    if (!UseAccess)
                    {
                        if (!eBreaker.AccessInsert(aTransaction, aConnection, true, true))
                        {
                            throw new System.Exception("eBreaker.AccessInsert failed");
                        }
                    }


                    BreakerPack             = new Atend.Base.Design.DPackage();
                    BreakerPack.Count       = 1;
                    BreakerPack.IsExistance = Existance;
                    BreakerPack.ProductCode = eBreaker.Code;
                    BreakerPack.Type        = (int)Atend.Control.Enum.ProductType.Breaker;
                    BreakerPack.ParentCode  = Guid.Empty;
                    BreakerPack.NodeCode    = Guid.Empty;
                    BreakerPack.LoadCode    = 0;
                    BreakerPack.Number      = "";
                    BreakerPack.ProjectCode = ProjectCode;
                    if (!BreakerPack.AccessInsert(aTransaction, aConnection))
                    {
                        throw new System.Exception("dPack.AccessInsert failed");
                    }

                    DKeyStatus          = new Atend.Base.Design.DKeyStatus();
                    DKeyStatus.NodeCode = BreakerPack.Code;
                    DKeyStatus.Type     = (int)Atend.Control.Enum.ProductType.Breaker;;
                    DKeyStatus.IsClosed = false;
                    if (!DKeyStatus.Insert(aTransaction, aConnection))
                    {
                        throw new System.Exception("DKeyStatus.AccessInsert failed");
                    }
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR SaveBreakerData 02 :{0} \n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR SaveBreakerData 01 :{0} \n", ex.Message);
                aConnection.Close();
                return(false);
            }

            aTransaction.Commit();
            aConnection.Close();

            #region Not to Get Green

            Atend.Base.Acad.AcadGlobal.BreakerData.UseAccess = true;
            //UseAccess = true;

            #endregion

            return(true);
        }
Пример #5
0
        //~~~~~~~~~~~~~~~~~~~~ METHODS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

        public AcDrawBreaker()
        {
            BreakerPack = new Atend.Base.Design.DPackage();
            DKeyStatus  = new Atend.Base.Design.DKeyStatus();
        }
Пример #6
0
        private void frmEditDrawDisconnector02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            dtMerge = Atend.Base.Equipment.EDisconnector.SelectAllAndMerge();

            System.Data.DataColumn dcTypeName = new System.Data.DataColumn("TypeName");
            dtMerge.Columns.Add(dcTypeName);
            foreach (DataRow dr in dtMerge.Rows)
            {
                if (Convert.ToInt32(dr["Type"].ToString()) == 1)
                {
                    dr["TypeName"] = "سکسیونر هوایی غیر قابل قطع زیر بار";
                }
                if (Convert.ToInt32(dr["Type"].ToString()) == 2)
                {
                    dr["TypeName"] = "سکسیونر هوایی قابل قطع زیر بار";
                }
                if (Convert.ToInt32(dr["Type"].ToString()) == 3)
                {
                    dr["TypeName"] = "سکسیونر SF6 قابل قطع زیر بار";
                }
            }
            Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            selecetdProductCode = dpack.ProductCode;

            Atend.Base.Design.DKeyStatus keyStatus = Atend.Base.Design.DKeyStatus.SelectByNodeCode(NodeCode);

            if (keyStatus.IsClosed)
            {
                rdbClose.Checked = true;
            }
            else
            {
                rdbOpen.Checked = true;
            }


            gvDisconnector.AutoGenerateColumns = false;
            gvDisconnector.DataSource          = dtMerge;

            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("Code,XCode", new object[2] {
                selecetdProductCode, "00000000-0000-0000-0000-000000000000"
            }, dtMerge, gvDisconnector, this);
            ChangeColor();
            for (int i = 0; i < gvDisconnector.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvDisconnector.Rows[i].Cells[1].Value.ToString()) == selecetdProductCode && Convert.ToBoolean(gvDisconnector.Rows[i].Cells[2].Value.ToString()) == false)
                {
                    gvDisconnector.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }

            BindDataToComboBoxIsExist();
            //BindDataTocboProjCode();

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;
        }
Пример #7
0
        //~~~~~~~~~~~~~~~~~~~Method~~~~~~~~~~~~~~

        public AcDrawDisConnector()
        {
            eDisConnector = new Atend.Base.Equipment.EDisconnector();
            DKeyStatus    = new Atend.Base.Design.DKeyStatus();
        }
Пример #8
0
        //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Method~~~~~~~~~

        public AcDrawCatOut()
        {
            DKeyStatus = new Atend.Base.Design.DKeyStatus();
        }