Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        private void frmEditDrawDB02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

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

            gvStreetBox.AutoGenerateColumns = false;
            gvStreetBox.DataSource          = dtMerge;

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

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;
        }
Ejemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            Atend.Global.Acad.DrawEquips.AcDrawCatOut DrawCatOut = new Atend.Global.Acad.DrawEquips.AcDrawCatOut();
            if (Validation())
            {
                if (Convert.ToBoolean(gvCatOut.Rows[gvCatOut.CurrentRow.Index].Cells[2].Value) == false)
                {
                    DrawCatOut.UseAccess = true;
                    DrawCatOut.ECatOut   = Atend.Base.Equipment.ECatOut.AccessSelectByCode(Convert.ToInt32(gvCatOut.Rows[gvCatOut.CurrentRow.Index].Cells[1].Value.ToString()));
                }
                else if (Convert.ToBoolean(gvCatOut.Rows[gvCatOut.CurrentRow.Index].Cells[2].Value))
                {
                    DrawCatOut.UseAccess = false;
                    DrawCatOut.ECatOut   = Atend.Base.Equipment.ECatOut.SelectByXCode(new Guid(gvCatOut.Rows[gvCatOut.CurrentRow.Index].Cells[0].Value.ToString()));
                }
                DrawCatOut.Existance   = Convert.ToByte(cboIsExist.SelectedValue);
                DrawCatOut.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);



                DrawCatOut.SelectedObjectId = ObjID;
                Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);

                if (DrawCatOut.UpdateCatOutData(dpack.Code))
                {
                    ed.WriteMessage("Update CatOut Success \n");
                    AllowClose = true;
                    this.Close();
                }
            }
        }
Ejemplo n.º 4
0
        public bool UpdateRodData(Guid EXCode)
        {
            Editor           ed = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbTransaction aTransaction;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);

            try
            {
                aConnection.Open();
                aTransaction = aConnection.BeginTransaction();
                try
                {
                    RodPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode);
                    //ed.WriteMessage("**RodPAck.Code={0}\n",RodPack.Code);
                    if (!UseAccess)
                    {
                        if (!ERod.AccessInsert(aTransaction, aConnection, true, true))
                        {
                            throw new System.Exception("eRod.AccessInsert failed");
                        }
                    }
                    RodPack.IsExistance = Existance;
                    RodPack.ProductCode = ERod.Code;
                    RodPack.ProjectCode = ProjectCode;
                    RodPack.Number      = "";
                    if (RodPack.AccessUpdate(aTransaction, aConnection))
                    {
                        //ed.WriteMessage("ERod.Code={0},SelectedRod.ObjId={1}\n",ERod.Code,selectedObjectId);
                        Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);// id);

                        atinfo.ProductCode = ERod.Code;
                        atinfo.Insert();
                        ChangeComment(selectedObjectId, ERod.Comment);
                    }
                    else
                    {
                        throw new System.Exception("RodPack.AccessInsert2 failed");
                    }
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR Updaterod 01(transaction) : {0} \n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR UpdateRod 01 : {0} \n", ex.Message);
                aConnection.Close();
                return(false);
            }

            aTransaction.Commit();
            aConnection.Close();
            return(true);
        }
Ejemplo n.º 5
0
        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;
            }
        }
Ejemplo n.º 6
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            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);// SelectByCode(DpakageCode);
                //Pakage. ProductCode = new Guid(gvBankKhazan.SelectedRows[0].Cells["Column7"].Value.ToString());

                //if (Pakage.Update())
                {
                    ed.WriteMessage("update is comment");
                    //Atend.Base.Acad.AT_INFO
                    Code       = Convert.ToInt32(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;
            //}
        }
Ejemplo n.º 7
0
        public bool UpdateLightData(Guid EXCode)
        {
            Editor           ed = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbTransaction aTransaction;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);

            try
            {
                aConnection.Open();
                aTransaction = aConnection.BeginTransaction();
                try
                {
                    LightPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode);
                    if (!UseAccess)
                    {
                        if (!eLight.AccessInsert(aTransaction, aConnection, true, true))
                        {
                            throw new System.Exception("eLight.AccessInsert failed");
                        }
                    }
                    LightPack.IsExistance = Existance;
                    LightPack.ProjectCode = ProjectCode;
                    LightPack.ProductCode = eLight.Code;
                    LightPack.Number      = "";
                    if (LightPack.AccessUpdate(aTransaction, aConnection))
                    {
                        Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);
                        atinfo.ProductCode = eLight.Code;
                        atinfo.Insert();
                        ChangeComment(Atend.Global.Acad.UAcad.GetEntityGroup(selectedObjectId), eLight.Comment);
                    }
                    else
                    {
                        throw new System.Exception("LightPack.AccessInsert2 failed");
                    }
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR UpdateLight 01(transaction) : {0} \n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR UpdateLight 01 : {0} \n", ex.Message);
                aConnection.Close();
                return(false);
            }

            aTransaction.Commit();
            aConnection.Close();
            return(true);
        }
Ejemplo n.º 8
0
        private void frmDrawKhazan_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

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

            gvBankKhazan.AutoGenerateColumns = false;
            gvBankKhazan.DataSource          = dtMerge;

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

            BindDataToComboBoxIsExist();
            //BindDataTocboProjCode();

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;

            //Atend.Base.Acad.AcadGlobal.dPackageForKhazanTip = new Atend.Base.Design.DPackage();
            //Atend.Base.Acad.AcadGlobal.dPackageForKhazan.Clear();
            //gvBankKhazan.AutoGenerateColumns = false;
            //gvKhazan.AutoGenerateColumns = false;

            //gvBankKhazan.DataSource = Atend.Base.Equipment.EKhazanTip.DrawSearch(txName.Text);
            //gvKhazan.DataSource = null;


            //for (int i = 0; i < gvBankKhazan.Rows.Count; i++)
            //{
            //    if (new Guid(gvBankKhazan.Rows[i].Cells["Column2"].Value.ToString()) == Code)
            //    {
            //        gvBankKhazan.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
            //    }
            //}

            //ContainerPackageCode
            //gvKhazan.DataSource = Atend.Base.Equipment.EKhazan.DrawSearch(
            //   Convert.ToInt32(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[0].Value));
            //gvKhazan.DataSource = Atend.Base.Equipment.EKhazan.DrawSearch(
            //   new Guid(gvBankKhazan.Rows[gvBankKhazan.CurrentRow.Index].Cells[0].Value.ToString()));
        }
Ejemplo n.º 9
0
        private void frmEditConsol_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            //BindDataToForm();

            BindDataToComboBoxIsExist();
            if (cboType.Items.Count > 0)
            {
                cboType.SelectedIndex = 0;
            }

            Dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            //ed.WriteMessage("((={0}\n", Dpack.Code.ToString());
            SelectedProductCode = Dpack.ProductCode;
            Atend.Base.Equipment.EConsol Consol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Dpack.ProductCode);


            Volt                      = Consol.VoltageLevel;
            txtCount.Text             = Dpack.Count.ToString();
            CboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(Dpack.IsExistance).Code;
            CboProjCode.SelectedValue = Dpack.ProjectCode;



            //ed.WriteMessage("**Volt={0}\n", Volt);



            dtMergeConsol = Atend.Base.Equipment.EConsol.SelectAllAndMerge();

            dtMergeConsol.DefaultView.RowFilter = " VoltageLevel = '" + Volt + "'";
            //DataView dv = new DataView();
            //dv.Table = dtMergeConsol;
            //dv.RowFilter = " VoltageLevel = '" + Volt + "'";

            gvConsol.AutoGenerateColumns = false;
            gvConsol.DataSource          = dtMergeConsol;
            ChangeColor();

            for (int i = 0; i < gvConsol.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvConsol.Rows[i].Cells[1].Value.ToString()) == Dpack.ProductCode)
                {
                    gvConsol.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }
            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("Code,Xcode", new object[2] {
                SelectedProductCode, "00000000-0000-0000-0000-000000000000"
            }, dtMergeConsol, gvConsol, this);
        }
Ejemplo n.º 10
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();
                }
            }
        }
Ejemplo n.º 11
0
        public bool UpdateKalampData(Guid NodeCode)
        {
            Editor           ed          = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
            OleDbTransaction aTransaction;

            try
            {
                aConnection.Open();
                aTransaction = aConnection.BeginTransaction();
                try
                {
                    ClampPack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
                    if (!UseAccess)
                    {
                        if (!eClamp.AccessInsert(aTransaction, aConnection, true, true))//aTransaction, aConnection))??
                        {
                            throw new System.Exception("eClamp.AccessInsert failed");
                        }
                    }
                    ClampPack.IsExistance = Existance;
                    ClampPack.ProductCode = eClamp.Code;
                    ClampPack.ProjectCode = ProjectCode;
                    if (ClampPack.AccessUpdate())
                    {
                        Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);
                        atinfo.ProductCode = eClamp.Code;
                        atinfo.Insert();
                    }
                    else
                    {
                        throw new System.Exception("ClampPack.AccessInsert2 failed");
                    }
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR UpdateKalampData 01 : {0} \n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR UpdateKalampData 01 : {0} \n", ex.Message);
                aConnection.Close();
                return(false);
            }
            aTransaction.Commit();
            aConnection.Close();
            return(true);
        }
Ejemplo n.º 12
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            this.Hide();
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            PromptEntityOptions peo = new PromptEntityOptions("\nSelect Entity:");
            PromptEntityResult  per = ed.GetEntity(peo);

            Atend.Base.Acad.AT_INFO atInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(per.ObjectId);
            //ed.WriteMessage("NodeType={0}\n",atInfo.NodeType);
            if ((atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.Consol)) || (atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.Kalamp)) || (atInfo.NodeType == Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel)))
            {
                CanDoCalculate = true;
                consolobj      = Convert.ToInt32(per.ObjectId.ToString().Substring(1, per.ObjectId.ToString().Length - 2));
                Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(atInfo.NodeCode));
                if (dPack.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Kalamp))
                {
                    Atend.Base.Equipment.EClamp eClamp = Atend.Base.Equipment.EClamp.AccessSelectByCode(dPack.ProductCode);
                    txtNamedVoltage.Text = eClamp.VoltageLevel.ToString();
                    txtVoltTev.Text      = eClamp.VoltageLevel.ToString();
                }
                else if (dPack.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Consol))
                {
                    Atend.Base.Equipment.EConsol eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(dPack.ProductCode);
                    txtNamedVoltage.Text = eConsol.VoltageLevel.ToString();
                    txtVoltTev.Text      = eConsol.VoltageLevel.ToString();
                }
                else if (dPack.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel))
                {
                    Atend.Base.Equipment.EHeaderCabel eHeaderCabel = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(dPack.ProductCode);
                    txtNamedVoltage.Text = eHeaderCabel.Voltage.ToString();
                    txtVoltTev.Text      = eHeaderCabel.Voltage.ToString();
                }

                txtR.Text = "0";
                txtX.Text = "0";
            }
            else
            {
                MessageBox.Show("لطفت جهت شروع محاسبات یک گره را انتخاب کنید");
                CanDoCalculate = false;
            }
            //ed.WriteMessage("ca={0}\n",CanDoCalculate);
            this.Show();
        }
Ejemplo n.º 13
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;
        }
        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;
            }
        }
Ejemplo n.º 15
0
        private void frmEditDrawCatOut02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            BindDataTocboProjCode();
            dtMerge = Atend.Base.Equipment.ECatOut.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"] = "کات اوت نوع T";
                }
                if (Convert.ToInt32(dr["Type"].ToString()) == 2)
                {
                    dr["TypeName"] = "کات اوت نوع K";
                }
                if (Convert.ToInt32(dr["Type"].ToString()) == 2)
                {
                    dr["TypeName"] = "کات اوت نوع KT";
                }
            }
            gvCatOut.AutoGenerateColumns = false;
            gvCatOut.DataSource          = dtMerge;

            ChangeColor();
            BindDataToComboBoxIsExist();

            Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            for (int i = 0; i < gvCatOut.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvCatOut.Rows[i].Cells[0].Value.ToString()) == dpack.ProductCode && Convert.ToBoolean(gvCatOut.Rows[i].Cells[2].Value.ToString()) == false)
                {
                    gvCatOut.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }
        }
Ejemplo n.º 16
0
        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;
            }
        }
Ejemplo n.º 17
0
        private void frmEditDrawClamp02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

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

            gvClamp.AutoGenerateColumns = false;
            gvClamp.DataSource          = dtMerge;

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

            BindDataToComboBoxIsExist();
            //BindDataTocboProjCode();

            //int vol = -1;
            //if (chkVol.Checked)
            //    vol = Convert.ToInt32(cboVol.SelectedValue);
            //DataTable dt = Atend.Base.Equipment.EClamp.DrawSearch(vol);
            //gvClamp.AutoGenerateColumns = false;
            //gvClamp.DataSource = dt;

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;
        }
Ejemplo n.º 18
0
        private void BindDataToGridSection()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            foreach (DataRow dr in dtSectionNumber.Rows)
            {
                ed.WriteMessage("SectionCode={0},SectionNumber={1}\n", new Guid(dr["SectionCode"].ToString()), dr["SectionNumber"].ToString());
                Atend.Base.Calculating.CStartEnd startEnd = Atend.Base.Calculating.CStartEnd.AccessSelectBySectionCode(new Guid(dr["SectionCode"].ToString()));
                ed.WriteMessage("*****Start={0},End={1}\n", startEnd.StartPole, startEnd.EndPole);
                Atend.Base.Design.DPackage dPackStart = Atend.Base.Design.DPackage.AccessSelectByNodeCode(startEnd.StartPole);

                Atend.Base.Design.DPackage dPackEnd = Atend.Base.Design.DPackage.AccessSelectByNodeCode(startEnd.EndPole);

                dr["StartPole"] = dPackStart.Number;
                dr["EndPole"]   = dPackEnd.Number;


                Atend.Base.Calculating.CSetDefaultMec cSetDefaultmec = Atend.Base.Calculating.CSetDefaultMec.AccessSelect();
                System.Data.DataTable dtNetDefault = Atend.Base.Calculating.CNetWorkCross.AccessSelectAll();

                Atend.Base.Calculating.CDefaultRudSurface defaultRudSurface = Atend.Base.Calculating.CDefaultRudSurface.AccessSelectBySectionCode(new Guid(dr["SectionCode"].ToString()));
                if (defaultRudSurface.Code != 0)
                {
                    dr["UTS"]          = defaultRudSurface.UTS;
                    dr["NetCrossCode"] = defaultRudSurface.NetCross;
                }
                else
                {
                    dr["UTS"]          = cSetDefaultmec.Uts;
                    dr["NetCrossCode"] = Convert.ToInt32(dtNetDefault.Rows[0]["Code"].ToString());
                }
            }
            ed.WriteMessage(" EXIT BindDataToGridSection\n");
            gvSection.AutoGenerateColumns = false;
            gvSection.DataSource          = dtSectionNumber;
        }
Ejemplo n.º 19
0
        private void poleInsertionMenu_Click(object sender, EventArgs e)
        {
            Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            this.Cursor = Cursors.WaitCursor;
            try
            {
                if (Validation() && gvBranches.Rows.Count > 0)
                {
                    //foreach (Autodesk.AutoCAD.DatabaseServices.Entity ent in SelectdEntities)
                    for (int i = 0; i < gvBranches.Rows.Count; i++)
                    {
                        //SelectdEntities.Clear();
                        Atend.Global.Calculation.Mechanical.CAutoPoleInstallation _AutoPoleInstallation = new Atend.Global.Calculation.Mechanical.CAutoPoleInstallation();
                        //ed.WriteMessage("--$$--1\n");
                        _AutoPoleInstallation.Se = Convert.ToDouble(txtSe.Text);
                        //ed.WriteMessage("--$$--2\n");
                        _AutoPoleInstallation.ChangePercent = Convert.ToDouble(txtTolerance.Text);
                        //ed.WriteMessage("--$$--3\n");
                        _AutoPoleInstallation.UTS = Convert.ToDouble(txtUTS.Text);
                        //ed.WriteMessage("--$$--4\n");
                        _AutoPoleInstallation.NetCrossCode = Convert.ToInt32(cboConsolCross.SelectedValue);
                        //ed.WriteMessage("--$$--5\n");
                        _AutoPoleInstallation.Relibility = Convert.ToDouble(txtRelibility.Text);
                        //ed.WriteMessage("--$$--6\n");
                        _AutoPoleInstallation.MaxSectionLength = Convert.ToDouble(txtMaxSectionLength.Text);
                        //ed.WriteMessage("--$$--7\n");
                        _AutoPoleInstallation.SelectedBranch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(gvBranches.Rows[i].Cells["BranchCode"].Value.ToString()));
                        //ed.WriteMessage("--$$--8\n");



                        Atend.Base.Design.DPackage PolePackage = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(gvBranches.Rows[i].Cells["PoleCode"].Value.ToString()));
                        if (PolePackage.Type == (int)Atend.Control.Enum.ProductType.Pole)
                        {
                            _AutoPoleInstallation.SelectedPole = Atend.Base.Equipment.EPole.AccessSelectByCode(PolePackage.ProductCode);
                        }
                        else if (PolePackage.Type == (int)Atend.Control.Enum.ProductType.PoleTip)
                        {
                            Atend.Base.Equipment.EPoleTip PoleTip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(PolePackage.ProductCode);
                            if (PoleTip.Code != -1)
                            {
                                _AutoPoleInstallation.SelectedPole = Atend.Base.Equipment.EPole.AccessSelectByCode(PoleTip.PoleCode);
                            }
                        }



                        //ed.WriteMessage("--$$--9\n");


                        if (cboBranchType.SelectedIndex == 0)
                        {
                            DataRow[] drs = dtMergeConsol.Select("ROWNO=" + cboConsolCross.SelectedValue.ToString());
                            if (drs.Length > 0 && Convert.ToBoolean(drs[0]["IsSql"]) == true)
                            {
                                _AutoPoleInstallation.SelectedConsol = Atend.Base.Equipment.EConsol.SelectByXCodeForDesign(new Guid(drs[0]["XCode"].ToString()));
                            }
                            else
                            {
                                _AutoPoleInstallation.SelectedConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(drs[0]["Code"]));
                            }

                            drs = dtMergeConsol.Select("ROWNO=" + cboConsolTension.SelectedValue.ToString());
                            if (drs.Length > 0 && Convert.ToBoolean(drs[0]["IsSql"]) == true)
                            {
                                _AutoPoleInstallation.SelectedConsolTension = Atend.Base.Equipment.EConsol.SelectByXCodeForDesign(new Guid(drs[0]["XCode"].ToString()));
                            }
                            else
                            {
                                _AutoPoleInstallation.SelectedConsolTension = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(drs[0]["Code"]));
                            }

                            _AutoPoleInstallation.SelectedClamp        = null;
                            _AutoPoleInstallation.SelectedClampTension = null;
                        }
                        else
                        {
                            _AutoPoleInstallation.SelectedConsol        = null;
                            _AutoPoleInstallation.SelectedConsolTension = null;

                            DataRow[] drs = dtMergeClamp.Select("ROWNO=" + cboClampCross.SelectedValue.ToString());
                            if (drs.Length > 0 && Convert.ToBoolean(drs[0]["IsSql"]) == true)
                            {
                                _AutoPoleInstallation.SelectedClamp = Atend.Base.Equipment.EClamp.SelectByXCodeForDesign(new Guid(drs[0]["XCode"].ToString()));
                            }
                            else
                            {
                                _AutoPoleInstallation.SelectedClamp = Atend.Base.Equipment.EClamp.AccessSelectByCode(Convert.ToInt32(drs[0]["Code"]));
                            }


                            drs = dtMergeClamp.Select("ROWNO=" + cboClampTension.SelectedValue.ToString());
                            if (drs.Length > 0 && Convert.ToBoolean(drs[0]["IsSql"]) == true)
                            {
                                _AutoPoleInstallation.SelectedClampTension = Atend.Base.Equipment.EClamp.SelectByXCodeForDesign(new Guid(drs[0]["XCode"].ToString()));
                            }
                            else
                            {
                                _AutoPoleInstallation.SelectedClampTension = Atend.Base.Equipment.EClamp.AccessSelectByCode(Convert.ToInt32(drs[0]["Code"]));
                            }
                        }
                        //ed.WriteMessage("CLAMP CROSS : {0} \n", _AutoPoleInstallation.SelectedClamp.Name);
                        //ed.WriteMessage("CLAMP CROSS TENSION : {0} \n", _AutoPoleInstallation.SelectedClampTension.Name);


                        _AutoPoleInstallation.BranchEntity = Atend.Global.Acad.UAcad.GetEntityByObjectID(new Autodesk.AutoCAD.DatabaseServices.ObjectId(new IntPtr(Convert.ToInt32(gvBranches.Rows[i].Cells["BranchOI"].Value)))) as Autodesk.AutoCAD.DatabaseServices.Line;
                        //_AutoPoleInstallation.BranchEntity = Atend.Global.Acad.UAcad.GetEntityByObjectID(BranchOi) as Autodesk.AutoCAD.DatabaseServices.Line;
                        if (_AutoPoleInstallation.PoleInstallationWithoutForbiddenArea(new Guid(gvBranches.Rows[i].Cells["PoleCode"].Value.ToString())))

                        //ed.WriteMessage("--$$--11\n");
                        //double answer = 0;
                        //int t = _AutoPoleInstallation.SpanCalculation(out answer);
                        //MessageBox.Show("answer:" + answer + "t:" + t);
                        {
                            DataGridViewImageCell _IC = gvBranches.Rows[i].Cells["StatusImage"] as DataGridViewImageCell;
                            if (_IC != null)
                            {
                                _IC.Value = new Bitmap(Atend.Control.Common.fullPath + @"\Icon\button_ok.png");
                                ed.WriteMessage("image assigned \n");
                                gvBranches.Refresh();
                            }
                        }
                        else
                        {
                            MessageBox.Show("خطا در زمان انجام پایه گذاری اتوماتیک");
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            this.Cursor = Cursors.Default;
        }
Ejemplo n.º 20
0
        public void BindDataToOwnControl()
        {
            // BindDataTofeathurePole

            //ed.WriteMessage("DesignCode=" + Atend.Control.Common.SelectedDesignCode.ToString() + "\n");
            Atend.Base.Design.DNode myNode = Atend.Base.Design.DNode.AccessSelectByCode(NodeCode);
            //ed.WriteMessage("myNode.Code= " + myNode.Code.ToString() + "\n");

            Atend.Base.Design.DPackage myPackage = Atend.Base.Design.DPackage.AccessSelectByNodeCodeType(myNode.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Pole));
            //ed.WriteMessage("myPackage.ProductCode= " + myPackage.ProductCode.ToString() + "\n");

            Atend.Base.Equipment.EPole myPole = Atend.Base.Equipment.EPole.AccessSelectByCode(myNode.ProductCode);
            //Extra
            //Atend.Base.Equipment.EPoleType myPoleType = Atend.Base.Equipment.EPoleType.SelectByCode(myPole.Type);
            //ed.WriteMessage("myPole.Height.ToString()" + myPole.Height.ToString() + "\n");
            gvPole.AutoGenerateColumns = false;
            gvPole.DataSource          = Atend.Base.Equipment.EPole.DrawSearch(-1, -1, -1);
            for (int i = 0; i < gvPole.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvPole.Rows[i].Cells[0].Value.ToString()) == myNode.ProductCode)
                {
                    gvPole.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }
            //Extra
            //txtType.Text = myPoleType.Name;
            txtTopCrossSectionArea.Text = myPole.TopCrossSectionArea.ToString();
            txtPower.Text  = myPole.Power.ToString();
            txtHeight.Text = myPole.Height.ToString();
            txtBottomCrossSectionArea.Text = myPole.ButtomCrossSectionArea.ToString();
            //ed.WriteMessage("Finish BindDataTofeathurePole\n");
            //****************************

            //BindDataToHalterAndPoleTypeAndConsolType
            Atend.Base.Design.DPoleInfo myPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(myNode.Code);

            //ed.WriteMessage("myPoleInfo.HalterType:=" + myPoleInfo.HalterType.ToString() + "\n");
            //ed.WriteMessage("myPoleInfo.HalterCount:=" + myPoleInfo.HalterCount.ToString());

            cboHalterType.SelectedValue = myPoleInfo.HalterType;

            nudHalter.Value = myPoleInfo.HalterCount;

            //string poleType = myPoleInfo.PoleType.ToString();
            //if (poleType.EndsWith("1"))
            //{
            //    chkCross.Checked = true;
            //}

            //if (poleType.EndsWith("2"))
            //{
            //    chkEnding.Checked = true;
            //}

            //if (poleType.EndsWith("4"))
            //{
            //    chkPulling.Checked = true;
            //}
            //ed.WriteMessage("FinishBindDataToHalterAndPoleTypeAndConsolType\n");
            //*****************************

            //BindDataToConsol

            DataTable dtPackage = Atend.Base.Design.DPackage.AccessSelectByParentCodeAndType(myPackage.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Consol));

            foreach (DataRow drPackage in dtPackage.Rows)
            {
                //ed.WriteMessage("ProductCode= " + drPackage["ProductCode"].ToString() + "\n");
                Atend.Base.Equipment.EConsol consol = Atend.Base.Equipment.EConsol.SelectByCodeForDesign(Convert.ToInt32(drPackage["ProductCode"]));
                gvPoleConsol.Rows.Add();
                //ed.WriteMessage("Code= "+consol.Code+"Name= "+consol.Name+"\n");
                gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[0].Value = consol.Code.ToString();
                gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[1].Value = consol.Name;
                //ed.WriteMessage("as\n");
                if (consol.ConsolType == 0)
                {
                    gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "کششی";
                }
                if (consol.ConsolType == 1)
                {
                    gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "انتهایی";
                }
                if (consol.ConsolType == 2)
                {
                    gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "عبوری";
                }
                if (consol.ConsolType == 3)
                {
                    gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[2].Value = "DP";
                }
                gvPoleConsol.Rows[gvPoleConsol.Rows.Count - 1].Cells[4].Value = drPackage["Code"].ToString();
            }
            //ed.WriteMessage("FinishBindDataToconsol\n");
            //*****************************
        }
Ejemplo n.º 21
0
        private void پروندهToolStripMenuItem_Click(object sender, EventArgs e)
        {
            calcOptimalSagTension = new Atend.Global.Calculation.Mechanical.CalcOptimalSagTensionTest();

            if (Validation())
            {
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                calcOptimalSagTension.DtPoleSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(cboSelectSection.SelectedValue.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.Pole));
                ed.WriteMessage("dtPoleSection1={0}\n", calcOptimalSagTension.DtPoleSection.Rows.Count);
                System.Data.DataTable dtPole = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(cboSelectSection.SelectedValue.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.PoleTip));

                ed.WriteMessage("dtPoleSection2={0}\n", calcOptimalSagTension.DtPoleSection.Rows.Count);
                foreach (DataRow dr in dtPole.Rows)
                {
                    DataRow drPole = calcOptimalSagTension.DtPoleSection.NewRow();
                    drPole["ProductType"] = dr["ProductType"].ToString();
                    drPole["ProductCode"] = dr["ProductCode"].ToString();
                    drPole["SectionCode"] = dr["SectionCode"].ToString();
                    calcOptimalSagTension.DtPoleSection.Rows.Add(drPole);
                }

                System.Data.DataColumn dc = new System.Data.DataColumn("PoleNumber");
                calcOptimalSagTension.DtPoleSection.Columns.Add(dc);
                foreach (DataRow dr in calcOptimalSagTension.DtPoleSection.Rows)
                {
                    Atend.Base.Design.DPackage node = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(dr["ProductCode"].ToString()));
                    dr["PoleNumber"] = node.Number.ToString();
                }
                calcOptimalSagTension.VTS          = Convert.ToDouble(txtVTS.Text);
                calcOptimalSagTension.Volt         = Convert.ToDouble(cboVolt.Text);
                calcOptimalSagTension.DtPoleCond   = section.dtGlobal;
                calcOptimalSagTension.dtBranchList = section.dtBranchList;

                //ed.WriteMessage("Befor Read NetCross\n");
                for (int i = 0; i < gvNetCross.Rows.Count; i++)
                {
                    if (Convert.ToInt32(gvNetCross.Rows[i].Cells[0].Value) == Convert.ToInt32(cboSelectSection.Text))
                    {
                        DataGridViewComboBoxCell cboNetCross = (DataGridViewComboBoxCell)gvNetCross.Rows[i].Cells["Column2"];
                        NetCross = Atend.Base.Calculating.CNetWorkCross.AccessSelectByCode(Convert.ToInt32(cboNetCross.Value.ToString()));
                    }
                }

                if (cboVolt.Text == "400")
                {
                    calcOptimalSagTension.Clearance = NetCross.V380;
                }
                if (cboVolt.Text == "11000")
                {
                    calcOptimalSagTension.Clearance = NetCross.KV11;
                }
                if (cboVolt.Text == "20000")
                {
                    calcOptimalSagTension.Clearance = NetCross.KV20;
                }
                if (cboVolt.Text == "33000")
                {
                    calcOptimalSagTension.Clearance = NetCross.KV32;
                }
                //ed.WriteMessage("Create DtconductorSectionConsol={0}\n", cboSelectSection.SelectedValue.ToString());

                calcOptimalSagTension.DtconductorSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(cboSelectSection.SelectedValue.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor));
                if (calcOptimalSagTension.DtconductorSection.Rows.Count == 0)
                {
                    //ed.WriteMessage("Create DtconductorSection={0}\n", cboSelectSection.SelectedValue.ToString());
                    calcOptimalSagTension.DtconductorSection = Atend.Base.Design.DPoleSection.AccessSelectBySectionCodeProductType(new Guid(cboSelectSection.SelectedValue.ToString()), Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper));
                    //ed.WriteMessage("Count={0}\n", calcOptimalSagTension.DtconductorSection.Rows.Count);
                }

                System.Data.DataColumn dc1 = new System.Data.DataColumn("Angle");
                calcOptimalSagTension.DtconductorSection.Columns.Add(dc1);
                calcOptimalSagTension.SectionCode = new Guid(cboSelectSection.SelectedValue.ToString());
                calcOptimalSagTension.Start       = Convert.ToInt32(txtStart.Text);
                calcOptimalSagTension.End         = Convert.ToInt32(txtEnd.Text);
                calcOptimalSagTension.Distance    = Convert.ToInt32(txtDistance.Text);
                Atend.Base.Design.DBranch MyBranch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(calcOptimalSagTension.DtconductorSection.Rows[0]["ProductCode"].ToString()));
                //ed.WriteMessage("OOO\n");
                dtSagTension.Rows.Clear();
                dtPole.Rows.Clear();
                dtConductorDay.Rows.Clear();

                se        = calcOptimalSagTension.ComputeSE();
                SpanCount = calcOptimalSagTension.DtconductorSection.Rows.Count;

                dtSagTension   = calcOptimalSagTension.CalSagTension(MyBranch).Copy();
                dtConductorDay = calcOptimalSagTension.CalcTempTable();

                gvSagAndTension.AutoGenerateColumns = false;
                gvPole.AutoGenerateColumns          = false;

                gvSagAndTension.DataSource = dtSagTension;
                gvConductorDay.DataSource  = dtConductorDay;
                dtPole            = calcOptimalSagTension.WindOnPole();
                gvPole.DataSource = dtPole;
                //calcOptimalSagTension.IsSagOk();


                DataRow dr1 = dtRow.NewRow();
                dr1["ProjectName"] = "";
                dr1["NumSection"]  = cboSelectSection.Text;
                dr1["FirstPole"]   = "";
                dr1["LastPole"]    = "";
                dr1["UTS"]         = txtVTS.Text;
                dr1["SE"]          = se.ToString();
                dr1["SpanCount"]   = SpanCount;
                dr1["SpanLenght"]  = "";
                dr1["CondName"]    = gvSagAndTension.Rows[0].Cells[0].Value;
                dtRow.Rows.Add(dr1);
            }
        }
Ejemplo n.º 22
0
        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;
            //}
        }
Ejemplo n.º 23
0
        private void frmDrawPoleTip02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            BindDataToComboBoxIsExist();
            BindDataToCboInGridView();
            AddProjectCodeColumn();

            dtMergePoleTip = Atend.Base.Equipment.EPoleTip.SelectAllAndMerge();
            Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(NodeCode);
            selectedProductCode = dPack.ProductCode;

            gvPoleTip.AutoGenerateColumns = false;
            gvPoleTip.DataSource          = dtMergePoleTip;

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

            Atend.Base.Design.DNode node = Atend.Base.Design.DNode.AccessSelectByCode(NodeCode);
            txtHeight.Text = Convert.ToString(Math.Round(node.Height, 2));

            dtgvPoleConsol = Atend.Base.Design.DPackage.AccessSelectByParentCodeForConsol(dPack.Code, (int)Atend.Control.Enum.ProductType.Consol);

            dtHalt = Atend.Base.Design.DPackage.AccessSelectByParentCodeAndType(dPack.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Halter));
            if (dtHalt.Rows.Count > 0)
            {
                Atend.Base.Equipment.EHalter Halter = Atend.Base.Equipment.EHalter.AccessSelectByCode(Convert.ToInt32(dtHalt.Rows[0]["ProductCode"].ToString()));
                txtHalter.Text = Halter.Name;
            }

            System.Data.DataColumn dcIsSql = new System.Data.DataColumn("IsSql");
            dtgvPoleConsol.Columns.Add(dcIsSql);

            System.Data.DataColumn dcAccessCode = new System.Data.DataColumn("AccessCode");
            dtgvPoleConsol.Columns.Add(dcAccessCode);

            System.Data.DataColumn dcXCode = new System.Data.DataColumn("XCode");
            dtgvPoleConsol.Columns.Add(dcXCode);

            foreach (DataRow dr in dtgvPoleConsol.Rows)
            {
                dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByACode(Convert.ToInt32(dr["IsExistance"].ToString())).Code;
                dr["IsSql"]       = false;
                dr["XCode"]       = "_";
                dr["AccessCode"]  = dr["ProductCode"].ToString();
            }


            gvConsol.AutoGenerateColumns = false;
            gvConsol.DataSource          = dtgvPoleConsol;

            dtLastConsol = dtgvPoleConsol.Copy();

            //for (int i = 0; i < gvPoleTip.Rows.Count; i++)
            //{
            //    gvPoleTip.Rows[i].Selected = false;
            //}

            Atend.Base.Equipment.EPoleTip EPolT = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(dPack.ProductCode);
            if (EPolT.Code != -1)
            {
                txtHalterCount.Text = EPolT.HalterCount.ToString();
            }



            //BindDataTocboProjCode();

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dPack.IsExistance).Code;
            cboProjCode.SelectedValue = dPack.ProjectCode;

            if (dtHalt.Rows.Count > 0)
            {
                cboHIsExistance.SelectedValue = Atend.Base.Base.BEquipStatus.SelectByACode(Convert.ToInt32(dtHalt.Rows[0]["IsExistance"].ToString())).Code;
                cboHProjectCode.SelectedValue = Convert.ToInt32(dtHalt.Rows[0]["ProjectCode"].ToString());
            }
            dtCurrent = dtgvPoleConsol.Copy();
        }
Ejemplo n.º 24
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            #region Select
            this.Hide();
            PromptEntityOptions peo = new PromptEntityOptions("\nSelect MiddleJackPanel:\n");
            PromptEntityResult  per = ed.GetEntity(peo);
            if (per.Status == PromptStatus.OK)
            {
                ObjectId GroupOI = Atend.Global.Acad.Global.GetEntityGroup(per.ObjectId);
                if (GroupOI != ObjectId.Null)
                {
                    Atend.Base.Acad.AT_INFO GroupInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(GroupOI);
                    if (GroupInfo.ParentCode != "NONE" && GroupInfo.NodeType == (int)Atend.Control.Enum.ProductType.MiddleJackPanel)
                    {
                        ObjectIdCollection OIC = Atend.Global.Acad.UAcad.GetGroupSubEntities(GroupOI);
                        foreach (ObjectId oi in OIC)
                        {
                            Atend.Base.Acad.AT_INFO SubInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(oi);
                            if (SubInfo.ParentCode != "NONE" && SubInfo.NodeType == (int)Atend.Control.Enum.ProductType.Cell)
                            {
                                //ed.WriteMessage("NodeCode:{0} , CellOI:{1}\n", SubInfo.NodeCode, oi);
                                //MyDic.Add(new Guid(SubInfo.NodeCode), oi);
                                System.Data.DataRow NewRow1 = CellAndKey.NewRow();
                                NewRow1["CellGuid"]     = new Guid(SubInfo.NodeCode);
                                NewRow1["CellObjectId"] = oi.ToString().Substring(1, oi.ToString().Length - 2);

                                Atend.Base.Acad.AT_SUB CellSub = Atend.Base.Acad.AT_SUB.SelectBySelectedObjectId(oi);
                                foreach (ObjectId oii in CellSub.SubIdCollection)
                                {
                                    Atend.Base.Acad.AT_INFO KeyInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(oii);
                                    if (KeyInfo.ParentCode != "NONE" && KeyInfo.NodeType == (int)Atend.Control.Enum.ProductType.Key)
                                    {
                                        NewRow1["KeyObjectId"] = oii.ToString().Substring(1, oii.ToString().Length - 2);
                                    }
                                }
                                CellAndKey.Rows.Add(NewRow1);
                            }
                        }

                        //foreach (System.Data.DataRow dr in CellAndKey.Rows)
                        //{

                        //    ed.WriteMessage("CG:{0},\nCOI:{1},\nKOI:{2}\n", dr["CellGuid"], dr["CellObjectId"], dr["KeyObjectId"]);

                        //}

                        NodeCode = new Guid(GroupInfo.NodeCode);
                        dtCell   = Atend.Base.Design.DCellStatus.AccessSelectByJackPanelCode(NodeCode);
                        System.Data.DataColumn dcName = new System.Data.DataColumn("Name");
                        dtCell.Columns.Add(dcName);
                        foreach (DataRow dr in dtCell.Rows)
                        {
                            //ed.WriteMessage("CellCode:{0}\n", dr["CellCode"]);
                            Atend.Base.Design.DPackage package = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["CellCode"].ToString()));// SelectByCode(new Guid(dr["CellCode"].ToString()));
                            Atend.Base.Equipment.ECell cell    = Atend.Base.Equipment.ECell.AccessSelectByCode(package.ProductCode);
                            dr["Name"] = cell.Name;
                        }
                        gvCellJAckPAnel.AutoGenerateColumns = false;
                        gvCellJAckPAnel.DataSource          = dtCell;

                        //Atend.Calculating.frmTest t = new Atend.Calculating.frmTest();
                        //t.dataGridView5.DataSource = dtCell;
                        //t.ShowDialog();
                    }
                }
            }

            this.Show();
            #endregion
        }
Ejemplo n.º 25
0
        public bool UpdatebreakerData(Guid EXCode)
        {
            Editor           ed = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbTransaction aTransaction;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);

            try
            {
                aConnection.Open();
                aTransaction = aConnection.BeginTransaction();
                try
                {
                    BreakerPack = Atend.Base.Design.DPackage.AccessSelectByCode(EXCode);
                    if (!UseAccess)
                    {
                        if (!eBreaker.AccessInsert(aTransaction, aConnection, true, true))
                        {
                            throw new System.Exception("eBreaker.AccessInsert failed");
                        }
                        //if (!Atend.Base.Equipment.EOperation.SentFromLocalToAccess(eBreaker.XCode, (int)Atend.Control.Enum.ProductType.Breaker, eBreaker.Code, aTransaction, aConnection))
                        //{
                        //    throw new System.Exception("operation failed");
                        //}
                    }
                    BreakerPack.IsExistance = Existance;
                    BreakerPack.ProductCode = eBreaker.Code;
                    BreakerPack.ProjectCode = ProjectCode;
                    BreakerPack.Number      = "";
                    if (BreakerPack.AccessUpdate(aTransaction, aConnection))
                    {
                        Atend.Base.Acad.AT_INFO atinfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(selectedObjectId);// id);
                        atinfo.ProductCode = eBreaker.Code;
                        atinfo.Insert();
                        ChangeComment(Atend.Global.Acad.UAcad.GetEntityGroup(selectedObjectId), eBreaker.Comment);
                    }
                    else
                    {
                        throw new System.Exception("BreakerPack.AccessInsert2 failed");
                    }

                    if (!DKeyStatus.Update(aTransaction, aConnection))
                    {
                        throw new System.Exception("dKeyStatus.AccessUpdate Failed");
                    }


                    if (!UseAccess)
                    {
                        //if (Br.Code == -1)
                        //{
                        //WENT TO
                        //if (!Atend.Base.Equipment.EContainerPackage.SentFromLocalToAccess(eBreaker.XCode, (int)Atend.Control.Enum.ProductType.Breaker, eBreaker.Code, aTransaction, aConnection))
                        //{
                        //    throw new System.Exception("SentFromLocalToAccess failed");
                        //}
                        //}
                    }
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR UpdateBreaker 01(transaction) : {0} \n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR UpdateBreaker 01 : {0} \n", ex.Message);
                aConnection.Close();
                return(false);
            }

            aTransaction.Commit();
            aConnection.Close();
            return(true);
        }
Ejemplo n.º 26
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);
        }
Ejemplo n.º 27
0
        //~~~~~~~~~~~~~~~~~~~~ METHODS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//

        public AcDrawBreaker()
        {
            BreakerPack = new Atend.Base.Design.DPackage();
            DKeyStatus  = new Atend.Base.Design.DKeyStatus();
        }
Ejemplo n.º 28
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;
        }
Ejemplo n.º 29
0
        private bool SaveGroundData(string NodeCode)
        {
            Editor           ed          = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbConnection  aConnection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString);
            OleDbTransaction aTransaction;

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

                try
                {
                    if (!UseAccess)
                    {
                        if (!eGround.AccessInsert(aTransaction, aConnection, true, true))
                        {
                            throw new System.Exception("eGround.AccessInsert failed");
                        }
                    }
                    //ed.WriteMessage("--->>>>----1\n");
                    GroundPack.Count       = 1;
                    GroundPack.IsExistance = Existance;
                    GroundPack.LoadCode    = 0;
                    GroundPack.NodeCode    = new Guid();
                    GroundPack.Number      = "GROUND";
                    ed.WriteMessage("NodeCode:{0}\n", NodeCode);
                    Atend.Base.Design.DPackage TempPackage = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(NodeCode), aTransaction, aConnection);
                    if (TempPackage.Code == Guid.Empty)
                    {
                        TempPackage = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(NodeCode), aTransaction, aConnection);
                        if (TempPackage.Code == Guid.Empty)
                        {
                            throw new System.Exception("GroundPack.AccessSelectByNodeCode failed");
                        }
                    }
                    GroundPack.ParentCode  = TempPackage.Code;
                    GroundPack.ProductCode = eGround.Code;
                    GroundPack.ProjectCode = projectCode;
                    GroundPack.Type        = (int)Atend.Control.Enum.ProductType.Ground;
                    if (!GroundPack.AccessInsert(aTransaction, aConnection))
                    {
                        throw new System.Exception("GroundPack.AccessInsert failed");
                    }
                    //ed.WriteMessage("--->>>>----2\n");
                }
                catch (System.Exception ex1)
                {
                    ed.WriteMessage("ERROR SaveGroundData 02 : {0}\n", ex1.Message);
                    aTransaction.Rollback();
                    aConnection.Close();
                    return(false);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("ERROR SaveGroundData 01 : {0}\n", ex.Message);
                aConnection.Close();
                return(false);
            }

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

            #region Not to Get Green

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

            #endregion

            return(true);
        }
Ejemplo n.º 30
0
        //MOUSAVI->drawing delete
        public static bool AccessDelete(Guid Code, OleDbTransaction _Transaction, OleDbConnection _Connection)
        {
            Editor          ed         = Application.DocumentManager.MdiActiveDocument.Editor;
            OleDbConnection connection = _Connection;
            OleDbCommand    command    = new OleDbCommand("D_Package_Delete", connection);

            command.Transaction = _Transaction;

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add(new OleDbParameter("iCode", Code));
            try
            {
                //ed.WriteMessage("DpackageCode:{0}\n", Code);
                Atend.Base.Design.DPackage _DPackage = Atend.Base.Design.DPackage.AccessSelectByCode(Code, _Transaction, _Connection);
                if (_DPackage.Code != Guid.Empty)
                {
                    switch (((Atend.Control.Enum.ProductType)_DPackage.Type))
                    {
                    case Atend.Control.Enum.ProductType.Pole:
                        //ed.WriteMessage("~~~~~~~~~~~ pole found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DPoleInfo.AccessDeleteByNodeCode(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DPoleInfo.AccessDelete failed");
                        }
                        if (!Atend.Base.Design.DNode.AccessDelete(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DNode.AccessDelete failed");
                        }
                        break;

                    case Atend.Control.Enum.ProductType.Consol:
                        //ed.WriteMessage("~~~~~~~~~~~ CONSOL found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DConsol.AccessDelete(_DPackage.Code, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DConsol.AccessDelete failed");
                        }
                        break;

                    case Atend.Control.Enum.ProductType.GroundPost:
                        //ed.WriteMessage("~~~~~~~~~~~ GROUND POST found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DPost.AccessDelete(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DPost.AccessDelete failed");
                        }

                        break;

                    case Atend.Control.Enum.ProductType.AirPost:
                        //ed.WriteMessage("~~~~~~~~~~~ AIRPOST found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DPost.AccessDelete(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DPost.AccessDelete failed");
                        }

                        break;

                    case Atend.Control.Enum.ProductType.MiddleJackPanel:
                        //ed.WriteMessage("~~~~~~~~~~~ MJ found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DCellStatus.AccessDeleteByJackPanelCode(_DPackage.Code, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DCellStatus.AccessDeleteByJackPanelCode failed");
                        }

                        break;

                    case Atend.Control.Enum.ProductType.PoleTip:
                        //ed.WriteMessage("~~~~~~~~~~~ poleTIP found ~~~~~~~~~~~~~~~\n");
                        if (!Atend.Base.Design.DPoleInfo.AccessDeleteByNodeCode(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DPoleInfo.AccessDeleteTip failed");
                        }
                        if (!Atend.Base.Design.DNode.AccessDelete(_DPackage.NodeCode, _Transaction, _Connection))
                        {
                            throw new System.Exception("~~~***~~~DNode.AccessDeleteTip failed");
                        }
                        break;
                    }
                }
                command.ExecuteNonQuery();
            }
            catch (System.Exception ex1)
            {
                ed.WriteMessage(string.Format("Error DPackage.AccessDelete : {0} \n", ex1.Message));
                return(false);
            }
            return(true);
        }