private void btnContinue_Click(object sender, EventArgs e) { if (Validation()) { //MessageBox.Show(""); ReadData(); Atend.Global.Calculation.General.General general = new Atend.Global.Calculation.General.General(); // Atend.Base.Calculating.CPowerWithHalter.AccessDeleteBySectionCodeIsUTS(SectionCode, IsUTs); // MessageBox.Show("1"); bool result = true; this.Cursor = Cursors.WaitCursor; DataTable dtResult = general.CalcHalter(dtForceOnPole, Convert.ToDouble(txtX.Text), Convert.ToDouble(txtY.Text), SaftyFactor, M, Count, Convert.ToInt32(txtMAxHalterCount.Text), out result, SaftyFactorOburi).Copy(); //MessageBox.Show("result",result.ToString()); this.Cursor = Cursors.Default; if (result) { foreach (DataRow dr in dtResult.Rows) { //MessageBox.Show("2"); Atend.Base.Calculating.CPowerWithHalter powerWithHalter = new Atend.Base.Calculating.CPowerWithHalter(); powerWithHalter.HalterCount = Convert.ToDouble(dr["HalterCount"].ToString()); powerWithHalter.HalterName = dr["Name"].ToString(); powerWithHalter.HalterPower = Convert.ToDouble(dr["HalterPower"].ToString()); powerWithHalter.IsUTS = IsUTs; powerWithHalter.PoleNum = dr["DcPole"].ToString(); powerWithHalter.PoleCount = Convert.ToInt16(dr["Count"].ToString()); powerWithHalter.PoleGuid = new Guid(dr["DcPoleGuid"].ToString()); powerWithHalter.PolePower = Convert.ToDouble(dr["Power"].ToString()); powerWithHalter.SectionCode = SectionCode; if (!powerWithHalter.AccessInsert()) { ed.WriteMessage("PowerWithHalter.AccessInsert Failed \n"); } } // MessageBox.Show("Befor Re"); frmHalterResult result1 = new frmHalterResult(dtResult, true, IsUTs); Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(result1); this.Close(); } else { ed.WriteMessage("لطفا مقادیر پیش فرض را تغییر دهید\n"); } } }
private void btnContinue_Click(object sender, EventArgs e) { if (!Validation()) { return; } if (rdbHalter.Checked) { frmHalter halter = new frmHalter(dtForceOnPole, Convert.ToDouble(txtSaftyFactor.Text), SectionCode, IsUts, Convert.ToDouble(txtSaftyFactorOburi.Text)); Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(halter); this.Close(); } if (rdbWithoutHalter.Checked) { Atend.Base.Calculating.CPowerWithOutHalter.AccessDeleteBySectionCodeIsUTS(SectionCode, IsUts); Atend.Global.Calculation.General.General general = new Atend.Global.Calculation.General.General(); this.Cursor = Cursors.WaitCursor; DataTable dtResult = general.GetForceOnPole(dtForceOnPole, Convert.ToDouble(txtSaftyFactor.Text), Convert.ToDouble(txtSaftyFactorOburi.Text)).Copy(); foreach (DataRow dr in dtResult.Rows) { Atend.Base.Calculating.CPowerWithOutHalter powerWithOutHalter = new Atend.Base.Calculating.CPowerWithOutHalter(); powerWithOutHalter.IsUTS = IsUts; powerWithOutHalter.PoleCount = Convert.ToByte(dr["DcCount"].ToString()); powerWithOutHalter.PoleGuid = new Guid(dr["DcPoleGuid"].ToString()); powerWithOutHalter.PolePower = Convert.ToDouble(dr["DcPower"].ToString()); powerWithOutHalter.SectionCode = SectionCode; powerWithOutHalter.PoleNum = dr["DcPole"].ToString(); if (!powerWithOutHalter.AccessInsert()) { ed.WriteMessage("PowerWithOutHalter.AccessInser Failed\n"); } else { ed.WriteMessage("PoWerWithoutHalter. Access Insert\n"); } } this.Cursor = Cursors.Default; frmHalterResult halterResult = new frmHalterResult(dtResult, false, IsUts); Autodesk.AutoCAD.ApplicationServices.Application.ShowModalDialog(halterResult); this.Close(); } }