private void Save() { Atend.Base.Equipment.EConductor conductor = new Atend.Base.Equipment.EConductor(); txtName.Focus(); conductor.Alasticity = Convert.ToDouble(txtAlsticity.Text); conductor.Alpha = Convert.ToDouble(txtAlpha.Text); //conductor.CabelTypeCode = 0; conductor.CrossSectionArea = Convert.ToDouble(txtCrossSectionArea.Text); //conductor.DamperType = 0; conductor.Diagonal = Convert.ToDouble(txtDiagonal.Text); conductor.IsCabel = true; conductor.DamperType = Convert.ToByte(cboDamperType.SelectedValue); conductor.MaterialCode = Convert.ToByte(cboMaterial.SelectedValue.ToString()); conductor.MaxCurrent = Convert.ToDouble(txtMaxCurrent.Text); conductor.ProductCode = productCode; conductor.Reactance = Convert.ToDouble(txtReactance.Text); conductor.Resistance = Convert.ToDouble(txtResistance.Text); conductor.UTS = Convert.ToDouble(txtUTS.Text); conductor.Weight = Convert.ToDouble(txtWeight.Text); conductor.GMR = 0; conductor.Comment = txtComment.Text; conductor.Code = Code; if (SelectConductorXCode == Guid.Empty) { if (conductor.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { conductor.XCode = SelectConductorXCode; if (conductor.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }
private void Save() { txtName.Focus(); Atend.Base.Equipment.EConductor conductor = new Atend.Base.Equipment.EConductor(); conductor.Alasticity = Convert.ToDouble(txtAlsticity.Text); conductor.Alpha = Convert.ToDouble(txtAlpha.Text); conductor.CabelTypeCode = 0; conductor.CrossSectionArea = Convert.ToDouble(txtCrossSectionArea.Text); conductor.DamperType = 0; conductor.Diagonal = Convert.ToDouble(txtDiagonal.Text); conductor.IsCabel = false; conductor.MaterialCode = Convert.ToByte(cboMaterial.SelectedValue.ToString()); conductor.MaxCurrent = Convert.ToDouble(txtMaxCurrent.Text); conductor.ProductCode = Atend.Control.Common.selectedProductCode; conductor.Reactance = Convert.ToDouble(txtReactance.Text); conductor.Resistance = Convert.ToDouble(txtResistance.Text); conductor.UTS = Convert.ToDouble(txtUTS.Text); conductor.Weight = 0; conductor.GMR = Convert.ToDouble(txtGMR.Text); conductor.Wc = Convert.ToDouble(txtWC.Text); conductor.Comment = txtComment.Text; conductor.Name = txtName.Text; conductor.Capacitance = Convert.ToDouble(txtCApacitance.Text); conductor.TypeCode = Convert.ToInt32(cboType.SelectedIndex.ToString()); conductor.IsDefault = IsDefault; conductor.MaxCurrent1Second = Convert.ToDouble(txtMaxCurrent1Second.Text); conductor.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); } conductor.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); } conductor.OperationList = EOperation; if (SelectConductor == Guid.Empty) { if (conductor.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا"); } } else { conductor.XCode = SelectConductor; if (conductor.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }