public void BindDataToOwnControl(Guid _Code) { SelectConductor = _Code; //MessageBox.Show(" SelectConductor:" + SelectConductor.ToString() + "\n"); Atend.Base.Equipment.ESelfKeeper selfKeeper = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(_Code); Atend.Control.Common.selectedProductCode = selfKeeper.ProductCode; SelectProduct(); //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(conductor.ProductCode); //MessageBox.Show("Name:"+conductor.Name.ToString()); cboMaterialConductor.SelectedValue = selfKeeper.MaterialConductorCode; cboMaterialInsulator.SelectedValue = selfKeeper.MaterialDamperCode; txtName.Text = selfKeeper.Name; productCode = selfKeeper.ProductCode; txtAlpha.Text = Convert.ToString(Math.Round(selfKeeper.Alpha, 8)); txtWC.Text = Convert.ToString(Math.Round(selfKeeper.Wc, 8)); txtAlsticity.Text = Convert.ToString(Math.Round(selfKeeper.Alastisity, 8)); txtCrossSectionArea.Text = Convert.ToString(Math.Round(selfKeeper.CrossSectionAreaConductor, 8)); txtCrossSectionSelfKeeper.Text = Convert.ToString(Math.Round(selfKeeper.CrossSectionKeeper, 8)); txtDiagonal.Text = Convert.ToString(Math.Round(selfKeeper.Diagonal, 8)); txtMaxCurrent.Text = Convert.ToString(Math.Round(selfKeeper.MaxCurrent, 8)); txtReactance.Text = Convert.ToString(Math.Round(selfKeeper.Reactance, 8)); txtResistance.Text = Convert.ToString(Math.Round(selfKeeper.Resistance, 8)); txtUTS.Text = Convert.ToString(Math.Round(selfKeeper.UTS, 8)); txtWC.Text = Convert.ToString(Math.Round(selfKeeper.Weight, 8)); txtGMR.Text = Convert.ToString(Math.Round(selfKeeper.GMR, 8)); txtComment.Text = selfKeeper.Comment; txtNamedVoltage.Text = selfKeeper.NamedVoltage.ToString(); txtCapacitance.Text = selfKeeper.Capacitance.ToString(); tsbIsDefault.Checked = selfKeeper.IsDefault; txtMaxCurrent1Second.Text = selfKeeper.MaxCurrent1Second.ToString(); Code = selfKeeper.Code; BindTreeViwAndGrid(); }
private void tsbShare_Click(object sender, EventArgs e) { if (SelectConductor != Guid.Empty) { if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper), SelectConductor)) { Atend.Base.Equipment.ESelfKeeper SelfKeeper = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelectConductor); Code = SelfKeeper.Code; MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); } else { MessageBox.Show("خطا در به اشتراک گذاری ."); } } else { MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); } //if (SelectConductor != Guid.Empty) //{ // if (Atend.Base.Equipment.ESelfKeeper.ShareOnServer(SelectConductor)) // { // Atend.Base.Equipment.ESelfKeeper s1 = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelectConductor); // Code = s1.Code; // MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); // } // else // MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید"); //} //else // MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); }
private void cboPhaseProductCode_SelectedIndexChanged(object sender, EventArgs e) { Atend.Base.Equipment.ESelfKeeper c1 = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(new Guid(cboPhaseProductCode.SelectedValue.ToString())); lblPhaseCross.Text = Convert.ToString(c1.CrossSectionAreaConductor); byte mat = Convert.ToByte(c1.MaterialConductorCode.ToString()); //Extra //Atend.Base.Equipment.ESelfKeeperMaterialConductor m1 = Atend.Base.Equipment.ESelfKeeperMaterialConductor.SelectByCode(mat); //lblMaterialCode.Text = m1.Name; //MessageBox.Show(cboPhaseProductCode.SelectedValue.ToString()); }
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]); }
private bool CheckStatuseOfAccessChangeDefault() { Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault); if (!Atend.Control.Common.AccessChangeDefault) { if (SelectConductor == Guid.Empty && IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } else { Atend.Base.Equipment.ESelfKeeper selfKeeper = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelectConductor); if (selfKeeper.IsDefault || IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ویرایش تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } } } return(true); }
public bool ChangeBranchInfo() { OleDbConnection conection = new OleDbConnection(Atend.Control.ConnectionString.AccessCnString); OleDbTransaction transaction; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; try { conection.Open(); transaction = conection.BeginTransaction(); try { int ConductorCounter = 0; int SelfkeeperCounter = 0; int GroundCabelCounter = 0; foreach (Atend.Base.Design.DBranch branch in dBranch) { ObjectId obj = Atend.Global.Acad.UAcad.GetBranchByGuid(branch.Code); Atend.Base.Acad.AT_INFO atInfo = Atend.Base.Acad.AT_INFO.SelectBySelectedObjectId(obj); #region Conductor if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.Conductor)) { Atend.Base.Equipment.EConductor CondPhase = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip[ConductorCounter].PhaseProductXCode); Atend.Base.Equipment.EConductor CondNeutral = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip[ConductorCounter].NeutralProductXCode); Atend.Base.Equipment.EConductor CondNight = Atend.Base.Equipment.EConductor.SelectByXCode(CondTip[ConductorCounter].NightProductXCode); if (!CondPhase.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } if (!CondNeutral.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } if (!CondNight.AccessInsert(transaction, conection, true, true)) { } CondTip[ConductorCounter].PhaseProductCode = CondPhase.Code; CondTip[ConductorCounter].NeutralProductCode = CondNeutral.Code; CondTip[ConductorCounter].NightProductCode = CondNight.Code; if (!CondTip[ConductorCounter].AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Tip Failed"); } branch.ProductCode = CondTip[ConductorCounter].Code; branch.Number = CondTip[ConductorCounter].Description; atInfo.ProductCode = condTip[ConductorCounter].Code; if (branch.AccessUpdate(transaction, conection)) { Atend.Global.Acad.DrawEquips.AcDrawConductor.ChangeCounductorComment(obj, CondTip[ConductorCounter].Description); atInfo.Insert(); } else { throw new System.Exception("Insert Branch Failed"); } ConductorCounter++; } #endregion #region SelfKeeper if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper)) { Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelfTip[SelfkeeperCounter].PhaseProductxCode); Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelfTip[SelfkeeperCounter].NeutralProductxCode); Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(SelfTip[SelfkeeperCounter].NightProductxCode); if (!SelfPhase.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } if (!SelfNeutral.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } if (!SelfNight.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } SelfTip[SelfkeeperCounter].PhaseProductCode = SelfPhase.Code; SelfTip[SelfkeeperCounter].NeutralProductCode = SelfNeutral.Code; SelfTip[SelfkeeperCounter].NightProductCode = SelfNight.Code; if (!SelfTip[SelfkeeperCounter].AccessInsert(transaction, conection)) { throw new System.Exception("Insert Tip Failed"); } branch.ProductCode = SelfTip[SelfkeeperCounter].Code; branch.Number = SelfTip[SelfkeeperCounter].Description; atInfo.ProductCode = SelfTip[SelfkeeperCounter].Code; if (branch.AccessUpdate(transaction, conection)) { Atend.Global.Acad.DrawEquips.AcDrawSelfKeeper.ChangeCabelComment(obj, SelfTip[SelfkeeperCounter].Description); atInfo.Insert(); } else { throw new System.Exception("Insert Branch Failed"); } SelfkeeperCounter++; } #endregion #region GroundCabel if (branch.ProductType == Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel)) { Atend.Base.Equipment.EGroundCabel GroundPhase = Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundTip[GroundCabelCounter].PhaseProductXCode); Atend.Base.Equipment.EGroundCabel GroundNeutral = Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundTip[GroundCabelCounter].NeutralProductXCode); //Atend.Base.Equipment.EGroundCabel GroundNight = Atend.Base.Equipment.EGroundCabel.SelectByXCode(GroundTip[GroundCabelCounter].NightProductxCode); if (!GroundPhase.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } if (!GroundNeutral.AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Failed"); } //if (!GroundNight.AccessInsert(transaction, conection, true, true)) //{ // throw new System.Exception("Insert Failed"); //} GroundTip[GroundCabelCounter].PhaseProductCode = GroundPhase.Code; GroundTip[GroundCabelCounter].NeutralProductCode = GroundNeutral.Code; //GroundTip[GroundCabelCounter].NightProductCode = GroundNight.Code; if (!GroundTip[GroundCabelCounter].AccessInsert(transaction, conection, true, true)) { throw new System.Exception("Insert Tip Failed"); } branch.ProductCode = GroundTip[GroundCabelCounter].Code; branch.Number = GroundTip[GroundCabelCounter].Description; atInfo.ProductCode = GroundTip[GroundCabelCounter].Code; if (branch.AccessUpdate(transaction, conection)) { Atend.Global.Acad.DrawEquips.AcDrawGroundCabel.ChangeCabelComment(obj, GroundTip[GroundCabelCounter].Description); atInfo.Insert(); } else { throw new System.Exception("Insert Branch Failed"); } GroundCabelCounter++; } #endregion } } catch (System.Exception ex) { ed.WriteMessage("Error In 01={0}\n", ex.Message); transaction.Rollback(); conection.Close(); return(false); } } catch (System.Exception ex1) { ed.WriteMessage("Error in 02={0}\n", ex1.Message); conection.Close(); return(false); } transaction.Commit(); conection.Close(); return(true); }
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; } }
private bool Validation() { //if (Atend.Control.Common.selectedProductCode == -1) //{ // MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید", "خطا"); // return false; //} if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("لطفا نام را مشخص نمایید", "خطا"); txtName.Focus(); return(false); } if (Atend.Base.Equipment.ESelfKeeper.SearchByName(txtName.Text) == true && SelectConductor == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtCrossSectionArea.Text)) { MessageBox.Show("لطفاً سطح مقطع را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCrossSectionArea.Focus(); return(false); } if (string.IsNullOrEmpty(txtDiagonal.Text)) { MessageBox.Show("لطفاً قطر هادی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtDiagonal.Focus(); return(false); } if (string.IsNullOrEmpty(txtAlsticity.Text)) { MessageBox.Show("لطفاً الستیسیتی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAlsticity.Focus(); return(false); } //if (string.IsNullOrEmpty(txtWeight.Text)) //{ // MessageBox.Show("لطفاً وزن را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); // txtWeight.Focus(); // return false; //} if (string.IsNullOrEmpty(txtAlpha.Text)) { MessageBox.Show("لطفاً آلفا را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAlpha.Focus(); return(false); } if (string.IsNullOrEmpty(txtUTS.Text)) { MessageBox.Show("لطفاً UTS را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtUTS.Focus(); return(false); } if (string.IsNullOrEmpty(txtMaxCurrent.Text)) { MessageBox.Show("لطفاً ماکزیمم جریان را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtMaxCurrent.Focus(); return(false); } if (string.IsNullOrEmpty(txtResistance.Text)) { MessageBox.Show("لطفاً مقاومت اهمی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtResistance.Focus(); return(false); } if (string.IsNullOrEmpty(txtReactance.Text)) { MessageBox.Show("لطفاً مقاومت سلفی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCrossSectionArea.Focus(); return(false); } if (string.IsNullOrEmpty(txtCapacitance.Text)) { MessageBox.Show("لطفاً کپسیتانس را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCapacitance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtCrossSectionArea.Text)) { MessageBox.Show("لطفاٌ سطح مقطع را بافرمت عددی مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCrossSectionArea.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtDiagonal.Text)) { MessageBox.Show("لطفاً قطر هادی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtDiagonal.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtAlsticity.Text)) { MessageBox.Show("لطفاً الاستیسیتی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAlsticity.Focus(); return(false); } //if (!Atend.Control.NumericValidation.DoubleConverter(txtWeight.Text)) //{ // MessageBox.Show("لطفاً وزن را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); // txtWeight.Focus(); // return false; //} if (!Atend.Control.NumericValidation.DoubleConverter(txtAlpha.Text)) { MessageBox.Show("لطفاً آلفا را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAlpha.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtUTS.Text)) { MessageBox.Show("لطفاً UTS را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtUTS.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtMaxCurrent.Text)) { MessageBox.Show("لطفاً ماکزیمم جریان را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtMaxCurrent.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtResistance.Text)) { MessageBox.Show("لطفاً مقاومت اهمی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtResistance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtReactance.Text)) { MessageBox.Show("لطفاً مقاومت سلفی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtReactance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtGMR.Text)) { MessageBox.Show("لطفاً GRM را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtGMR.Focus(); return(false); } if (string.IsNullOrEmpty(txtWC.Text)) { MessageBox.Show("لطفاً وزن واحد طول سیم را وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtWC.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtWC.Text)) { MessageBox.Show("لطفاً وزن واحد طول سیم را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtWC.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtCapacitance.Text)) { MessageBox.Show("لطفاٌ کپسیتانس را بافرمت عددی مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCapacitance.Focus(); return(false); } Atend.Base.Equipment.ESelfKeeper selfkeeper = Atend.Base.Equipment.ESelfKeeper.CheckForExist(Convert.ToInt32(cboMaterialConductor.SelectedValue), Convert.ToInt32(cboMaterialInsulator.SelectedValue), Convert.ToDouble(txtCrossSectionArea.Text), Convert.ToDouble(txtCrossSectionSelfKeeper.Text), Convert.ToDouble(txtDiagonal.Text), Convert.ToDouble(txtAlsticity.Text), Convert.ToDouble(txtAlpha.Text), Convert.ToDouble(txtUTS.Text), Convert.ToDouble(txtMaxCurrent.Text), Convert.ToDouble(txtResistance.Text), Convert.ToDouble(txtReactance.Text), Convert.ToDouble(txtWC.Text), Convert.ToDouble(txtNamedVoltage.Text), Convert.ToDouble(txtCapacitance.Text), Convert.ToDouble(txtMaxCurrent1Second.Text)); if (selfkeeper.Code != -1 && SelectConductor == Guid.Empty) { if (MessageBox.Show("کابل خودنگهدار با مشخصات داده شده موجود میباشد\n\n کابل خودنگهدار با مشخصات فوق : " + selfkeeper.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { cboMaterialConductor.Focus(); return(false); } } if (!Atend.Global.Utility.UBinding.CheckGridValidation(gvOperation, 3)) { MessageBox.Show("لطفا تعداد آماده سازی را با فرمت مناسب وارد نمایید", "خطا"); gvOperation.Focus(); return(false); } if (!Atend.Global.Utility.UBinding.CheckGridValidation(gvSelectedEquipment, 2)) { MessageBox.Show("لطفا تعداد تجهیزات جانبی را با فرمت مناسب وارد نمایید", "خطا"); gvSelectedEquipment.Focus(); return(false); } for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); _EProductPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString()); if (Atend.Base.Equipment.EContainerPackage.FindLoopNode(SelectConductor, Convert.ToInt32(Atend.Control.Enum.ProductType.SelfKeeper), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
private void Save() { txtName.Focus(); Atend.Base.Equipment.ESelfKeeper selfKeeper = new Atend.Base.Equipment.ESelfKeeper(); selfKeeper.Alastisity = Convert.ToDouble(txtAlsticity.Text); selfKeeper.Alpha = Convert.ToDouble(txtAlpha.Text); selfKeeper.CrossSectionAreaConductor = Convert.ToDouble(txtCrossSectionArea.Text); selfKeeper.CrossSectionKeeper = Convert.ToDouble(txtCrossSectionSelfKeeper.Text);; selfKeeper.Diagonal = Convert.ToDouble(txtDiagonal.Text); selfKeeper.NamedVoltage = Convert.ToDouble(txtNamedVoltage.Text); selfKeeper.MaterialConductorCode = Convert.ToInt32(cboMaterialConductor.SelectedValue); selfKeeper.MaterialDamperCode = Convert.ToInt32(cboMaterialInsulator.SelectedValue); selfKeeper.MaxCurrent = Convert.ToDouble(txtMaxCurrent.Text); selfKeeper.ProductCode = Atend.Control.Common.selectedProductCode; selfKeeper.Reactance = Convert.ToDouble(txtReactance.Text); selfKeeper.Resistance = Convert.ToDouble(txtResistance.Text); selfKeeper.UTS = Convert.ToDouble(txtUTS.Text); selfKeeper.Weight = Convert.ToDouble(txtWC.Text); selfKeeper.GMR = Convert.ToDouble(txtGMR.Text); selfKeeper.Weight = Convert.ToDouble(txtWC.Text); selfKeeper.Comment = txtComment.Text; selfKeeper.Name = txtName.Text; selfKeeper.Capacitance = Convert.ToDouble(txtCapacitance.Text); selfKeeper.IsDefault = IsDefault; selfKeeper.MaxCurrent1Second = Convert.ToDouble(txtMaxCurrent1Second.Text); selfKeeper.Code = Code; //Equipment ArrayList EPackageProduct = new ArrayList(); for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); _EProductPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString()); EPackageProduct.Add(_EProductPackage); } selfKeeper.EquipmentList = EPackageProduct; //Operation ArrayList EOperation = new ArrayList(); for (int i = 0; i < gvOperation.Rows.Count; i++) { Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation(); _EOperation.ProductID = Convert.ToInt32(gvOperation.Rows[i].Cells[0].Value); _EOperation.Count = Convert.ToDouble(gvOperation.Rows[i].Cells[3].Value); EOperation.Add(_EOperation); } selfKeeper.OperationList = EOperation; if (SelectConductor == Guid.Empty) { if (selfKeeper.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { selfKeeper.XCode = SelectConductor; if (selfKeeper.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
//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; }
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(); }
private void btnOk_Click(object sender, EventArgs e) { if (Validation()) { if (Convert.ToBoolean(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells["IsSql"].Value) == false)//Access { Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = true; Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.AccessSelectByCode( Convert.ToInt32(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value)); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip; Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.PhaseProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase); Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.NeutralProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral); Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.AccessSelectByCode( SelfKeeperTip.NightProductCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight); } else { Atend.Base.Acad.AcadGlobal.SelfKeeperData.UseAccess = false; Atend.Base.Equipment.ESelfKeeperTip SelfKeeperTip = Atend.Base.Equipment.ESelfKeeperTip.SelectByXCode( new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[1].Value.ToString())); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeeperTip = SelfKeeperTip; Atend.Base.Equipment.ESelfKeeper SelfPhase = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.PhaseProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfPhase); Atend.Base.Equipment.ESelfKeeper SelfNeutral = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.NeutralProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNeutral); Atend.Base.Equipment.ESelfKeeper SelfNight = Atend.Base.Equipment.ESelfKeeper.SelectByXCode( SelfKeeperTip.NightProductxCode); Atend.Base.Acad.AcadGlobal.SelfKeeperData.eSelfKeepers.Add(SelfNight); } Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue)); Atend.Base.Acad.AcadGlobal.SelfKeeperData.Existance = status.ACode; if (cboProjCode.Items.Count == 0) { Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = 0; } else { Atend.Base.Acad.AcadGlobal.SelfKeeperData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue); } Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString()); if (cboProjCode.Items.Count != 0) { Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString()); } else { Atend.Control.Common.ProjectCode = -1; } //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Sag = 0; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Order = 0; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.DesignCode = Atend.Control.Common.SelectedDesignCode; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.ProductType = (int)Atend.Control.Enum.ProductType.SelfKeeper; //Atend.Base.Acad.AcadGlobal.dBranch.ProductCode = (int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value; //////Atend.Base.Acad.AcadGlobal.dBranch.XCode = new Guid(gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value.ToString()); //if (chkIsExist.CheckState == CheckState.Unchecked && cboIsExist.SelectedIndex == 0) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 0; //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 0) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 1; //if (chkIsExist.Checked && cboIsExist.SelectedIndex == 1) // //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = 2; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.IsExist = chkIsExist.Checked; //Atend.Base.Acad.AcadGlobal.SelfKeeperData.dBranch.Number = Atend.Base.Equipment.ESelfKeeperTip.SelectByCode((int)gvSelfKeeper.Rows[gvSelfKeeper.CurrentRow.Index].Cells[0].Value).Description; AllowClose = true; } else { AllowClose = false; } }
private void cboNightProductCode_SelectedIndexChanged(object sender, EventArgs e) { Atend.Base.Equipment.ESelfKeeper c1 = Atend.Base.Equipment.ESelfKeeper.SelectByXCode(new Guid(cboNightProductCode.SelectedValue.ToString())); lblNightCross.Text = Convert.ToString(c1.CrossSectionAreaConductor); }
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); }
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(); }