private void tsbShare_Click(object sender, EventArgs e) { if (SelectedSectionLizerCode != Guid.Empty) { if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.SectionLizer), SelectedSectionLizerCode)) { Atend.Base.Equipment.ESectionLizer SectionLizer = Atend.Base.Equipment.ESectionLizer.SelectByXCode(SelectedSectionLizerCode); Code = SectionLizer.Code; MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); } else { MessageBox.Show("خطا در به اشتراک گذاری ."); } } else { MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); } //if (SelectedSectionLizerCode != Guid.Empty) //{ // if (Atend.Base.Equipment.ESectionLizer.ShareOnServer(SelectedSectionLizerCode)) // { // Atend.Base.Equipment.ESectionLizer s1 = Atend.Base.Equipment.ESectionLizer.SelectByXCode(SelectedSectionLizerCode); // Code = s1.Code; // MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد"); // } // else // MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید"); //} //else // MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید"); }
public void BindDataToOwnControl(Guid _Code) { SelectedSectionLizerCode = _Code; Atend.Base.Equipment.ESectionLizer sectionLizer = Atend.Base.Equipment.ESectionLizer.SelectByXCode(_Code); //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(Rod.ProductCode); Atend.Control.Common.selectedProductCode = sectionLizer.ProductCode; SelectProduct(); txtAmper.Text = Convert.ToString(Math.Round(sectionLizer.Amper, 4)); txtVolt.Text = Convert.ToString(Math.Round(sectionLizer.Volt, 4)); txtComment.Text = sectionLizer.Comment; txtName.Text = sectionLizer.Name; tsbIsDefault.Checked = sectionLizer.IsDefault; Code = sectionLizer.Code; BindTreeViwAndGrid(); }
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 (SelectedSectionLizerCode == Guid.Empty && IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } else { Atend.Base.Equipment.ESectionLizer SectionLizer = Atend.Base.Equipment.ESectionLizer.SelectByXCode(SelectedSectionLizerCode); if (SectionLizer.IsDefault || IsDefault) { MessageBox.Show("کاربر گرامی شما اجازه ویرایش تجهیز به صورت پیش فرض ندارید", "خطا"); return(false); } } } return(true); }
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(); return(false); } if (Atend.Base.Equipment.ESectionLizer.SearchByName(txtName.Text) == true && SelectedSectionLizerCode == Guid.Empty) { MessageBox.Show("نام قبلا استفاده شده است"); txtName.Focus(); 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(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(txtVolt.Text)) { MessageBox.Show("لطفا ولتاژ را مشخص نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtVolt.Focus(); txtVolt.Select(0, txtVolt.Text.Length); return(false); } if (!Atend.Control.NumericValidation.DoubleConverter(txtVolt.Text)) { MessageBox.Show("لطفاً ولتاژ را با فرمت مناسب وارد نمایید", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); txtVolt.Focus(); txtVolt.Select(0, txtVolt.Text.Length); return(false); } Atend.Base.Equipment.ESectionLizer sec = Atend.Base.Equipment.ESectionLizer.CheckForExist(Convert.ToDouble(txtAmper.Text), Convert.ToDouble(txtVolt.Text)); if (sec.Code != -1 && SelectedSectionLizerCode == Guid.Empty) { if (MessageBox.Show("سکشنولایزر با مشخصات داده شده موجود میباشد\n\n سکشنولایزر با مشخصات فوق : " + sec.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(SelectedSectionLizerCode, Convert.ToInt32(Atend.Control.Enum.ProductType.SectionLizer), _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.ESectionLizer sectionLizer = new Atend.Base.Equipment.ESectionLizer(); sectionLizer.ProductCode = Atend.Control.Common.selectedProductCode; sectionLizer.Amper = Convert.ToDouble(txtAmper.Text); sectionLizer.Volt = Convert.ToDouble(txtVolt.Text); sectionLizer.Comment = txtComment.Text; sectionLizer.Name = txtName.Text; sectionLizer.IsDefault = IsDefault; sectionLizer.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); } sectionLizer.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); } sectionLizer.OperationList = EOperation; if (SelectedSectionLizerCode == Guid.Empty) { if (sectionLizer.InsertX()) { Reset(); } else { MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا"); } } else { sectionLizer.XCode = SelectedSectionLizerCode; if (sectionLizer.UpdateX()) { Reset(); } else { MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا"); } } }