Esempio n. 1
0
        private bool Validation()
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("لطفاً نام تيپ را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading);
                txtName.Focus();
                return(false);
            }
            if (Atend.Base.Equipment.ESelfKeeperTip.SearchByName(txtName.Text) == true && SelectConductorTip == Guid.Empty)
            {
                MessageBox.Show("نام قبلا استفاده شده است");
                return(false);
            }

            Atend.Base.Equipment.ESelfKeeperTip selftip = Atend.Base.Equipment.ESelfKeeperTip.CheckForExist(Convert.ToInt32(cboPhaseCount.SelectedItem.ToString()), new Guid(cboPhaseProductCode.SelectedValue.ToString()),
                                                                                                            Convert.ToInt32(cboNeutralCount.SelectedItem.ToString()), new Guid(cboNeutralProductCode.SelectedValue.ToString()),
                                                                                                            Convert.ToInt32(cboNightCount.SelectedItem.ToString()), new Guid(cboNightProductCode.SelectedValue.ToString()),
                                                                                                            Convert.ToInt32(cboCrosSectionCount.SelectedItem.ToString()), Convert.ToInt32(cboCrossSection.SelectedItem.ToString()));
            if (selftip.Code != -1 && SelectConductorTip == Guid.Empty)
            {
                if (MessageBox.Show("تیپ بندی با مشخصات داده شده موجود میباشد\n\n تیپ بندی با مشخصات فوق  : " + selftip.Name + "\n\n" + "آیا مایل به ادامه  ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    cboNightProductCode.Focus();
                    return(false);
                }
            }

            return(CheckStatuseOfAccessChangeDefault());
            // return true;
        }
Esempio n. 2
0
        private void tsbShare_Click(object sender, EventArgs e)
        {
            if (SelectConductorTip != Guid.Empty)
            {
                if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeperTip), SelectConductorTip))
                {
                    Atend.Base.Equipment.ESelfKeeperTip SelfTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(SelectConductorTip);
                    Code = SelfTip.Code;
                    MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
                }
                else
                {
                    MessageBox.Show("خطا در به اشتراک گذاری .");
                }
            }
            else
            {
                MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
            }

            //if (SelectConductorTip != Guid.Empty)
            //{
            //    if (Atend.Base.Equipment.ESelfKeeperTip.ShareOnServer(SelectConductorTip))
            //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
            //    else
            //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
            //}
            //else
            //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
        }
Esempio n. 3
0
        private void Delete()
        {
            string name = string.Empty;

            if (!Atend.Global.Utility.UBinding.ExistInSubEquip(SelectConductor, out name))
            {
                MessageBox.Show(string.Format("حذف بدلیل وجود در تجهیزات جانبی امکانپذیر نمی باشد\n تجهیز موردنظر زیر تجهیز '{0}' میباشد ", name), "خطا");

                return;
            }
            //Atend.Base.Equipment.EProductPackage _ProductPackage = Atend.Base.Equipment.EProductPackage.SelectByXCode(SelectConductor);
            //if (_ProductPackage.Code != -1)
            //{
            //    MessageBox.Show("حذف  بدلیل وجود در تجهیزات جانبی امکانپذیر نمی باشد ", "خطا");
            //    return;
            //}

            Atend.Base.Equipment.ESelfKeeperTip NeutralProduct = Atend.Base.Equipment.ESelfKeeperTip.SelectByNeutralProductxCode(SelectConductor);
            if (NeutralProduct.Code != -1)
            {
                MessageBox.Show("حذف کابل خودنگهدار بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }
            Atend.Base.Equipment.ESelfKeeperTip NightProduct = Atend.Base.Equipment.ESelfKeeperTip.SelectByNightProductxCode(SelectConductor);
            if (NightProduct.Code != -1)
            {
                MessageBox.Show("حذف کابل خودنگهدار بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }
            Atend.Base.Equipment.ESelfKeeperTip PhaseProduct = Atend.Base.Equipment.ESelfKeeperTip.SelectByPhaseProductxCode(SelectConductor);
            if (PhaseProduct.Code != -1)
            {
                MessageBox.Show("حذف کابل خودنگهدار بدلیل وجود در تیپ بندی امکانپذیر نمی باشد ", "خطا");
                return;
            }

            if (MessageBox.Show("آیا از حذف کردن اطلاعات اطمینان دارید؟", "حذف", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (SelectConductor != Guid.Empty)
                {
                    if (Atend.Base.Equipment.ESelfKeeper.DeleteX(SelectConductor))
                    {
                        Reset();
                    }
                    else
                    {
                        MessageBox.Show("امکان حذف کردن اطلاعات نمی باشد", "خطا");
                    }
                }
                else
                {
                    MessageBox.Show("لطفاً گزینه مورد نظر را انتخاب نمایید", "خطا");
                }
            }
        }
Esempio n. 4
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            //Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
            Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper DrawSelfKeeper = new Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper();
            if (Validation())
            {
                if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value) == false)
                {
                    DrawSelfKeeper.UseAccess      = true;
                    DrawSelfKeeper.eSelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString()));
                }
                else if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[7].Value))
                {
                    DrawSelfKeeper.UseAccess = false;
                    Atend.Base.Equipment.ESelfKeeperTip selfkeepertip = new Atend.Base.Equipment.ESelfKeeperTip();
                    ed.WriteMessage("SelectByXCode={0}\n", gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString());
                    selfkeepertip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString()));
                    DrawSelfKeeper.eSelfKeeperTip = selfkeepertip;
                    ed.WriteMessage("SelefKipperTip.XCOde={0}\n", selfkeepertip.XCode);
                    List <Atend.Base.Equipment.ESelfKeeper> list = new List <Atend.Base.Equipment.ESelfKeeper>();
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.PhaseProductxCode));
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NeutralProductxCode));
                    list.Add(Atend.Base.Equipment.ESelfKeeper.SelectByXCode(selfkeepertip.NightProductxCode));
                    DrawSelfKeeper.eSelfKeepers = list;
                }

                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                DrawSelfKeeper.Existance = status.ACode;

                if (cboProject.Items.Count == 0)
                {
                    DrawSelfKeeper.ProjectCode = 0;
                }
                else
                {
                    DrawSelfKeeper.ProjectCode = Convert.ToInt32(cboProject.SelectedValue);
                }

                DrawSelfKeeper.SelectedObjectId = BranchObj;

                DrawSelfKeeper.UpdateSelfKeeperData(Convert.ToDouble(txtLenght.Text), BranchCode);
                //if (DrawSelfKeeper.UpdateSelfKeeperData())
                //    ed.WriteMessage("Update SelfKeeper Success \n");
            }
        }
Esempio n. 5
0
        public void BindDataToOwnControl(Guid _Code)
        {
            SelectConductorTip = _Code;
            Atend.Base.Equipment.ESelfKeeperTip selfKeeper = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(_Code);

            txtName.Text = Convert.ToString(selfKeeper.Name.ToString());
            cboPhaseCount.SelectedIndex         = Convert.ToInt32(selfKeeper.PhaseCount.ToString());
            cboNeutralCount.SelectedIndex       = Convert.ToInt32(selfKeeper.NeutralCount.ToString());
            cboNightCount.SelectedIndex         = Convert.ToInt32(selfKeeper.NightCount.ToString());
            cboPhaseProductCode.SelectedValue   = new Guid(selfKeeper.PhaseProductxCode.ToString());
            cboNeutralProductCode.SelectedValue = new Guid(selfKeeper.NeutralProductxCode.ToString());
            cboNightProductCode.SelectedValue   = new Guid(selfKeeper.NightProductxCode.ToString());
            cboCrosSectionCount.SelectedIndex   = Convert.ToInt32(selfKeeper.CrossSectionCount);
            cboCrossSection.Text = selfKeeper.CrossSection.ToString();
            tsbIsDefault.Checked = selfKeeper.IsDefault;
            Code = selfKeeper.Code;
            //ed.WriteMessage("XXXXXXXXXXXX own:{0}\n", Code);
        }
        private void btnChange_Click(object sender, EventArgs e)
        {
            Atend.Global.Calculation.Electrical.CElectricalCrossSectionChane change = new Atend.Global.Calculation.Electrical.CElectricalCrossSectionChane();

            for (int i = 0; i < gvConductor.Rows.Count; i++)
            {
                DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvConductor.Rows[i].Cells["chkSelect"];
                if (chk.Value.ToString() == "True")
                {
                    if (gvConductor.Rows[i].Cells["NameCommentTip"].Value.ToString() != "")
                    {
                        Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(gvConductor.Rows[i].Cells["Code"].Value.ToString()));
                        change.DBranch.Add(branch);

                        if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor))
                        {
                            Atend.Base.Equipment.EConductorTip CondTip = Atend.Base.Equipment.EConductorTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                            change.CondTip.Add(CondTip);
                        }

                        if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                        {
                            Atend.Base.Equipment.ESelfKeeperTip SelfTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                            change.SelfTip.Add(SelfTip);
                        }

                        //if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                        //{
                        //    Atend.Base.Equipment.EGroundCabelTip  GroundTip = Atend.Base.Equipment.EGroundCabelTip.SelectByXCode(new Guid(gvConductor.Rows[i].Cells["CommentTipXCode"].Value.ToString()));
                        //    change.GroundTip.Add(GroundTip);
                        //}
                    }
                }
            }

            if (change.ChangeBranchInfo())
            {
                MessageBox.Show("اعمال تغییرات با موفقیت انجام شد");
            }
            else
            {
                MessageBox.Show("اعمال تغییرات با موفقیت انجام نشد");
            }
        }
Esempio n. 7
0
        public static DataRow GetCondInfo(int CondCode, int CondProductType)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            System.Data.DataTable dtCond = new System.Data.DataTable();
            dtCond.Columns.Add("Resistance");
            dtCond.Columns.Add("Reactance");
            dtCond.Columns.Add("MaxCurrent");
            dtCond.Columns.Add("Capacitance");
            DataRow dr = dtCond.NewRow();

            //ed.writeMessage("**I Am In GetCondInfo\n");
            switch (((Atend.Control.Enum.ProductType)(CondProductType)))
            {
            case Atend.Control.Enum.ProductType.Conductor:
                //Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.SelectByCode(CondCode);
                Atend.Base.Equipment.EConductor cond = Atend.Base.Equipment.EConductor.SelectByCode(CondCode);
                dr["Resistance"]  = cond.Resistance.ToString();
                dr["Reactance"]   = cond.Reactance.ToString();
                dr["MaxCurrent"]  = cond.MaxCurrent.ToString();
                dr["Capacitance"] = cond.Capacitance.ToString();
                //ed.WriteMessage("@@@@@@@I AM IN GetCondInfo Re= " + cond.Resistance + "\n");
                dtCond.Rows.Add(dr);
                break;

            case Atend.Control.Enum.ProductType.SelfKeeper:
                Atend.Base.Equipment.ESelfKeeperTip SelfTip    = Atend.Base.Equipment.ESelfKeeperTip.SelectByCode(CondCode);
                Atend.Base.Equipment.ESelfKeeper    SelfKeeper = Atend.Base.Equipment.ESelfKeeper.SelectByCode(SelfTip.PhaseProductCode);
                dr["Resistance"]  = SelfKeeper.Resistance.ToString();
                dr["Reactance"]   = SelfKeeper.Reactance.ToString();
                dr["MaxCurrent"]  = SelfKeeper.MaxCurrent.ToString();
                dr["Capacitance"] = SelfKeeper.Capacitance.ToString();
                dtCond.Rows.Add(dr);
                break;

            default:
                Atend.Base.Equipment.EConductor cond2 = Atend.Base.Equipment.EConductor.SelectByCode(CondCode);
                break;
            }
            //ed.writeMessage("Cond[Resistence=" + dtCond.Rows[0]["Resistance"].ToString()+"\n");
            return(dtCond.Rows[0]);
        }
Esempio n. 8
0
        private bool CheckStatuseOfAccessChangeDefault()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault);
            if (!Atend.Control.Common.AccessChangeDefault)
            {
                if (SelectConductorTip == Guid.Empty && IsDefault)
                {
                    MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
                    return(false);
                }
                else
                {
                    Atend.Base.Equipment.ESelfKeeperTip selfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(SelectConductorTip);
                    if (selfKeeperTip.IsDefault || IsDefault)
                    {
                        MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 9
0
        public static void SetBranchData(Atend.Base.Design.DBranch Branch, int BranchMode)
        {
            Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;

            // ed.WriteMessage("Branch>productType={0},Mode={1},BranchGuid={2}\n",Branch.ProductType,BranchMode.ToString(),Branch.Code);
            if (Branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor))
            {
                Atend.Base.Equipment.EConductorTip MyConductorTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Branch.ProductCode);
                Atend.Base.Equipment.EConductor    MyConductor    = new Atend.Base.Equipment.EConductor();
                switch ((Atend.Control.Enum.BranchMode)BranchMode)
                {
                case Atend.Control.Enum.BranchMode.Phase:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.PhaseProductCode);
                    //ed.WriteMessage("***MyMranch.Name={0}\n",MyConductor.Name);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Night:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.NightProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Netural:
                {
                    MyConductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(MyConductorTip.NeutralProductCode);
                    break;
                }
                }



                Atend.Global.Calculation.Mechanical.CCommon.Code = MyConductor.Code;
                //double f=10e-6;
                //ed.WriteMessage("10^-6={0}\n", f.ToString());
                Atend.Global.Calculation.Mechanical.CCommon.Alpha            = MyConductor.Alpha * Math.Pow(10, -6);
                Atend.Global.Calculation.Mechanical.CCommon.Diagonal         = MyConductor.Diagonal;
                Atend.Global.Calculation.Mechanical.CCommon.UTS              = MyConductor.UTS;
                Atend.Global.Calculation.Mechanical.CCommon.Name             = MyConductor.Name;
                Atend.Global.Calculation.Mechanical.CCommon.Alasticity       = MyConductor.Alasticity;
                Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea = MyConductor.CrossSectionArea;
                Atend.Global.Calculation.Mechanical.CCommon.WC   = MyConductor.Wc;
                Atend.Global.Calculation.Mechanical.CCommon.Type = MyConductor.TypeCode;
                //ed.WriteMessage("**************ALPHA={0},ConductorALPHA={1}\n", Atend.Global.Calculation.Mechanical.CCommon.Alpha, MyConductor.Alpha);
            }
            else
            {
                Atend.Base.Equipment.ESelfKeeperTip MySelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Branch.ProductCode);
                Atend.Base.Equipment.ESelfKeeper    MySelfKeeper    = new Atend.Base.Equipment.ESelfKeeper();
                switch ((Atend.Control.Enum.BranchMode)BranchMode)
                {
                case Atend.Control.Enum.BranchMode.Phase:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.PhaseProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Night:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.NightProductCode);
                    break;
                }

                case Atend.Control.Enum.BranchMode.Netural:
                {
                    MySelfKeeper = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(MySelfKeeperTip.NeutralProductCode);
                    break;
                }
                }
                Atend.Global.Calculation.Mechanical.CCommon.Code             = MySelfKeeper.Code;
                Atend.Global.Calculation.Mechanical.CCommon.Alpha            = MySelfKeeper.Alpha * Math.Pow(10, -6);
                Atend.Global.Calculation.Mechanical.CCommon.Diagonal         = MySelfKeeper.Diagonal;
                Atend.Global.Calculation.Mechanical.CCommon.UTS              = MySelfKeeper.UTS;
                Atend.Global.Calculation.Mechanical.CCommon.Name             = MySelfKeeper.Name;
                Atend.Global.Calculation.Mechanical.CCommon.Alasticity       = MySelfKeeper.Alastisity;
                Atend.Global.Calculation.Mechanical.CCommon.CrossSectionArea = MySelfKeeper.CrossSectionKeeper;
                Atend.Global.Calculation.Mechanical.CCommon.WC = MySelfKeeper.Weight;
            }
        }
Esempio n. 10
0
        //DataColumn dcSCCurrent = new DataColumn("SCCurrent");
        //DataColumn CondMax1sCurrent = new DataColumn("CondMax1sCurrent");

        public frmElectericalResult(DataTable dtNodes, DataTable dtBranch)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }
            InitializeComponent();

            dtResultNode.Columns.Add(dcLoadPowerImage);
            dtResultNode.Columns.Add(dcLoadPowerReal);
            dtResultNode.Columns.Add(dcVoltAbs);
            dtResultNode.Columns.Add(dcVoltAng);
            dtResultNode.Columns.Add(dcVoltDropPer);
            dtResultNode.Columns.Add(dcLoadCurrentAbs);
            dtResultNode.Columns.Add(dcLoadCurrentArg);
            dtResultNode.Columns.Add(dcConsolGuid);

            dtResultBranch.Columns.Add(dcCode);
            dtResultBranch.Columns.Add(dcCondUtilization);
            dtResultBranch.Columns.Add(dcLenght);
            dtResultBranch.Columns.Add(dcCurrentAbs);
            dtResultBranch.Columns.Add(dcCurrentAng);
            dtResultBranch.Columns.Add(dcTotalLoadREal);
            dtResultBranch.Columns.Add(dcCondCode);
            dtResultBranch.Columns.Add(dcCondCurrent);
            dtResultBranch.Columns.Add(dcFrom);
            dtResultBranch.Columns.Add(dcTo);
            dtResultBranch.Columns.Add(dcPowerLoss);
            //dtResultBranch.Columns.Add(dcSCCurrent);
            //dtResultBranch.Columns.Add(CondMax1sCurrent);

            //ed.WriteMessage("Print Nodes\n");

            Atend.Base.Calculating.CDistributedLoadBranch.AccessDelete();
            Atend.Base.Calculating.CDistributedLoadNode.AccessDelete();

            foreach (DataRow dr in dtNodes.Rows)
            {
                DataRow drNew = dtResultNode.NewRow();
                Atend.Base.Calculating.CDistributedLoadNode loadNode = new Atend.Base.Calculating.CDistributedLoadNode();

                Atend.Base.Design.DPackage pack = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["ConsoleGuid"].ToString()));
                if (pack.Code != Guid.Empty)
                {
                    drNew["ConsolGuid"] = pack.Number;
                    loadNode.NodeName   = pack.Number;

                    drNew["VoltAbs"] = Math.Round(((Complex)dr["Voltage"]).abs, 3);
                    loadNode.VoltAbs = Math.Round(((Complex)dr["Voltage"]).abs, 3);
                    double voltDegree = ConvertToDegree(((Complex)dr["Voltage"]).arg);
                    //drNew["VoltArg"] = Math.Round(((Complex)dr["Voltage"]).arg, 2);
                    //loadNode.VoltArg = Math.Round(((Complex)dr["Voltage"]).arg, 2);

                    drNew["VoltArg"] = Math.Round(voltDegree, 2);
                    loadNode.VoltArg = Math.Round(voltDegree, 2);

                    double voltDropPer = 100 - Convert.ToDouble(dr["VoltageDropPer"].ToString());

                    drNew["VoltDropPer"] = Math.Round(voltDropPer, 2);
                    loadNode.DropVolt    = Convert.ToDouble(Math.Round(voltDropPer, 2));

                    drNew["LoadPowerReal"] = Math.Round(((Complex)dr["LoadPower"]).imag, 3) / 1000;
                    loadNode.LoadPower     = Math.Round(((Complex)dr["LoadPower"]).imag, 3) / 1000;


                    drNew["LoadPowerImg"]    = Math.Round(((Complex)dr["LoadPower"]).real, 3) / 1000;
                    loadNode.LoadPowerActive = Math.Round(((Complex)dr["LoadPower"]).real, 3) / 1000;

                    drNew["LoadCurrentAbs"] = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);//.ToString();
                    loadNode.LoadCurrentAbs = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);


                    double LoadCurrentArg = ConvertToDegree(((Complex)dr["LoadCurrent"]).arg);
                    //drNew["LoadCurrentArg"] = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);
                    //loadNode.LoadCurrentArg = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);


                    drNew["LoadCurrentArg"] = Math.Round(LoadCurrentArg, 3);
                    loadNode.LoadCurrentArg = Math.Round(LoadCurrentArg, 3);

                    dtResultNode.Rows.Add(drNew);

                    if (!loadNode.AccessInsert())
                    {
                        ed.WriteMessage("LoadNode Insert Failed\n");
                    }
                }
            }
            //ed.WriteMessage("Print Branch\n");
            double totalLoad = 0;

            foreach (DataRow dr in dtBranch.Rows)
            {
                DataRow drNew = dtResultBranch.NewRow();
                Atend.Base.Calculating.CDistributedLoadBranch LoadBranch = new Atend.Base.Calculating.CDistributedLoadBranch();
                Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(dr["Code"].ToString()));

                if (branch.Code != Guid.Empty)
                {
                    drNew["Code"]         = branch.Number;
                    LoadBranch.BranchName = branch.Number;

                    drNew["Lenght"]   = Math.Round(Convert.ToDouble(dr["Length"].ToString()), 2);
                    LoadBranch.Lenght = Math.Round(Convert.ToDouble(dr["Length"].ToString()), 3);

                    drNew["CondUtilization"]   = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    LoadBranch.Condutilization = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);

                    drNew["CurrentAbs"]   = Math.Round(((Complex)dr["Current"]).abs, 3);//.ToString();
                    LoadBranch.CurrentAbs = Math.Round(((Complex)dr["Current"]).abs, 3);


                    double currentArg = ConvertToDegree(((Complex)dr["Current"]).arg);
                    //drNew["CurrentArg"] = Math.Round(((Complex)dr["Current"]).arg, 3);
                    //LoadBranch.CurrentArg = Math.Round(((Complex)dr["Current"]).arg, 3);
                    drNew["CurrentArg"]   = Math.Round(currentArg, 3);
                    LoadBranch.CurrentArg = Math.Round(currentArg, 3);

                    //MessageBox.Show(dr["PowerLoss"].ToString());


                    totalLoad += Math.Round(((Complex)dr["TotalLoad"]).real / 1000 + (Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000), 3);
                    drNew["TotalLoadReal"] = totalLoad;
                    LoadBranch.TotalLoad   = totalLoad;//Math.Round(((Complex)dr["TotalLoad"]).real / 1000 + (Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000), 3);


                    ed.WriteMessage("CondCode={0}\n", dr["CondCode"].ToString());

                    if ((branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Terminal)))
                    {
                        Atend.Base.Equipment.EConductorTip econdTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EConductor    eCond    = Atend.Base.Equipment.EConductor.AccessSelectByCode(econdTip.PhaseProductCode);

                        drNew["CondName"]    = eCond.Name;
                        drNew["CondCurrent"] = eCond.MaxCurrent;

                        LoadBranch.CondName    = eCond.Name;
                        LoadBranch.CondCurrent = eCond.MaxCurrent;
                    }
                    else if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeperTip eSelTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.ESelfKeeper    eSelf   = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(eSelTip.PhaseProductCode);

                        drNew["CondName"]    = eSelf.Name;
                        drNew["CondCurrent"] = eSelf.MaxCurrent;

                        LoadBranch.CondName    = eSelf.Name;
                        LoadBranch.CondCurrent = eSelf.MaxCurrent;
                    }
                    else if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                    {
                        Atend.Base.Equipment.EGroundCabelTip egroundTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EGroundCabel    eGround    = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(egroundTip.PhaseProductCode);

                        drNew["CondName"]    = eGround.Name;
                        drNew["CondCurrent"] = eGround.MaxCurrent;

                        LoadBranch.CondName    = eGround.Name;
                        LoadBranch.CondCurrent = eGround.MaxCurrent;
                    }

                    DataRow[] drnodeFrom = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["From"]   = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                        LoadBranch.From = drNew["From"].ToString();
                    }


                    //به
                    DataRow[] drnodeTo = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        //drNew["Volt"] = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["To"]   = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                        LoadBranch.To = drNew["To"].ToString();
                    }
                    LoadBranch.PowerLoss = Math.Round(Convert.ToDouble(dr["PowerLoss"]) / 1000, 2);
                    drNew["PowerLoss"]   = Math.Round(Convert.ToDouble(dr["PowerLoss"]) / 1000, 2);



                    dtResultBranch.Rows.Add(drNew);
                    if (!LoadBranch.AccessInsert())
                    {
                        ed.WriteMessage("LoadBranch Inser Failed\n");
                    }
                }
                //drNew["SCCurrent"] = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 3);
                //drNew["CondMax1sCurrent"] = Math.Round(Convert.ToDouble(dr["CondMax1sCurrent"].ToString()), 3);
            }
            //ed.WriteMessage("BindDAtA\n");
            //string Code1 = "00000000-0000-0000-0000-000000000000";
            //DataRow[] drs = dtResultBranch.Select(" Code= '" + Code1 + "'");
            //drs[0].Delete();

            //DataRow[] drs1 = dtResultNode.Select(" ConsolGuid ='" + Code1 + "'");
            //drs1[0].Delete();

            gvBranch.AutoGenerateColumns = false;
            gvBranch.DataSource          = dtResultBranch;

            gvNode.AutoGenerateColumns = false;
            gvNode.DataSource          = dtResultNode;
        }
Esempio n. 11
0
        private void frmEditDrawSelfKeeper_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }
            dtMerge = Atend.Base.Equipment.ESelfKeeperTip.SelectAllAndMerge();
            Atend.Base.Design.DBranch           Branch  = Atend.Base.Design.DBranch.AccessSelectByCode(BranchCode);
            Atend.Base.Equipment.ESelfKeeperTip SelfTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Branch.ProductCode);
            selectedProductCode = SelfTip.Code;

            System.Data.DataColumn dcMaterialName = new System.Data.DataColumn("MaterialName");
            System.Data.DataColumn dcAMP          = new System.Data.DataColumn("AMP");
            dtMerge.Columns.Add("AMP");
            dtMerge.Columns.Add(dcMaterialName);

            foreach (DataRow dr in dtMerge.Rows)
            {
                dr["AMP"] = string.Format("{0}+{1}j", dr["Resistance"].ToString(), dr["Reactance"].ToString());
                if (Convert.ToInt32(dr["MaterialConductorCode"].ToString()) == 1)
                {
                    dr["MaterialName"] = "مسی";
                }
                if (Convert.ToInt32(dr["MaterialConductorCode"].ToString()) == 2)
                {
                    dr["MaterialName"] = "آلومینیوم";
                }
                if (Convert.ToInt32(dr["MaterialConductorCode"].ToString()) == 3)
                {
                    dr["MaterialName"] = "آلومینیو مغز فولاد";
                }
                if (Convert.ToInt32(dr["MaterialConductorCode"].ToString()) == 4)
                {
                    dr["MaterialName"] = "آلیاژ آلومینیوم";
                }
            }

            gvSelfKeeper.AutoGenerateColumns = false;
            gvSelfKeeper.DataSource          = dtMerge;

            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("SelfCode,SelfXCode", new object[2] {
                selectedProductCode, "00000000-0000-0000-0000-000000000000"
            }, dtMerge, gvSelfKeeper, this);
            ChangeColor();
            for (int i = 0; i < gvSelfKeeper.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvSelfKeeper.Rows[i].Cells[0].Value.ToString()) == selectedProductCode /*SelfTip.Code*/)
                {
                    gvSelfKeeper.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }

            BindMaterialToComboBox();
            if (cboMaterial.Items.Count > 0)
            {
                cboMaterial.SelectedIndex = 0;
            }
            BindDataToComboBoxIsExist();
            if (cboMaterial.Items.Count > 0)
            {
                cboMaterial.SelectedIndex = 0;
            }
            //BindDataToProjectCode();
            if (cboProject.Items.Count > 0)
            {
                cboProject.SelectedIndex = 0;
            }
            txtLenght.Text = Math.Round(Branch.Lenght, 2).ToString();
            Length         = Convert.ToDouble(Math.Round(Branch.Lenght, 2).ToString());

            cboIsExist.SelectedValue = Atend.Base.Base.BEquipStatus.SelectByACode(Branch.IsExist).Code;
            cboProject.SelectedValue = Branch.ProjectCode;
        }
Esempio n. 12
0
        public frmShortCircuitResult(DataTable dtNodes, DataTable dtBranch, double FalutDuration)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }

            InitializeComponent();
            _FaultDuration = FalutDuration;
            dtResultNode.Columns.Add(dcLoadPowerImage);
            dtResultNode.Columns.Add(dcLoadPowerReal);
            dtResultNode.Columns.Add(dcVoltAbs);
            dtResultNode.Columns.Add(dcVoltAng);
            dtResultNode.Columns.Add(dcVoltDropPer);
            dtResultNode.Columns.Add(dcLoadCurrentAbs);
            dtResultNode.Columns.Add(dcLoadCurrentArg);
            dtResultNode.Columns.Add(dcConsolGuid);

            dtResultBranch.Columns.Add(dcCode);
            dtResultBranch.Columns.Add(dcCondUtilization);
            dtResultBranch.Columns.Add(dcLenght);
            dtResultBranch.Columns.Add(dcCurrentAbs);
            dtResultBranch.Columns.Add(dcCurrentAng);
            dtResultBranch.Columns.Add(dcTotalLoadREal);
            dtResultBranch.Columns.Add(dcSCCurrent);
            dtResultBranch.Columns.Add(CondMax1sCurrent);
            dtResultBranch.Columns.Add(dcFrom);
            dtResultBranch.Columns.Add(dcTo);
            dtResultBranch.Columns.Add(dcCondName);
            dtResultBranch.Columns.Add(dcVolt);

            ed.WriteMessage("Print Nodes\n");
            foreach (DataRow dr in dtNodes.Rows)
            {
                DataRow drNew = dtResultNode.NewRow();
                if (new Guid(dr["ConsoleGuid"].ToString()) != Guid.Empty)
                {
                    Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(dr["ConsoleGuid"].ToString()));
                    drNew["ConsolGuid"] = dPack.Number;
                    drNew["VoltAbs"]    = Math.Round(((Complex)dr["Voltage"]).abs, 3);

                    double voltArg = ConvertToDegree(((Complex)dr["Voltage"]).arg);
                    //drNew["VoltArg"] = Math.Round(((Complex)dr["Voltage"]).arg, 2);
                    drNew["VoltArg"] = Math.Round(voltArg, 2);

                    drNew["VoltDropPer"]    = Math.Round(Convert.ToDouble(dr["VoltageDropPer"].ToString()));
                    drNew["LoadPowerReal"]  = Math.Round(((Complex)dr["LoadPower"]).real, 3);
                    drNew["LoadPowerImg"]   = Math.Round(((Complex)dr["LoadPower"]).imag, 3);
                    drNew["LoadCurrentAbs"] = Math.Round(((Complex)dr["LoadCurrent"]).abs, 3);//.ToString();
                    double loadcurrentArg = ConvertToDegree(((Complex)dr["LoadCurrent"]).arg);

                    //drNew["LoadCurrentArg"] = Math.Round(((Complex)dr["LoadCurrent"]).arg, 3);//.ToString();
                    drNew["LoadCurrentArg"] = loadcurrentArg;
                    dtResultNode.Rows.Add(drNew);
                }
            }
            ed.WriteMessage("Print Branch\n");

            Atend.Base.Calculating.CShortCircuit.AccessDelete();

            foreach (DataRow dr in dtBranch.Rows)
            {
                Atend.Base.Calculating.CShortCircuit shortCircuit = new Atend.Base.Calculating.CShortCircuit();
                if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                {
                    DataRow drNew = dtResultBranch.NewRow();
                    Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(dr["Code"].ToString()));
                    //drNew["Code"] = branch.Number;

                    if ((branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)) || (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Terminal)))
                    {
                        Atend.Base.Equipment.EConductorTip ConductorTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EConductor    Conductor    = Atend.Base.Equipment.EConductor.AccessSelectByCode(ConductorTip.PhaseProductCode);
                        drNew["CondName"] = Conductor.Name;
                        double IbMax = Convert.ToDouble(Conductor.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"] = Math.Round(IbMax, 1);

                        shortCircuit.CondName         = Conductor.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }

                    if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.ESelfKeeper    SelfKeeper    = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfKeeperTip.PhaseProductCode);
                        drNew["CondName"] = SelfKeeper.Name;
                        double IbMax = Convert.ToDouble(SelfKeeper.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"]     = Math.Round(IbMax, 1);
                        shortCircuit.CondName         = SelfKeeper.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }

                    if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel))
                    {
                        Atend.Base.Equipment.EGroundCabelTip GroundTip = Atend.Base.Equipment.EGroundCabelTip.AccessSelectByCode(branch.ProductCode);
                        Atend.Base.Equipment.EGroundCabel    Ground    = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(GroundTip.PhaseProductCode);
                        drNew["CondName"] = Ground.Name;
                        double IbMax = Convert.ToDouble(Ground.MaxCurrent1Second) / Math.Sqrt(_FaultDuration);
                        drNew["CondMax1sCurrent"]     = Math.Round(IbMax, 1);
                        shortCircuit.CondName         = Ground.Name;
                        shortCircuit.CondMax1SCurrent = Math.Round(IbMax, 1);
                    }


                    drNew["Lenght"]          = dr["Length"].ToString();
                    drNew["CondUtilization"] = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    drNew["CurrentAbs"]      = Math.Round(((Complex)dr["Current"]).abs, 3);//.ToString();
                    double currentArg = ConvertToDegree(((Complex)dr["Current"]).arg);

                    //drNew["CurrentArg"] = Math.Round(((Complex)dr["Current"]).arg, 3);//.ToString();
                    drNew["CurrentArg"] = Math.Round(currentArg, 3);

                    drNew["TotalLoadReal"] = Math.Round(((Complex)dr["TotalLoad"]).arg, 3);
                    drNew["SCCurrent"]     = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 0);
                    ed.WriteMessage("CondCode={0}\n", dr["CondCode"].ToString());


                    shortCircuit.Lenght          = Convert.ToDouble(dr["Length"].ToString());
                    shortCircuit.Condutilization = Math.Round(Convert.ToDouble(dr["CondUtilization"].ToString()), 3);
                    shortCircuit.CurrentAbs      = Math.Round(((Complex)dr["Current"]).abs, 3); //.ToString();

                    shortCircuit.CurrentArg = Math.Round(currentArg, 3);                        //.ToString();

                    shortCircuit.TotalLoad = Math.Round(((Complex)dr["TotalLoad"]).arg, 3);
                    shortCircuit.ScCurrent = Math.Round(Convert.ToDouble(dr["SCCurrent"].ToString()), 0);
                    ed.WriteMessage("Current={0}\n", shortCircuit.ScCurrent);


                    //از
                    DataRow[] drnodeFrom = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["From"]     = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                        shortCircuit.From = drNew["From"].ToString();
                    }


                    //به
                    DataRow[] drnodeTo = dtNodes.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        drNew["Volt"]     = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["To"]       = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                        shortCircuit.To   = drNew["To"].ToString();
                        shortCircuit.Volt = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2);
                    }



                    //if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                    //{
                    ////Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));

                    ////Atend.Base.Equipment.EConductor conductor = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                    ////ed.WriteMessage("conductor.MaxCurrent1Second={0},SCCurrent={1}\n", conductor.MaxCurrent1Second, dr["SCCurrent"].ToString());


                    ////ed.WriteMessage("#######\n");

                    //ed.WriteMessage("&&&&&&={0}\n", dr["CondMax1sCurrent"].ToString());
                    //}
                    //else
                    //{

                    //    drNew["CondMax1sCurrent"] = dr["CondUtilizationSC"].ToString();
                    //}

                    dtResultBranch.Rows.Add(drNew);



                    if (!shortCircuit.AccessInsert())
                    {
                        ed.WriteMessage("Insert Failed\n");
                    }
                }
            }
            ////foreach (DataRow dr in dtResultBranch.Rows)
            ////{
            ////    ed.WriteMessage("dtResultBranch.CondMax1sCurrent={0}\n", dr["CondMax1sCurrent"].ToString());
            ////}

            //string code1 = "00000000-0000-0000-0000-000000000000";
            //DataRow[] drs = dtResultBranch.Select(" Code = '"+code1+"'");
            //drs[0].Delete();

            //DataRow[] drs1 = dtResultNode.Select(" ConsolGuid = '" + code1 + "'");
            //drs1[0].Delete();

            ed.WriteMessage("BindDAtA\n");
            gvBranch.AutoGenerateColumns = false;
            gvBranch.DataSource          = dtResultBranch;

            //gvNode.AutoGenerateColumns = false;
            //gvNode.DataSource = dtResultNode;
            CheckCurrent();
        }
Esempio n. 13
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (Validation())
            {
                if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells["IsSql"].Value) == false)//Access
                {
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = true;
                    Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(
                        Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value));

                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip;

                    Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(
                        SelfKeeperTip.PhaseProductCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase);

                    Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(
                        SelfKeeperTip.NeutralProductCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral);

                    Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(
                        SelfKeeperTip.NightProductCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight);
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = false;
                    Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode(
                        new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString()));

                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip;

                    Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(
                        SelfKeeperTip.PhaseProductxCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase);

                    Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(
                        SelfKeeperTip.NeutralProductxCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral);

                    Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(
                        SelfKeeperTip.NightProductxCode);
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight);
                }

                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                Atend.Base.Acad.AcadGlobal.SelfKeeperData.Existance = status.ACode;

                if (cboProjCode.Items.Count == 0)
                {
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = 0;
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString());
                if (cboProjCode.Items.Count != 0)
                {
                    Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString());
                }
                else
                {
                    Atend.Control.Common.ProjectCode = -1;
                }

                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Sag = 0;
                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Order = 0;
                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.DesignCode = Atend.Control.Common.SelectedDesignCode;
                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.ProductType = (int)Atend.Control.Enum.ProductType.SelfKeeper;
                //Atend.Base.Acad.AcadGlobal.dBranch.ProductCode = (int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value;
                //////Atend.Base.Acad.AcadGlobal.dBranch.XCode = new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString());
                //if (chkIsExist.CheckState == CheckState.Unchecked && cboIsExist.SelectedIndex == 0)
                //    //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 0;
                //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 0)
                //    //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 1;
                //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 1)
                //    //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 2;


                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = chkIsExist.Checked;
                //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Number = Atend.Base.Equipment.ESelfKeeperTip.SelectByCode((int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value).Description;

                AllowClose = true;
            }
            else
            {
                AllowClose = false;
            }
        }
Esempio n. 14
0
        private void Save()
        {
            txtName.Focus();
            string cmd     = string.Empty;
            bool   sw      = false;
            bool   swPhase = false;

            if (lblPhase.Text != "0")
            {
                cmd    += string.Format("{0}*{1}", lblPhase.Text, lblPhaseCross.Text);
                sw      = true;
                swPhase = true;
            }
            if (lblNeutral.Text != "0")
            {
                if (sw)
                {
                    cmd += " + ";
                }
                cmd += string.Format("{0}*{1}", lblNeutral.Text, lblNeutralCross.Text);
                sw   = true;
            }
            if (lblNight.Text != "0")
            {
                if (sw)
                {
                    cmd += " + ";
                }
                cmd += string.Format("{0}*{1}", lblNight.Text, lblNightCross.Text);
            }
            if (lblCross.Text != "0")
            {
                if (sw)
                {
                    cmd += " + ";
                }
                cmd += string.Format("{0}*{1}", lblCross.Text, lblCrossSectionArea.Text);
            }
            if (swPhase)
            {
                cmd += "  " + lblMaterialCode.Text;
            }

            //ed.WriteMessage(cmd+"\n");
            Atend.Base.Equipment.ESelfKeeperTip selfKeeperTip = new Atend.Base.Equipment.ESelfKeeperTip();
            selfKeeperTip.Name                = txtName.Text;
            selfKeeperTip.PhaseCount          = Convert.ToInt32(cboPhaseCount.SelectedItem.ToString());
            selfKeeperTip.NeutralCount        = Convert.ToInt32(cboNeutralCount.SelectedItem.ToString());
            selfKeeperTip.NightCount          = Convert.ToInt32(cboNightCount.SelectedItem.ToString());
            selfKeeperTip.NeutralProductxCode = new Guid(cboNeutralProductCode.SelectedValue.ToString());
            selfKeeperTip.PhaseProductxCode   = new Guid(cboPhaseProductCode.SelectedValue.ToString());
            selfKeeperTip.NightProductxCode   = new Guid(cboNightProductCode.SelectedValue.ToString());
            selfKeeperTip.Description         = "کابل خودنگهدار " + cmd;
            selfKeeperTip.CrossSection        = Convert.ToInt32(cboCrossSection.SelectedItem.ToString());
            selfKeeperTip.CrossSectionCount   = Convert.ToInt32(cboCrosSectionCount.SelectedItem.ToString());
            selfKeeperTip.IsDefault           = IsDefault;
            selfKeeperTip.Code                = Code;
            //ed.WriteMessage("XXXXXXXXXXXX save:{0}\n", selfKeeperTip.Code);
            if (SelectConductorTip == Guid.Empty)
            {
                if (selfKeeperTip.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                selfKeeperTip.XCode = SelectConductorTip;
                if (selfKeeperTip.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
Esempio n. 15
0
        public frmCrossSectionResult(DataTable dtBranch, DataTable dtNode, int TypeCode)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }
            InitializeComponent();
            //_dtBranchResult = dtBranch;
            _TypeCode = TypeCode;

            _dtBranchResult.Columns.Add("NameExist");
            _dtBranchResult.Columns.Add("NameComment");
            _dtBranchResult.Columns.Add("NameCommentTip");
            _dtBranchResult.Columns.Add("CommentTipXCode");
            _dtBranchResult.Columns.Add("Volt");
            _dtBranchResult.Columns.Add("LossPower");
            _dtBranchResult.Columns.Add("CurrentAbs");
            _dtBranchResult.Columns.Add("FromComment");
            _dtBranchResult.Columns.Add("ToComment");
            _dtBranchResult.Columns.Add("PowerLoss");
            _dtBranchResult.Columns.Add("CrossSectionArea");
            _dtBranchResult.Columns.Add("Length");
            _dtBranchResult.Columns.Add("Select");
            _dtBranchResult.Columns.Add("Code");
            _dtBranchResult.Columns.Add("ProductType");


            double totalloss = 0;

            Atend.Base.Calculating.CCrossSection.AccessDelete();

            foreach (DataRow d in dtBranch.Rows)
            {
                totalloss += Convert.ToDouble(d["PowerLoss"].ToString());
            }
            foreach (DataRow dr in dtBranch.Rows)
            {
                Atend.Base.Calculating.CCrossSection crossSection = new Atend.Base.Calculating.CCrossSection();

                if (new Guid(dr["Code"].ToString()) != Guid.Empty)
                {
                    DataRow drNew = _dtBranchResult.NewRow();

                    if (Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper))
                    {
                        Atend.Base.Equipment.ESelfKeeper    self    = new Atend.Base.Equipment.ESelfKeeper();
                        Atend.Base.Equipment.ESelfKeeperTip SelfTip = new Atend.Base.Equipment.ESelfKeeperTip();
                        if ((new Guid(dr["Code"].ToString()) != Guid.Empty))
                        {
                            SelfTip                = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));
                            self                   = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfTip.PhaseProductCode);
                            drNew["NameExist"]     = self.Name;
                            crossSection.ExistCond = self.Name;

                            Atend.Base.Equipment.ESelfKeeper Self1 = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                            drNew["NameComment"]     = Self1.Name;
                            crossSection.CommentCond = Self1.Name;

                            DataTable dtCommentTip = Atend.Base.Equipment.ESelfKeeperTip.SearchConductorSelfKeeperTipConductorTypeX(Convert.ToDouble(dr["CrossSectionArea"].ToString()), TypeCode);
                            //ed.WriteMessage("commentTipName={0}\n", dtCommentTip.Rows[0]["Name"].ToString());
                            if (dtCommentTip.Rows.Count > 0)
                            {
                                drNew["NameCommentTip"]  = dtCommentTip.Rows[0]["Name"].ToString();
                                drNew["CommentTipXCode"] = dtCommentTip.Rows[0]["XCode"].ToString();
                            }
                            else
                            {
                                drNew["NameCommentTip"] = "";
                            }
                        }
                    }
                    else if ((Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) || (Convert.ToInt32(dr["CondProductType"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Jumper)))
                    {
                        Atend.Base.Equipment.EConductor    cond    = new Atend.Base.Equipment.EConductor();
                        Atend.Base.Equipment.EConductorTip condTip = new Atend.Base.Equipment.EConductorTip();
                        if ((new Guid(dr["Code"].ToString()) != Guid.Empty))
                        {
                            ed.WriteMessage("ProductType={0},CondCode={1}\n", dr["condProductType"].ToString(), dr["CondCode"].ToString());
                            condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(Convert.ToInt32(dr["CondCode"].ToString()));
                            ed.WriteMessage("condTip.PhaseProductCode={0} \n", condTip.PhaseProductCode);

                            cond = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                            drNew["NameExist"]     = cond.Name;
                            crossSection.ExistCond = cond.Name;
                            ed.WriteMessage("****CondCode1={0}\n", dr["CondCode1"].ToString());
                            Atend.Base.Equipment.EConductor cond1 = Atend.Base.Equipment.EConductor.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                            drNew["NameComment"]     = cond1.Name;
                            crossSection.CommentCond = cond1.Name;

                            ed.WriteMessage("TypeCode={0}\n", TypeCode.ToString());

                            DataTable dtCommentTip = Atend.Base.Equipment.EConductorTip.SearchConductorConductorTipConductorTypeX(Convert.ToDouble(dr["CrossSectionArea"].ToString()), TypeCode);
                            ed.WriteMessage("commentTipName={0}\n", dtCommentTip.Rows[0]["Name"].ToString());
                            if (dtCommentTip.Rows.Count > 0)
                            {
                                drNew["NameCommentTip"]  = dtCommentTip.Rows[0]["Name"].ToString();
                                drNew["CommentTipXCode"] = dtCommentTip.Rows[0]["XCode"].ToString();
                            }
                            else
                            {
                                drNew["NameCommentTip"] = "";
                            }
                        }
                    }


                    //از
                    DataRow[] drnodeFrom = dtNode.Select(string.Format("ConsoleObjID={0}", dr["UpNodeId"].ToString()));
                    if (drnodeFrom.Length > 0)
                    {
                        drNew["FromComment"] = FindNodeComment(new Guid(drnodeFrom[0]["ConsoleGuid"].ToString()));
                    }


                    //به
                    DataRow[] drnodeTo = dtNode.Select(string.Format("ConsoleObjID={0}", dr["DnNodeId"].ToString()));
                    if (drnodeTo.Length > 0)
                    {
                        drNew["Volt"]      = Math.Round(((Complex)(drnodeTo[0]["Voltage"])).abs, 2).ToString();
                        drNew["ToComment"] = FindNodeComment(new Guid(drnodeTo[0]["ConsoleGuid"].ToString()));
                    }

                    //////{
                    //////    dr["LossPower"] = totalloss / ((Complex)dr["TotalLoad"]).real;

                    //////}

                    drNew["PowerLoss"]        = Convert.ToDouble(dr["PowerLoss"].ToString()) / 1000;
                    drNew["CurrentAbs"]       = Math.Round(((Complex)(dr["Current"])).abs, 1);
                    drNew["CrossSectionArea"] = Convert.ToDouble(dr["CrossSectionArea"].ToString());
                    drNew["Length"]           = Convert.ToDouble(dr["Length"].ToString());
                    drNew["Select"]           = true;
                    drNew["Code"]             = dr["Code"].ToString();
                    drNew["ProductType"]      = Convert.ToInt32(dr["CondProductType"].ToString());


                    _dtBranchResult.Rows.Add(drNew);

                    crossSection.Current      = Math.Round(((Complex)(dr["Current"])).abs, 1);
                    crossSection.From         = drNew["FromComment"].ToString();
                    crossSection.To           = drNew["ToComment"].ToString();
                    crossSection.CrossSection = Convert.ToDouble(drNew["CrossSectionArea"].ToString());
                    crossSection.Lenght       = Convert.ToDouble(drNew["Length"].ToString());
                    crossSection.Volt         = Math.Round(Convert.ToDouble(drNew["Volt"].ToString()), 1);
                    crossSection.PowerLoss    = Convert.ToDouble(drNew["PowerLoss"].ToString());

                    if (!crossSection.AccessInsert())
                    {
                        ed.WriteMessage("CrossSection Insert Failed\n");
                    }
                }


                //Atend.Base.Equipment.EConductor cond1 = Atend.Base.Equipment.EConductor.SelectByXCode(new Guid(dr["CondCode1"].ToString()));

                //dr["NameComment"] = cond1.Name;
            }
            ed.WriteMessage("1\n");
            //DataRow[] drs = _dtBranchResult.Select(" UpNodeId= 0 ");
            //drs[0].Delete();

            gvConductor.AutoGenerateColumns = false;
            gvConductor.DataSource          = _dtBranchResult;


            //حذف ستونی که دارای کد 0 می باشد
            //int countOfRows = gvConductor.Rows.Count;
            //for (int i = countOfRows; i >0 ; i--)
            //{
            //    ed.WriteMessage("i={0}\n",i.ToString());
            //    if (gvConductor.Rows[i].Cells["UpNodeId"].Value.ToString() == "0")
            //    {
            //        ed.WriteMessage("I AM In The IF\n");
            //        gvConductor.Rows.RemoveAt(i);
            //    }
            //}
            //gvConductor.Refresh();

            //////////تغییر رنگ بیشترین درصد افت توان در جدول
            ////////ed.WriteMessage("(((");
            ////////double max = Convert.ToDouble(gvConductor.Rows[0].Cells["Column7"].Value.ToString());
            ////////ed.WriteMessage("MAx={0}\n",max);
            ////////int j=0;
            ////////for (int i = 1; i < gvConductor.Rows.Count; i++)
            ////////{
            ////////    if (Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString()) > max)
            ////////    {
            ////////        max = Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString());
            ////////        j=i;
            ////////    }
            ////////}
            ////////ed.WriteMessage("MAx={0},J={1}\n",max,j);
            ////////gvConductor.Rows[j].DefaultCellStyle.BackColor=Color.Red;


            //////////یافتن تلفات کل شبکه
            ////////double  sum = 0;
            ////////for (int i = 0; i < gvConductor.Rows.Count; i++)
            ////////{
            ////////    sum += Convert.ToDouble(gvConductor.Rows[i].Cells["Column7"].Value.ToString());
            ////////}
            ////////lblSum.Text = sum.ToString();
            gvConductor.MouseMove += new MouseEventHandler(gvConductor_MouseMove);
        }
Esempio n. 16
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            this.Hide();

            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("PoleGuid={0} ,ConsolGuid={1}\n", atInfo.ParentCode, atInfo.NodeCode);
            DataTable dtCondAndSelf = Atend.Global.Acad.UAcad.FillBranchList();


            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;
                Nodeobj        = Convert.ToInt32(per.ObjectId.ToString().Substring(1, per.ObjectId.ToString().Length - 2));
                //ed.WriteMessage("NodeCode={0}\n",atInfo.NodeCode);
                Atend.Base.Design.DPackage dPAck = Atend.Base.Design.DPackage.AccessSelectByCode(new Guid(atInfo.NodeCode));
                //ed.WriteMessage("dConsol.ProductCode={0}\n",dconsol.ProductCode);
                if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Consol))
                {
                    Atend.Base.Equipment.EConsol eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(dPAck.ProductCode);
                    //ed.WriteMessage("^^^^={0}\n",eConsol.Length);
                    txtVolt.Text    = eConsol.VoltageLevel.ToString();
                    txtVoltTev.Text = eConsol.VoltageLevel.ToString();
                    if (eConsol.VoltageLevel == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                else if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.Kalamp))
                {
                    //ed.WriteMessage("This Is Kalamp\n");
                    Atend.Base.Equipment.EClamp Clamp = Atend.Base.Equipment.EClamp.AccessSelectByCode(dPAck.ProductCode);
                    txtVolt.Text    = Clamp.VoltageLevel.ToString();
                    txtVoltTev.Text = Clamp.VoltageLevel.ToString();
                    if (Clamp.VoltageLevel == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                else if (dPAck.Type == Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel))
                {
                    //ed.WriteMessage("This Is Kalamp\n");
                    Atend.Base.Equipment.EHeaderCabel HeaderCabel = Atend.Base.Equipment.EHeaderCabel.AccessSelectByCode(dPAck.ProductCode);
                    txtVolt.Text    = HeaderCabel.Voltage.ToString();
                    txtVoltTev.Text = HeaderCabel.Voltage.ToString();
                    if (HeaderCabel.Voltage == 400)
                    {
                        txtMaxDropVolt.Text  = "5";
                        txtMaxDropPower.Text = "3";
                    }
                    else
                    {
                        txtMaxDropVolt.Text  = "3";
                        txtMaxDropPower.Text = "3";
                    }
                }
                //ed.WriteMessage("dtCondAndSelf.Rows.Count={0}\n",dtCondAndSelf.Rows.Count);
                DataRow[] drCond = dtCondAndSelf.Select(string.Format("Type={0}", (int)Atend.Control.Enum.ProductType.Conductor));
                //System.Data.DataTable dtConductor = Atend.Global.Acad.UAcad.GetConsolConductors(new Guid(atInfo.ParentCode), new Guid(atInfo.NodeCode));
                if (drCond.Length != 0)
                {
                    Atend.Base.Design.DBranch branch = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(drCond[0]["BranchGuid"].ToString()));// SelectByCode(new Guid(dtConductor.Rows[0]["BranchGuid"].ToString()));
                    //ed.WriteMessage("branch.productCode={0}\n",branch.ProductCode);

                    Atend.Base.Equipment.EConductorTip condTip = Atend.Base.Equipment.EConductorTip.AccessSelectByCode(branch.ProductCode);
                    cond = Atend.Base.Equipment.EConductor.AccessSelectByCode(condTip.PhaseProductCode);
                    //ed.WriteMessage("Cond.TypeCode={0}\n",cond.TypeCode);
                    cboMaterial.SelectedIndex = cond.TypeCode;
                    //ed.WriteMessage("****\n");
                }

                DataRow[] drSelf = dtCondAndSelf.Select(string.Format("Type={0}", (int)Atend.Control.Enum.ProductType.SelfKeeper));
                if (drSelf.Length != 0)
                {
                    //ed.WriteMessage("Self\n");

                    Atend.Base.Design.DBranch           branchSelf = Atend.Base.Design.DBranch.AccessSelectByCode(new Guid(drSelf[0]["BranchGuid"].ToString()));
                    Atend.Base.Equipment.ESelfKeeperTip SelfTip    = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode(branchSelf.ProductCode);
                    Atend.Base.Equipment.ESelfKeeper    Self       = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode(SelfTip.PhaseProductCode);
                    CboMaterialCalamp.SelectedIndex = Self.MaterialConductorCode - 1;
                }
                txtX.Text           = "0";
                txtR.Text           = "0";
                txtLoadPercent.Text = "75";

                //ed.WriteMessage("FinishSElect\n");
            }
            else
            {
                MessageBox.Show("لطفت جهت شروع محاسبات یک گره را انتخاب کنید");
                CanDoCalculate = false;
            }
            this.Show();
        }