Exemplo n.º 1
0
 private void tsbShare_Click(object sender, EventArgs e)
 {
     if (SelectedKablshoCode != Guid.Empty)
     {
         if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.KablSho), SelectedKablshoCode))
         {
             Atend.Base.Equipment.EKablsho Kablsho = Atend.Base.Equipment.EKablsho.SelectByXCode(SelectedKablshoCode);
             Code = Kablsho.Code;
             MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
         }
         else
         {
             MessageBox.Show("خطا در به اشتراک گذاری .");
         }
     }
     else
     {
         MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
     }
     //if (SelectedKablshoCode != Guid.Empty)
     //{
     //    if (Atend.Base.Equipment.EKablsho.ShareOnServer(SelectedKablshoCode))
     //    {
     //        Atend.Base.Equipment.EKablsho k1 = Atend.Base.Equipment.EKablsho.SelectByXCode(SelectedKablshoCode);
     //        Code = k1.Code;
     //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
     //    }
     //    else
     //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
     //}
     //else
     //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
 }
Exemplo n.º 2
0
 public void BindDataToOwnControl(Guid XCode)
 {
     Atend.Base.Equipment.EKablsho kablsho = Atend.Base.Equipment.EKablsho.SelectByXCode(XCode);
     //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(bus.ProductCode);
     Atend.Control.Common.selectedProductCode = kablsho.ProductCode;
     SelectProduct();
     SelectedKablshoCode       = XCode;
     txtName.Text              = kablsho.Name;
     SelectedKablshoCode       = XCode;
     txtSize.Text              = Convert.ToString(Math.Round(kablsho.Size, 4));
     txtName.Text              = kablsho.Name;
     cboType.SelectedValue     = kablsho.Type;
     cboMaterial.SelectedValue = kablsho.Material;
     txtComment.Text           = kablsho.Comment;
     tsbIsDefault.Checked      = kablsho.IsDefault;
     SelectedCode              = kablsho.Code;
     Code = kablsho.Code;
     BindTreeViwAndGrid();
 }
Exemplo n.º 3
0
 private bool CheckStatuseOfAccessChangeDefault()
 {
     Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     //ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault);
     if (!Atend.Control.Common.AccessChangeDefault)
     {
         if (SelectedKablshoCode == Guid.Empty && IsDefault)
         {
             MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
             return(false);
         }
         else
         {
             Atend.Base.Equipment.EKablsho Equip = Atend.Base.Equipment.EKablsho.SelectByXCode(SelectedKablshoCode);
             if (Equip.IsDefault || IsDefault)
             {
                 MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                 return(false);
             }
         }
     }
     return(true);
 }
Exemplo n.º 4
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EKablsho kablsho = new Atend.Base.Equipment.EKablsho();
            kablsho.Size        = Convert.ToDouble(txtSize.Text);
            kablsho.ProductCode = Atend.Control.Common.selectedProductCode;
            kablsho.Type        = Convert.ToByte(cboType.SelectedValue);
            kablsho.Material    = Convert.ToByte(cboMaterial.SelectedValue);
            kablsho.Comment     = txtComment.Text;
            kablsho.Name        = txtName.Text;
            kablsho.IsDefault   = IsDefault;
            kablsho.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);
            }
            kablsho.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);
            }
            kablsho.OperationList = EOperation;
            if (SelectedKablshoCode == Guid.Empty)
            {
                if (kablsho.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                kablsho.XCode = SelectedKablshoCode;
                kablsho.Code  = SelectedCode;
                if (kablsho.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
Exemplo n.º 5
0
        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.EKablsho.SearchByName(txtName.Text) == true && SelectedKablshoCode == Guid.Empty)
            {
                MessageBox.Show("نام قبلا استفاده شده است", "خطا");
                txtName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtSize.Text))
            {
                MessageBox.Show("لطفاً سایز کابلشو را مشخص نمایید", "خطا");
                txtSize.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(cboMaterial.Text))
            {
                MessageBox.Show("لطفاً جنس کابلشو را مشخص نمایید", "خطا");
                cboMaterial.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(cboType.Text))
            {
                MessageBox.Show("لطفاً نوع کابلشو را مشخص نمایید", "خطا");
                cboType.Focus();
                return(false);
            }

            if (!Atend.Control.NumericValidation.DoubleConverter(txtSize.Text))
            {
                MessageBox.Show("لطفا سایز را با فرمت مناسب وارد نمایید", "خطا");
                txtSize.Focus();
                return(false);
            }

            Atend.Base.Equipment.EKablsho kablsho = Atend.Base.Equipment.EKablsho.CheckForExist(Convert.ToDouble(txtSize.Text), Convert.ToByte(cboType.SelectedValue), Convert.ToByte(cboMaterial.SelectedValue));
            if (kablsho.Code != -1 && SelectedKablshoCode == Guid.Empty)
            {
                if (MessageBox.Show("کابلشو با مشخصات داده شده موجود میباشد\n\n کابلشو با مشخصات فوق  : " + kablsho.Name + "\n\n" + "آیا مایل به ادامه  ثبت می باشید؟", "خطا", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
                {
                    txtSize.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(SelectedKablshoCode, Convert.ToInt32(Atend.Control.Enum.ProductType.KablSho), _EProductPackage.XCode, _EProductPackage.TableType))
                {
                    MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا");
                    gvSelectedEquipment.Focus();
                    return(false);
                }
            }

            return(CheckStatuseOfAccessChangeDefault());
            //return true;
        }