private void Save() { Atend.Base.Equipment.ECT ct = new Atend.Base.Equipment.ECT(); txtName.Focus(); ct.CT_Vol = double.Parse(txtCT_Vol.Text); ct.CT_Convert = txtCTConvert.Text; ct.ProductCode = Atend.Control.Common.selectedProductCode; ct.Comment = txtComment.Text; ct.Name = txtName.Text; ct.IsDefault = IsDefault; ct.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); } ct.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); } ct.OperationList = EOperation; if (SelectedCTXCode == Guid.Empty) { if (ct.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { ct.XCode = SelectedCTXCode; if (ct.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private bool Validation() { //btnInsert.Focus(); if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("لطفا نام را مشخص کنید", "خطا"); txtName.Focus(); return(false); } if (Atend.Base.Equipment.EInsulatorChain.SearchByName(txtName.Text) == true && SelectInsulatorChXCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtLenght.Text)) { MessageBox.Show("لطفا طول زنجیر مقره را مشخص نمایید", "خطا"); txtLenght.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtLenght.Text)) { MessageBox.Show("لطفاً طول زنجیر مقره را با فرمت مناسب مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtLenght.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(SelectInsulatorChXCode, Convert.ToInt32(Atend.Control.Enum.ProductType.InsulatorChain), _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.EPhusePole phusePole = new Atend.Base.Equipment.EPhusePole(); phusePole.Amper = Convert.ToDouble(txtAmper.Text); phusePole.ProductCode = Atend.Control.Common.selectedProductCode; phusePole.Comment = txtComment.Text; phusePole.Name = txtName.Text; phusePole.Mark = txtMark.Text; phusePole.IsDefault = IsDefault; phusePole.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); } phusePole.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); } phusePole.OperationList = EOperation; if (selectedPhusePoleCode == Guid.Empty) { if (phusePole.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { phusePole.XCode = selectedPhusePoleCode; if (phusePole.UpdateX()) { Reset(); } else { MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtName.Focus(); Atend.Base.Equipment.EReCloser reCloser = new Atend.Base.Equipment.EReCloser(); reCloser.Amper = Convert.ToDouble(txtAmper.Text); reCloser.ProductCode = Atend.Control.Common.selectedProductCode; reCloser.Type = Convert.ToByte(cboType.SelectedValue); reCloser.Comment = txtComment.Text; reCloser.Name = txtName.Text; reCloser.IsDefault = IsDefault; reCloser.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); } reCloser.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); } reCloser.OperationList = EOperation; if (SelectedRecloserCode == Guid.Empty) { if (reCloser.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { reCloser.XCode = SelectedRecloserCode; if (reCloser.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
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.EMeasuredJackPanel.SearchByName(txtName.Text) == true && selectedmjackpanel == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return false; } if (nudCount.Value == 0) { MessageBox.Show("لطفاً تعداد کنتور را مشخص نمایید", "خطا"); nudCount.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(selectedmjackpanel, Convert.ToInt32(Atend.Control.Enum.ProductType.MeasuredJackPanel), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return false; } } return CheckStatuseOfAccessChangeDefault(); //return true; }
private void Save() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; txtName.Focus(); Atend.Base.Equipment.EKhazanTip khazantip = new Atend.Base.Equipment.EKhazanTip(); khazantip.Name = txtName.Text; khazantip.IsDefault = IsDefault; //khazantip.Description = Descript; ArrayList EEquipment = new ArrayList(); //ed.WriteMessage(gvKhazanTip.Rows.Count.ToString()+"<--\n"); for (int j = 0; j < gvKhazanTip.Rows.Count; j++) { if (Convert.ToInt32(gvKhazanTip.Rows[j].Cells[2].Value.ToString()) != 0) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); //_EProductPackage.ProductCode = 0;// Convert.ToInt32(gvKhazanTip.Rows[j].Cells[0].Value.ToString()); _EProductPackage.XCode = new Guid(gvKhazanTip.Rows[j].Cells[0].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvKhazanTip.Rows[j].Cells[2].Value.ToString()); _EProductPackage.TableType = Convert.ToInt16(Atend.Control.Enum.ProductType.Khazan); //??? EEquipment.Add(_EProductPackage); //Description Descript += string.Format("{0}*({1})KVar,{2}KV \n", gvKhazanTip.Rows[j].Cells[2].Value, gvKhazanTip.Rows[j].Cells[4].Value, gvKhazanTip.Rows[j].Cells[3].Value); //ed.WriteMessage(Descript+"\n"); } } khazantip.EquipmentList = EEquipment; khazantip.Description = Descript; khazantip.Code = Code; if (selectedKhazanTipXCode == Guid.Empty) { if (khazantip.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { khazantip.XCode = selectedKhazanTipXCode; if (khazantip.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtName.Focus(); Atend.Base.Equipment.EMeasuredJackPanel MeasuredJackPanel = new Atend.Base.Equipment.EMeasuredJackPanel(); MeasuredJackPanel.ProductCode = Atend.Control.Common.selectedProductCode; MeasuredJackPanel.Comment = txtComment.Text; MeasuredJackPanel.Name = txtName.Text; MeasuredJackPanel.IsDefault = IsDefault; MeasuredJackPanel.Code = Code; MeasuredJackPanel.Count = Convert.ToInt32(nudCount.Value); //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); } MeasuredJackPanel.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); } MeasuredJackPanel.OperationList = EOperation; if (selectedmjackpanel == Guid.Empty) { if (MeasuredJackPanel.InsertX()) Reset(); else MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } else { MeasuredJackPanel.XCode = selectedmjackpanel; if (MeasuredJackPanel.UpdateX()) Reset(); else MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا"); } }
private bool Validation() { if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("لطفاً نام را مشخص نمایید", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(cboKind.Text)) { MessageBox.Show("لطفاً نوع سلول را مشخص نمایید", "خطا"); cboKind.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(SelectedCellCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Cell), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
private bool Validation() { txtName.Focus(); //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.EDB.SearchByName(txtName.Text) == true && selectedDBCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است"); return(false); } if (nudOutputCount.Value == 0) { MessageBox.Show("لطفاً تعداد خروجی را مشخص نمایید", "خطا"); nudOutputCount.Focus(); return(false); } if (nudInputCount.Value == 0) { MessageBox.Show("لطفاً تعداد ورودی را مشخص نمایید", "خطا"); nudInputCount.Focus(); return(false); } int i; for (i = 0; i < gvInputFeeder.Rows.Count; i++) { //DataGridViewComboBoxCell c0 = (DataGridViewComboBoxCell)gvInputFeeder.Rows[i].Cells[1]; DataGridViewComboBoxCell c1 = (DataGridViewComboBoxCell)gvInputFeeder.Rows[i].Cells[2]; try { //ed.WriteMessage("\nCombo Value = " + c1.Value.ToString() + "\n"); if (/*string.IsNullOrEmpty(c0.Value.ToString()) && */ string.IsNullOrEmpty(c1.Value.ToString())) { MessageBox.Show(". لطفاً فیوز مربوط به فیدر را انتخاب کنید", "خطا در پر کردن فیدرهای ورودی "); gvInputFeeder.Focus(); return(false); } } catch { MessageBox.Show(". لطفاً فیوز مربوط به فیدر را انتخاب کنید", "خطا در پر کردن فیدرهای ورودی "); gvInputFeeder.Focus(); return(false); } } for (i = 0; i < gvOutputFeeder.Rows.Count; i++) { //DataGridViewComboBoxCell c0 = (DataGridViewComboBoxCell)gvInputFeeder.Rows[i].Cells[1]; DataGridViewComboBoxCell c1 = (DataGridViewComboBoxCell)gvOutputFeeder.Rows[i].Cells[2]; try { if (/*string.IsNullOrEmpty(c0.Value.ToString()) && */ string.IsNullOrEmpty(c1.Value.ToString())) { MessageBox.Show(". لطفاً فیوز مربوط به فیدر را انتخاب کنید", "خطا در پر کردن فیدرهای خروجی "); gvOutputFeeder.Focus(); return(false); } } catch { MessageBox.Show(". لطفاً فیوز مربوط به فیدر را انتخاب کنید", "خطا در پر کردن فیدرهای خروجی "); gvOutputFeeder.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(selectedDBCode, Convert.ToInt32(Atend.Control.Enum.ProductType.DB), _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("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
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() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; txtName.Focus(); Atend.Base.Equipment.ERod Rod = new Atend.Base.Equipment.ERod(); Rod.ProductCode = Atend.Control.Common.selectedProductCode; Rod.Amper = Convert.ToDouble(txtAmper.Text); Rod.Vol = Convert.ToDouble(cboVol.Text); Rod.Comment = txtComment.Text; Rod.Type = Convert.ToByte(cboType.SelectedValue); Rod.Name = txtName.Text; Rod.IsDefault = IsDefault; Rod.Code = Code; //ed.WriteMessage("Code :=" + Code +"\n"); //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); } Rod.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); } Rod.OperationList = EOperation; if (SelectedRodCode == Guid.Empty) { if (Rod.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { Rod.XCode = SelectedRodCode; if (Rod.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private bool Validation() { //if (Atend.Control.Common.selectedProductCode == -1) //{ // MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید", "خطا"); // return false; //} if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("لطفا نام را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtName.Focus(); txtName.Select(0, txtName.Text.Length); return(false); } if (Atend.Base.Equipment.ERod.SearchByName(txtName.Text) == true && SelectedRodCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtAmper.Text)) { MessageBox.Show("لطفا آمپر را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAmper.Focus(); txtAmper.Select(0, txtAmper.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtAmper.Text)) { MessageBox.Show("لطفاً آمپر را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtAmper.Focus(); txtAmper.Select(0, txtAmper.Text.Length); return(false); } if (string.IsNullOrEmpty(cboVol.Text)) { MessageBox.Show("لطفا ولتاژ را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboVol.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(cboVol.Text)) { MessageBox.Show("لطفاً ولتاژ را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboVol.Focus(); //txtVol.Select(0, txtVol.Text.Length); return(false); } //if (string.IsNullOrEmpty(cboType.Text)) //{ // MessageBox.Show("لطفا نوع را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); // cboVol.Focus(); // return false; //} //if (!Atend.Control.NumericValidation.Int16Converter(cboType.Text)) //{ // MessageBox.Show("لطفاً نوع را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); // cboType.Focus(); // //txtVol.Select(0, txtVol.Text.Length); // return false; //} Atend.Base.Equipment.ERod rod = Atend.Base.Equipment.ERod.CheckForExist(Convert.ToDouble(cboVol.Text), Convert.ToDouble(txtAmper.Text)); if (rod.Code != -1 && SelectedRodCode == Guid.Empty) { if (MessageBox.Show("برقگیر با مشخصات داده شده موجود میباشد\n\n برقگیر با مشخصات فوق: " + rod.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { cboVol.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(SelectedRodCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Rod), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(true); }
private bool Validation() { //if (Atend.Control.Common.selectedProductCode == -1) //{ // MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید", "خطا"); // return false; //} if (string.IsNullOrEmpty(txtName.Text)) { MessageBox.Show("لطفا نام را مشخص نمایید", "خطا"); txtName.Focus(); txtName.Select(0, txtName.Text.Length); return(false); } if (Atend.Base.Equipment.EJackPanelWeek.SearchByName(txtName.Text) == true && selectedJackPanelWeekXCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(cboAutoKey.Text)) { MessageBox.Show("لطفا کلید اتوماتیک را مشخص نمایید", "خطا"); cboAutoKey.Focus(); return(false); } if (nudCountFeeder.Value == 0) { MessageBox.Show("لطفاً تعداد فیدر را مشخص نمایید", "خطا"); nudCountFeeder.Focus(); return(false); } foreach (DataRow dr in dt.Rows) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); _EProductPackage.XCode = new Guid(dr["XCode"].ToString()); _EProductPackage.Count = Convert.ToInt32(dr["Count"]); _EProductPackage.TableType = Convert.ToInt16(dr["TableType"]); if (Atend.Base.Equipment.EContainerPackage.FindLoopNode(selectedJackPanelWeekXCode, Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedProduct.Focus(); return(false); } } bool sw = true; //for (int i = 1; i <= Convert.ToInt32(nudCountFeeder.Value); i++) //{ // DataRow[] drs = dt.Select("Cell=" + i.ToString()); // if (drs.Length <= 0) // { // sw = false; // } //} //if (sw == false) //{ // MessageBox.Show("لطفاً تجهیزات فیدر ها را مشخص نمایید", "خطا"); // return false; //} return(CheckStatuseOfAccessChangeDefault()); //return true; }
private void Save() { txtName.Focus(); Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //ed.WriteMessage("Enter Save \n"); Atend.Base.Equipment.EKhazan khazan = new Atend.Base.Equipment.EKhazan(); ArrayList EOperation = new ArrayList(); khazan.Capacity = Convert.ToDouble(txtCapacity.Text); khazan.Comment = txtComment.Text; khazan.Maker = txtMaker.Text; khazan.Name = txtName.Text; khazan.Amper = Convert.ToInt32(txtAmper.Text); khazan.ProductCode = Atend.Control.Common.selectedProductCode; khazan.Vol = Convert.ToDouble(cboVol.Text); //ed.WriteMessage("After\n"); khazan.IsDefault = IsDefault; khazan.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); } khazan.EquipmentList = EPackageProduct; //Operation 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); } khazan.OperationList = EOperation; if (SelectedKhazanCode == Guid.Empty) { if (khazan.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } //MessageBox.Show(Atend.Control.Messages.Read("Insert_Error")); } else { khazan.XCode = SelectedKhazanCode; if (khazan.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; txtName.Focus(); ArrayList EPackageProduct = new ArrayList(); ArrayList EOperation = new ArrayList(); Atend.Base.Equipment.ECatOut catout = new Atend.Base.Equipment.ECatOut(); catout.Amper = Convert.ToDouble(txtAmper.Text); catout.ProductCode = Atend.Control.Common.selectedProductCode; catout.Type = Convert.ToByte(cboType.SelectedValue); catout.Vol = Convert.ToDouble(cboVol.Text); catout.Comment = txtComment.Text; catout.Name = txtName.Text; catout.IsDefault = IsDefault; catout.Code = Code; //Equipment for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); //ed.WriteMessage("Begin 1\n"); _EProductPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); //ed.WriteMessage("Begin 2\n" + gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); //ed.WriteMessage("Value:" + gvSelectedEquipment.Rows[j].Cells[3].Value.ToString() + "\n"); _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString()); EPackageProduct.Add(_EProductPackage); //ed.WriteMessage("aaa \n"); } catout.EquipmentList = EPackageProduct; //************ //Operation 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); } catout.OperationList = EOperation; //********** //if (Atend.Control.Common.selectedProductCode != -1) //{ if (SelectedCatoutXCode == Guid.Empty) { if (catout.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { catout.XCode = SelectedCatoutXCode; if (catout.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } //} //else //{ // MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید","خطا"); //} }
private bool Validation() { //ed.WriteMessage("GoToName ValiDation\n"); //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.EGroundCabel.SearchByName(txtName.Text) == true && SelectedCabelCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtCapacitance.Text)) { MessageBox.Show("لطفا ظرفیت را مشخص نمایید", "خطا"); txtCapacitance.Focus(); return(false); } if (string.IsNullOrEmpty(txtResistance.Text)) { MessageBox.Show("لطفا مقاومت اهمی را مشخص نمایید", "خطا"); txtResistance.Focus(); return(false); } if (string.IsNullOrEmpty(txtReactance.Text)) { MessageBox.Show("لطفا مقاومت سلفی را مشخص نمایید", "خطا"); txtReactance.Focus(); return(false); } if (string.IsNullOrEmpty(txtMaxCurrent.Text)) { MessageBox.Show("لطفا جریان را مشخص نمایید", "خطا"); txtMaxCurrent.Focus(); return(false); } if (string.IsNullOrEmpty(txtSize.Text)) { MessageBox.Show("لطفا سایز را مشخص نمایید", "خطا"); txtSize.Focus(); return(false); } if (string.IsNullOrEmpty(txtMaxCurrent1Second.Text)) { MessageBox.Show("لطفا حداکثر جریان در یک ثانیه را مشخص نمایید", "خطا"); txtMaxCurrent1Second.Focus(); return(false); } ///////////////////////////////////////////////////////////////////// if (!Atend.Control.NumericValidation.DoubleConverter(txtCapacitance.Text)) { MessageBox.Show("لطفا ظرفیت را با فرمت مناسب وارد کنید", "خطا"); txtCapacitance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtResistance.Text)) { MessageBox.Show("لطفا مقاومت اهمی را با فرمت مناسب وارد کنید", "خطا"); txtResistance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtReactance.Text)) { MessageBox.Show("لطفا مقاومت سلفی را با فرمت مناسب وارد کنید", "خطا"); txtReactance.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtMaxCurrent.Text)) { MessageBox.Show("لطفا جریان را با فرمت مناسب وارد کنید", "خطا"); txtMaxCurrent.Focus(); return(false); } if (!Atend.Control.NumericValidation.Int32Converter(txtSize.Text)) { MessageBox.Show("لطفا سایز را با فرمت مناسب وارد کنید", "خطا"); txtSize.Focus(); return(false); } if (!Atend.Control.NumericValidation.Int32Converter(txtMaxCurrent1Second.Text)) { MessageBox.Show("لطفا حداکثر جریان در یک ثانیه را با فرمت مناسب وارد کنید", "خطا"); txtMaxCurrent1Second.Focus(); return(false); } //ed.WriteMessage("GoToVol ValiDation\n"); if (string.IsNullOrEmpty(cboVol.Text)) { MessageBox.Show("لطفا ولتاژ را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboVol.Focus(); return(false); } //ed.WriteMessage("GoToVol ValiDation\n"); if (!Atend.Control.NumericValidation.DoubleConverter(cboVol.Text)) { MessageBox.Show("لطفاً ولتاژ را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboVol.Focus(); //txtVol.Select(0, txtVol.Text.Length); return(false); } //ed.WriteMessage("GoToCrossSection ValiDation\n"); if (string.IsNullOrEmpty(txtCrossSectionArea.Text)) { MessageBox.Show("لطفا سطح مقطع را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtCrossSectionArea.Focus(); return(false); } //ed.WriteMessage("IGoToNumString ValiDation\n"); if (string.IsNullOrEmpty(nudNumString.Text)) { MessageBox.Show("لطفا تعداد رشته را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); nudNumString.Focus(); return(false); } //ed.WriteMessage("GoToType ValiDation\n"); if (string.IsNullOrEmpty(cboType.Text)) { MessageBox.Show("لطفا نوع را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboType.Focus(); return(false); } Atend.Base.Equipment.EGroundCabel groundcabel = Atend.Base.Equipment.EGroundCabel.CheckForExist(Convert.ToInt32(nudNumString.Value), Convert.ToDouble(txtCrossSectionArea.Text), Convert.ToInt16(cboType.SelectedValue.ToString()), double.Parse(cboVol.Text), Convert.ToInt32(txtSize.Text), Convert.ToDouble(txtResistance.Text), Convert.ToDouble(txtReactance.Text), Convert.ToDouble(txtMaxCurrent.Text), Convert.ToDouble(txtCapacitance.Text)); if (groundcabel.Code != -1 && SelectedCabelCode == Guid.Empty) { if (MessageBox.Show("کابل زمینی با مشخصات داده شده موجود میباشد\n\n کابل زمینی با مشخصات فوق : " + groundcabel.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { nudNumString.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(SelectedCabelCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundCabel), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
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.EAutoKey_3p.SearchByName(txtName.Text) == true && SelectedHalterXCode == Guid.Empty) //{ // MessageBox.Show("نام قبلا استفاده شده است", "خطا"); // txtName.Focus(); // return false; //} if (string.IsNullOrEmpty(txtX.Text)) { MessageBox.Show("لطفاً مقدار X را مشخص نمایید", "خطا"); txtX.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtX.Text)) { MessageBox.Show("لطفاً X را با فرمت صحیح وارد نمایید", "خطا"); txtX.Select(0, txtX.Text.Length); return(false); } if (string.IsNullOrEmpty(txtY.Text)) { MessageBox.Show("لطفاً مقدار Y را مشخص نمایید", "خطا"); txtY.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtY.Text)) { MessageBox.Show("لطفاً Y را با فرمت صحیح وارد نمایید", "خطا"); txtY.Select(0, txtY.Text.Length); return(false); } if (string.IsNullOrEmpty(txtPower.Text)) { MessageBox.Show("لطفاً مقدار قدرت را مشخص نمایید", "خطا"); txtPower.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtPower.Text)) { MessageBox.Show("لطفاً قدرت را با فرمت صحیح وارد نمایید", "خطا"); txtPower.Select(0, txtY.Text.Length); 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(SelectedHalterXCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Halter), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
//public static DataTable SelectAllAndMerge() //{ // DataTable AccTbl = AccessSelectAll(); // DataTable SqlTbl = SelectAll(); // DataTable MergeTbl = SqlTbl.Copy(); // DataColumn IsSql = new DataColumn("IsSql", typeof(bool)); // IsSql.DefaultValue = true; // MergeTbl.Columns.Add(IsSql); // foreach (DataRow Dr in AccTbl.Rows) // { // DataRow MergeRow = MergeTbl.NewRow(); // foreach (DataColumn Dc in AccTbl.Columns) // { // MergeRow[Dc.ColumnName] = Dr[Dc.ColumnName]; // } // MergeRow["IsSql"] = false; // MergeRow["XCode"] = new Guid("00000000-0000-0000-0000-000000000000"); // MergeTbl.Rows.Add(MergeRow); // } // return MergeTbl; //} //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// public static bool SentFromLocalToAccess(int Code, Guid XCode, int Type, OleDbTransaction _transaction, OleDbConnection _connection) { int NewCode = 0; try { switch ((Atend.Control.Enum.ProductType)Type) { case Atend.Control.Enum.ProductType.Consol: Atend.Base.Equipment.EConsol SelectedConsol = Atend.Base.Equipment.EConsol.SelectByXCodeForDesign(XCode); if (SelectedConsol.Code != -1) { if (SelectedConsol.AccessInsert(_transaction, _connection, true, false)) { NewCode = SelectedConsol.Code; } else { throw new Exception("SelectedConsol.AccessInsert failed"); } } break; } //aval tazhiz bayad dar jadvale khodesh bere bad Code baraie ContainerCode ersal shavad if (Atend.Base.Equipment.EContainerPackage.SentFromLocalToAccess(XCode, Type, 1, _transaction, _connection)) { EProductPackage SubProducts = Atend.Base.Equipment.EProductPackage.SelectByCode(Code); if (SubProducts.Code != -1) { Atend.Base.Equipment.EProductPackage SelectedSub = Atend.Base.Equipment.EProductPackage.SelectByCode(Code); if (SelectedSub.Code != -1) { SelectedSub.productCode = NewCode; if (!SelectedSub.AccessInsert(_transaction, _connection)) { throw new Exception("SelectedSub.AccessInsert failed"); } } else { //error } //insert access here } else { //error } } else { //error } } catch (System.Exception ex) { return(false); } return(true); }
private void Save() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; btnInsert.Focus(); ed.WriteMessage("Start Save\n"); Atend.Base.Equipment.EPole Pole = new Atend.Base.Equipment.EPole(); ArrayList EOperation = new ArrayList(); //ArrayList EPackage = new ArrayList(); //ArrayList EContainer = new ArrayList(); Pole.ProductCode = Atend.Control.Common.selectedProductCode; Pole.Height = double.Parse(txtHeight.Text); Pole.Power = double.Parse(txtPower.Text); //Pole.Wc = double.Parse(txtWC.Text); ed.WriteMessage("~~~~~~~~~~~~~~~~~~~~~~PoleType={0}\n", cboPoleType.SelectedIndex.ToString()); Pole.Type = Convert.ToByte(cboPoleType.SelectedIndex); Pole.TopCrossSectionArea = double.Parse(txtTopCrossSectionArea.Text); Pole.ButtomCrossSectionArea = double.Parse(txtButtomCrossSectionArea.Text); //Pole.ContainerCode = SelectedPoleCode; Pole.Name = txtName.Text; Pole.Comment = txtComment.Text; Pole.Shape = Convert.ToByte(cboShape.SelectedIndex); Pole.IsDefault = IsDefault; Pole.Code = code; //saveOperation //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); } Pole.EquipmentList = EPackageProduct; //Operation for (int i = 0; i < gvSelectedProduct.Rows.Count; i++) { Atend.Base.Equipment.EOperation _EOperation = new Atend.Base.Equipment.EOperation(); _EOperation.ProductID = Convert.ToInt32(gvSelectedProduct.Rows[i].Cells[0].Value); _EOperation.Count = Convert.ToDouble(gvSelectedProduct.Rows[i].Cells[3].Value); EOperation.Add(_EOperation); } Pole.OperationList = EOperation; //if (Atend.Control.Common.selectedProductCode != -1) //{ if (SelectedPoleCode == Guid.Empty) { if (Pole.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { Pole.XCode = SelectedPoleCode; //MessageBox.Show("go to update method : " + Pole.Code + "\n"); if (Pole.UpdateX()) { ed.WriteMessage("Finish Updated\n"); Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } //} //else //{ // MessageBox.Show("لطفا ابتدا یک کالا را از پشتیبان انتخاب کنید", "خطا"); //} }
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.EPole.SearchByName(txtName.Text) == true && SelectedPoleCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(txtHeight.Text)) { MessageBox.Show("لطفا ارتفاع را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtHeight.Focus(); txtHeight.Select(0, txtHeight.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtHeight.Text)) { MessageBox.Show("لطفاً ارتفاع را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtHeight.Focus(); txtHeight.Select(0, txtHeight.Text.Length); return(false); } if (string.IsNullOrEmpty(txtPower.Text)) { MessageBox.Show("لطفا قدرت را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtPower.Focus(); txtPower.Select(0, txtPower.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtPower.Text)) { MessageBox.Show("لطفاً قدرت را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtPower.Focus(); txtPower.Select(0, txtPower.Text.Length); return(false); } if (string.IsNullOrEmpty(txtButtomCrossSectionArea.Text)) { MessageBox.Show("لطفا سطح مقطع بالایی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtButtomCrossSectionArea.Focus(); txtButtomCrossSectionArea.Select(0, txtButtomCrossSectionArea.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtTopCrossSectionArea.Text)) { MessageBox.Show("لطفاً سطح مقطع بالایی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtTopCrossSectionArea.Focus(); txtTopCrossSectionArea.Select(0, txtTopCrossSectionArea.Text.Length); return(false); } if (string.IsNullOrEmpty(txtButtomCrossSectionArea.Text)) { MessageBox.Show("لطفا سطح مقطع پایینی را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtButtomCrossSectionArea.Focus(); txtButtomCrossSectionArea.Select(0, txtButtomCrossSectionArea.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtButtomCrossSectionArea.Text)) { MessageBox.Show("لطفاً سطح مقطع پایینی را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtButtomCrossSectionArea.Focus(); txtButtomCrossSectionArea.Select(0, txtButtomCrossSectionArea.Text.Length); return(false); } if (string.IsNullOrEmpty(cboShape.Text)) { MessageBox.Show("لطفا نوع شکل را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); cboShape.Focus(); return(false); } Atend.Base.Equipment.EPole pole = Atend.Base.Equipment.EPole.CheckForExist(Convert.ToDouble(txtHeight.Text), Convert.ToDouble(txtPower.Text), Convert.ToDouble(txtTopCrossSectionArea.Text), Convert.ToDouble(txtButtomCrossSectionArea.Text), Convert.ToByte(cboPoleType.SelectedIndex), Convert.ToByte(cboShape.SelectedIndex)); if (pole.Code != -1 && SelectedPoleCode == Guid.Empty) { if (MessageBox.Show("پایه با مشخصات داده شده موجود میباشد\n\n پایه با مشخصات فوق : " + pole.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { txtHeight.Focus(); return(false); } } if (!Atend.Global.Utility.UBinding.CheckGridValidation(gvSelectedEquipment, 2)) { MessageBox.Show("لطفا تعداد تجهیزات جانبی را با فرمت مناسب وارد نمایید", "خطا"); return(false); } if (!Atend.Global.Utility.UBinding.CheckGridValidation(gvSelectedProduct, 3)) { MessageBox.Show("لطفا تعداد آماده سازی را با فرمت مناسب وارد نمایید", "خطا"); 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(SelectedPoleCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Pole), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
private void Save() { txtName.Focus(); Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //ed.WriteMessage("I Am In The Save\n"); Atend.Base.Equipment.EMiniatorKey miniatorKey = new Atend.Base.Equipment.EMiniatorKey(); miniatorKey.Amper = Convert.ToDouble(txtAmper.Text); miniatorKey.Mark = txtMark.Text; miniatorKey.ProductCode = Atend.Control.Common.selectedProductCode; miniatorKey.Comment = txtComment.Text; miniatorKey.Name = txtName.Text; miniatorKey.IsDefault = IsDefault; miniatorKey.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); } miniatorKey.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); } miniatorKey.OperationList = EOperation; if (selectedMiniatorkeyXCode == Guid.Empty) { if (miniatorKey.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { miniatorKey.XCode = selectedMiniatorkeyXCode; if (miniatorKey.UpdateX()) { Reset(); } else { MessageBox.Show("امکان ذخیره سازی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtName.Focus(); Atend.Base.Equipment.EHeaderCabel headerCabel = new Atend.Base.Equipment.EHeaderCabel(); ArrayList EOperation = new ArrayList(); headerCabel.CrossSectionArea = Convert.ToDouble(cboCrossSectionArea.Text); headerCabel.Material = Convert.ToByte(cboMat.SelectedValue); headerCabel.ProductCode = Atend.Control.Common.selectedProductCode; headerCabel.Type = Convert.ToByte(cboType.SelectedValue); headerCabel.Comment = txtComment.Text; headerCabel.Name = txtName.Text; headerCabel.Voltage = Convert.ToDouble(cboVol.Text); headerCabel.IsDefault = IsDefault; headerCabel.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); } headerCabel.EquipmentList = EPackageProduct; //Operation 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); } headerCabel.OperationList = EOperation; if (SelectedHeaderCabelCode == Guid.Empty) { if (headerCabel.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } //MessageBox.Show(Atend.Control.Messages.Read("Insert_Error")); } else { headerCabel.XCode = SelectedHeaderCabelCode; if (headerCabel.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtAmper.Focus(); btnInsert.Focus(); ArrayList EPackageProduct = new ArrayList(); Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; Atend.Base.Equipment.EBreaker breaker = new Atend.Base.Equipment.EBreaker(); breaker.Amper = Convert.ToDouble(txtAmper.Text); breaker.ProductCode = Atend.Control.Common.selectedProductCode; breaker.Type = Convert.ToByte(cboType.SelectedValue); breaker.Comment = txtComment.Text; breaker.Name = txtName.Text; breaker.IsDefault = IsDefault; breaker.Code = Code; //Equipment for (int j = 0; j < gvEquipment.Rows.Count; j++) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); //ed.WriteMessage("Begin 1\n"); //_EProductPackage.ProductCode = 0;// Convert.ToInt32(gvEquipment.Rows[j].Cells[0].Value.ToString()); _EProductPackage.XCode = new Guid(gvEquipment.Rows[j].Cells[0].Value.ToString()); //ed.WriteMessage("Begin 2\n" + gvEquipment.Rows[j].Cells[2].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvEquipment.Rows[j].Cells[2].Value.ToString()); //ed.WriteMessage("Value:" + gvEquipment.Rows[j].Cells[3].Value.ToString() + "\n"); _EProductPackage.TableType = Convert.ToInt16(gvEquipment.Rows[j].Cells[3].Value.ToString()); EPackageProduct.Add(_EProductPackage); //ed.WriteMessage("aaa \n"); } breaker.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); } breaker.OperationList = EOperation; //************ if (SelectedBreakerXCode == Guid.Empty) { if (breaker.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { breaker.XCode = new Guid(SelectedBreakerXCode.ToString()); if (breaker.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
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.EHeaderCabel.SearchByName(txtName.Text) == true && SelectedHeaderCabelCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (string.IsNullOrEmpty(cboType.Text)) { MessageBox.Show("لطفا نوع را مشخص نمایید", "خطا"); cboType.Focus(); return(false); } if (string.IsNullOrEmpty(cboMat.Text)) { MessageBox.Show("لطفا جنس را مشخص نمایید", "خطا"); cboMat.Focus(); return(false); } //if (!Atend.Control.NumericValidation.DoubleConverter(cboMat.Text)) //{ // MessageBox.Show("لطفا سطح مقطع رابا فرمت مناسب وارد نمایید", "خطا"); // cboMat.Focus(); // return false; //} if (string.IsNullOrEmpty(cboVol.Text)) { MessageBox.Show("لطفا ولتاژ را مشخص نمایید", "خطا"); cboVol.Focus(); return(false); } if (string.IsNullOrEmpty(cboCrossSectionArea.Text)) { MessageBox.Show("لطفا سطح مقطع را مشخص نمایید", "خطا"); cboCrossSectionArea.Focus(); return(false); } else { if (!Atend.Control.NumericValidation.DoubleConverter(cboCrossSectionArea.Text)) { MessageBox.Show("لطفا سطح مقطع را مشخص نمایید", "خطا"); cboCrossSectionArea.Focus(); return(false); } } //if (!Atend.Control.NumericValidation.DoubleConverter(cboVol.Text)) //{ // MessageBox.Show("لطفا ولتاژ رابا فرمت مناسب وارد نمایید", "خطا"); // cboVol.Focus(); // return false; //} Atend.Base.Equipment.EHeaderCabel headercabel = Atend.Base.Equipment.EHeaderCabel.CheckForExist(Convert.ToByte(cboMat.SelectedValue), Convert.ToByte(cboType.SelectedValue)); if (headercabel.Code != -1 && SelectedHeaderCabelCode == Guid.Empty) { if (MessageBox.Show("سرکابل با مشخصات داده شده موجود میباشد\n\n سرکابل با مشخصات فوق : " + headercabel.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { cboMat.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(SelectedHeaderCabelCode, Convert.ToInt32(Atend.Control.Enum.ProductType.HeaderCabel), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); //return true; }
private void Save() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; txtName.Focus(); btnInsert.Focus(); ArrayList EPackageProduct = new ArrayList(); ArrayList cellPackage = new ArrayList(); Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = new Atend.Base.Equipment.EJackPanelWeek(); jackPanelWeek.Name = txtName.Text; jackPanelWeek.AutoKey3pXCode = new Guid(cboAutoKey.SelectedValue.ToString()); jackPanelWeek.Comment = txtComment.Text; jackPanelWeek.FeederCount = Convert.ToInt32(nudCountFeeder.Value); jackPanelWeek.ProductCode = Atend.Control.Common.selectedProductCode; jackPanelWeek.IsDefault = IsDefault; jackPanelWeek.Code = Code; jackPanelWeek.BusXCode = new Guid(cboBus.SelectedValue.ToString()); //ed.WriteMessage("Begin \n"); ////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); } jackPanelWeek.OperationList = EOperation; ////****** Atend.Base.Equipment.EJackPanelWeekCell _cell = new Atend.Base.Equipment.EJackPanelWeekCell(); foreach (DataRow dr in dt.Rows) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); //_cell = new Atend.Base.Equipment.EJackPanelWeekCell(); //ed.WriteMessage("Begin 1\n"); // _EProductPackage.ProductCode = 0;// Convert.ToInt32(dr["productCode"]); _EProductPackage.XCode = new Guid(dr["XCode"].ToString()); //ed.WriteMessage("Begin 2\n"); _EProductPackage.Count = Convert.ToInt32(dr["Count"]); //ed.WriteMessage("Value:" + "\n"); _EProductPackage.TableType = Convert.ToInt16(dr["TableType"]); //_cell.Num = Convert.ToInt32(dr["cell"]); //_cell.IsNightLight = Convert.ToBoolean(dr["IsNightLight"]); EPackageProduct.Add(_EProductPackage); //cellPackage.Add(_cell); //ed.WriteMessage("aaa \n"); } //for (int i = 1; i <= jackPanelWeek.FeederCount; i++) //{ // _cell = new Atend.Base.Equipment.EJackPanelWeekCell(); // DataRow[] dr = dt.Select("Cell='" + i.ToString() + "'"); // _cell.Num = Convert.ToInt32(dr[0]["cell"]); // _cell.IsNightLight = Convert.ToBoolean(dr[0]["IsNightLight"]); // cellPackage.Add(_cell); //} ed.WriteMessage("*********dtcell.rows.count={0}", dtCell.Rows.Count); foreach (DataRow dr in dtCell.Rows) { _cell = new Atend.Base.Equipment.EJackPanelWeekCell(); _cell.Num = Convert.ToInt32(dr["cellNum"]); _cell.IsNightLight = Convert.ToBoolean(dr["IsNight"]); cellPackage.Add(_cell); } jackPanelWeek.EquipmentList = EPackageProduct; jackPanelWeek.CellList = cellPackage; jackPanelWeek.dtglobal = dt; //ed.WriteMessage("selectedJackPanelweek" + selectedJackPanelWeek.ToString()); if (selectedJackPanelWeekXCode == Guid.Empty) { if (jackPanelWeek.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { jackPanelWeek.XCode = selectedJackPanelWeekXCode; //ed.WriteMessage("consol.code:" + selectedConsol.ToString()); //MessageBox.Show("GoToUpdate"); //ed.WriteMessage("Go To Update\n"); if (jackPanelWeek.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; btnInsert.Focus(); Atend.Base.Equipment.EPoleTip poletip = new Atend.Base.Equipment.EPoleTip(); poletip.Name = txtName.Text; poletip.Comment = txtComment.Text; poletip.IsDefault = IsDefault; ed.WriteMessage("IsDefault={0}\n", IsDefault); poletip.HalterCount = Convert.ToInt32(nudHalter.Value); poletip.HalterXID = new Guid(cboHalterType.SelectedValue.ToString()); ed.WriteMessage("kkk\n"); poletip.Factor = 0; ////////////// ed.WriteMessage("gvPole={0}\n", gvPole.Rows[gvPole.CurrentRow.Index].Cells[0].Value.ToString()); poletip.PoleXCode = new Guid(gvPole.SelectedRows[0].Cells[0].Value.ToString()); poletip.Code = code; ed.WriteMessage("ss\n"); System.Drawing.Image image1 = pictureBox1.Image; poletip.Image = null; FileStream fs; if (txtImage.Text != String.Empty) { fs = new FileStream(txtImage.Text, FileMode.Open); BinaryReader br = new BinaryReader(fs); poletip.Image = br.ReadBytes((Int32)br.BaseStream.Length); fs.Dispose(); } else { //fs = new FileStream(Atend.Control.Common.fullPath + "\\Consol1.jpg", FileMode.Open); poletip.Image = image; //((System.Drawing.Image)(resources.GetObject("pictureBox2.Image"))); } //update if (selectedPoleTip != Guid.Empty) { //ed.WriteMessage("6 \n"); if (txtImage.Text == string.Empty && pictureBox1.Image != null) { poletip.Image = image; //ed.WriteMessage("7 \n"); } } ArrayList EEquipment = new ArrayList(); for (int j = 0; j < gvPoleTip.Rows.Count; j++) { if (Convert.ToInt32(gvPoleTip.Rows[j].Cells[2].Value.ToString()) != 0) { Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage(); _EProductPackage.XCode = new Guid(gvPoleTip.Rows[j].Cells[0].Value.ToString()); _EProductPackage.Count = Convert.ToInt32(gvPoleTip.Rows[j].Cells[2].Value.ToString()); _EProductPackage.TableType = Convert.ToInt16(Atend.Control.Enum.ProductType.Consol); EEquipment.Add(_EProductPackage); } } ed.WriteMessage("bb\n"); poletip.EquipmentList = EEquipment; if (selectedPoleTip == Guid.Empty) { if (poletip.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { poletip.XCode = selectedPoleTip; poletip.Code = SelectedPoleTipCode; if (poletip.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtName.Focus(); //ed.WriteMessage("I aM In sve Method"); Atend.Base.Equipment.EGroundCabel middleGroundCabel = new Atend.Base.Equipment.EGroundCabel(); ArrayList EOperation = new ArrayList(); middleGroundCabel.ProductCode = Atend.Control.Common.selectedProductCode; middleGroundCabel.Vol = double.Parse(cboVol.Text); middleGroundCabel.Type = Convert.ToInt16(cboType.SelectedValue.ToString());; middleGroundCabel.Code = Code; //if (nudNumString.SelectedIndex == 0 | nudNumString.SelectedIndex == 1 | cboNumString.SelectedIndex == 2 | cboNumString.SelectedIndex == 3 | cboNumString.SelectedIndex == 4) //{ // middleGroundCabel.NumString = Convert.ToInt32(cboNumString.Text); //} //else //{ // middleGroundCabel.NumString = 6; //} middleGroundCabel.NumString = Convert.ToInt32(nudNumString.Value); middleGroundCabel.Name = txtName.Text; //if (cboNumString.SelectedIndex == 0 | cboNumString.SelectedIndex == 1 | cboNumString.SelectedIndex == 2 | cboNumString.SelectedIndex == 3 | cboNumString.SelectedIndex == 4) //{ // middleGroundCabel.CrossSectionArea =Convert.ToDouble(cboCrossSectionArea.Text); //} //else //{ // middleGroundCabel.CrossSectionArea = Convert.ToDouble(CrossSectionValue1[cboCrossSectionArea.SelectedIndex]); //} middleGroundCabel.CrossSectionArea = Convert.ToDouble(txtCrossSectionArea.Text); middleGroundCabel.Comment = txtComment.Text; middleGroundCabel.IsDefault = IsDefault; middleGroundCabel.MaxCurrent = Convert.ToDouble(txtMaxCurrent.Text); middleGroundCabel.Reactance = Convert.ToDouble(txtReactance.Text); middleGroundCabel.Resistance = Convert.ToDouble(txtResistance.Text); middleGroundCabel.Capacitance = Convert.ToDouble(txtCapacitance.Text); middleGroundCabel.Size = Convert.ToInt32(txtSize.Text); middleGroundCabel.MaxCurrent1Second = Convert.ToDouble(txtMaxCurrent1Second.Text); //saveOperation //ed.WriteMessage("I aM In sve Opearation"); //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); } middleGroundCabel.EquipmentList = EPackageProduct; //Operation 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); } middleGroundCabel.OperationList = EOperation; if (SelectedCabelCode == Guid.Empty) { if (middleGroundCabel.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { middleGroundCabel.XCode = SelectedCabelCode; //MessageBox.Show("go to update method : " + Pole.Code + "\n"); if (middleGroundCabel.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
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.ECountor.SearchByName(txtName.Text) == true && CountorXCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است", "خطا"); txtName.Focus(); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtAmper.Text)) { MessageBox.Show("لطفاً آمپراژ را با فرمت مناسب ، مشخص نمایید", "خطا"); txtAmper.Focus(); txtAmper.Select(0, txtAmper.Text.Length); return(false); } if (nudPhaseCount.Value == 0) { MessageBox.Show("لطفاً تعداد فاز را مشخص نمایید", "خطا"); nudPhaseCount.Focus(); return(false); } Atend.Base.Equipment.ECountor counter = Atend.Base.Equipment.ECountor.CheckForExist(Convert.ToDouble(txtAmper.Text), Convert.ToInt32(nudPhaseCount.Value)); if (counter.Code != -1 && CountorXCode == Guid.Empty) { if (MessageBox.Show("کنتور با مشخصات داده شده موجود میباشد\n\n کنتور با مشخصات فوق : " + counter.Name + "\n\n" + "آیا مایل به ادامه ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { txtAmper.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(CountorXCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Countor), _EProductPackage.XCode, _EProductPackage.TableType)) { MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا"); gvSelectedEquipment.Focus(); return(false); } } return(CheckStatuseOfAccessChangeDefault()); // return true; }
private void Save() { txtName.Focus(); Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor; //ArrayList EPackageProduct = new ArrayList(); ArrayList equipmentlist = new ArrayList(); Atend.Base.Equipment.ECell cell = new Atend.Base.Equipment.ECell(); for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++) { Atend.Base.Equipment.EProductPackage productPackage = new Atend.Base.Equipment.EProductPackage(); productPackage.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); //productPackage.ProductCode = 0;// Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); productPackage.XCode = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); productPackage.TableType = Convert.ToByte(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString()); //cellsub.ProductCode = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); //cellsub.Count = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); ////cellsub.CellCode = cell.Code; /*MessageBox.Show("0>>" + gvSelectedEquipment.Rows[j].Cells[0].Value.ToString()); * MessageBox.Show("1>>" + gvSelectedEquipment.Rows[j].Cells[1].Value.ToString()); * MessageBox.Show("2>>" + gvSelectedEquipment.Rows[j].Cells[2].Value.ToString()); * MessageBox.Show("3>>" + gvSelectedEquipment.Rows[j].Cells[3].Value.ToString()); */ equipmentlist.Add(productPackage); } cell.EquipmentList = equipmentlist; cell.Type = Convert.ToByte(cboKind.SelectedValue); cell.Name = txtName.Text; cell.IsDefault = IsDefault; cell.Code = Code; 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); } cell.OperationList = EOperation; if (SelectedCellCode == Guid.Empty) { if (cell.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { cell.XCode = SelectedCellCode; if (cell.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }