示例#1
0
        private void tsbShare_Click(object sender, EventArgs e)
        {
            if (SelectedBusCode != Guid.Empty)
            {
                if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.Bus), SelectedBusCode))
                {
                    Atend.Base.Equipment.EBus Bus = Atend.Base.Equipment.EBus.SelectByXCode(SelectedBusCode);
                    Code = Bus.Code;
                    MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
                }
                else
                {
                    MessageBox.Show("خطا در به اشتراک گذاری .");
                }
            }
            else
            {
                MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
            }

            //if (SelectedBusCode != Guid.Empty)
            //{
            //    if (Atend.Base.Equipment.EBus.ShareOnServer(SelectedBusCode))
            //    {
            //        Atend.Base.Equipment.EBus b1 = Atend.Base.Equipment.EBus.SelectByXCode(SelectedBusCode);
            //        Code = b1.Code;
            //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
            //    }
            //    else
            //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
            //}
            //else
            //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
        }
示例#2
0
 public void BindDataToOwnControl(Guid XCode)
 {
     Atend.Base.Equipment.EBus bus = Atend.Base.Equipment.EBus.SelectByXCode(XCode);
     //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(bus.ProductCode);
     Atend.Control.Common.selectedProductCode = bus.ProductCode;
     SelectProduct();
     SelectedBusCode       = XCode;
     txtName.Text          = bus.Name;
     SelectedBusCode       = XCode;
     txtSize.Text          = bus.Size.ToString();
     txtName.Text          = bus.Name;
     cboType.SelectedValue = bus.Type;
     txtVoltage.Text       = bus.Voltage.ToString();
     //cboMaterial.SelectedValue = bus.MaterialCode;
     txtComment.Text      = bus.Comment;
     tsbIsDefault.Checked = bus.IsDefault;
     Code = bus.Code;
     BindTreeViwAndGrid();
 }
示例#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 (SelectedBusCode == Guid.Empty && IsDefault)
         {
             MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
             return(false);
         }
         else
         {
             Atend.Base.Equipment.EBus Equip = Atend.Base.Equipment.EBus.SelectByXCode(SelectedBusCode);
             if (Equip.IsDefault || IsDefault)
             {
                 MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                 return(false);
             }
         }
     }
     return(true);
 }
示例#4
0
        //private string FindNameOperation(Guid Code)
        //{
        //    string DBName = string.Empty;
        //    Atend.Base.Equipment.EOperation eOP = Atend.Base.Equipment.EOperation.SelectByCode(Code);
        //    Atend.Base.Base.BProduct BP = Atend.Base.Base.BProduct.Select_ById(eOP.ProductID);

        //    DBName = BP.Name;
        //    PID = BP.Code;
        //    return DBName;
        //}

        private string FindNameAndProductCode(int Type, int ProductCode)
        {
            //Atend.Base.Equipment.EPole. p = new Atend.Base.Equipment.EPole();

            string DBName = string.Empty;

            switch ((Atend.Control.Enum.ProductType)Type)
            {
            case Atend.Control.Enum.ProductType.Pole:
                Atend.Base.Equipment.EPole ePole = Atend.Base.Equipment.EPole.SelectByCode(ProductCode);
                DBName = ePole.Name;
                PID    = ePole.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Conductor:
                Atend.Base.Equipment.EConductor eConductor = Atend.Base.Equipment.EConductor.SelectByCode(ProductCode);
                DBName = eConductor.Name;
                PID    = eConductor.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.AuoKey3p:
                Atend.Base.Equipment.EAutoKey_3p eAuto = Atend.Base.Equipment.EAutoKey_3p.SelectByCode(ProductCode);
                DBName = eAuto.Name;
                PID    = eAuto.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Breaker:
                Atend.Base.Equipment.EBreaker eBreaker = Atend.Base.Equipment.EBreaker.SelectByCode(ProductCode);
                DBName = eBreaker.Name;
                PID    = eBreaker.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Bus:
                Atend.Base.Equipment.EBus eBus = Atend.Base.Equipment.EBus.SelectByCode(ProductCode);
                DBName = eBus.Name;
                PID    = eBus.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.CatOut:
                Atend.Base.Equipment.ECatOut eCatOut = Atend.Base.Equipment.ECatOut.SelectByCode(ProductCode);
                DBName = eCatOut.Name;
                PID    = eCatOut.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.CT:
                Atend.Base.Equipment.ECT eCT = Atend.Base.Equipment.ECT.SelectByCode(ProductCode);
                DBName = eCT.Name;
                PID    = eCT.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.DB:
                Atend.Base.Equipment.EDB eDB = Atend.Base.Equipment.EDB.SelectByCode(ProductCode);
                DBName = eDB.Name;
                PID    = eDB.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.HeaderCabel:
                Atend.Base.Equipment.EHeaderCabel eHeader = Atend.Base.Equipment.EHeaderCabel.SelectByCode(ProductCode);
                DBName = eHeader.Name;
                PID    = eHeader.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Disconnector:
                Atend.Base.Equipment.EDisconnector eDC = Atend.Base.Equipment.EDisconnector.SelectByCode(ProductCode);
                DBName = eDC.Name;
                PID    = eDC.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Rod:
                Atend.Base.Equipment.ERod eRod = Atend.Base.Equipment.ERod.SelectByCode(ProductCode);
                DBName = eRod.Name;
                PID    = eRod.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Countor:
                Atend.Base.Equipment.ECountor eCounter = Atend.Base.Equipment.ECountor.SelectByCode(ProductCode);
                DBName = eCounter.Name;
                PID    = eCounter.ProductCode;
                break;

            //case Atend.Control.Enum.ProductType.JackPanel:
            //    Atend.Base.Equipment.EJAckPanel eJack = Atend.Base.Equipment.EJAckPanel.SelectByCode(ProductCode);
            //    break;

            case Atend.Control.Enum.ProductType.PhotoCell:
                Atend.Base.Equipment.EPhotoCell ePhotoCell = Atend.Base.Equipment.EPhotoCell.SelectByCode(ProductCode);
                DBName = ePhotoCell.Name;
                PID    = ePhotoCell.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Phuse:
                Atend.Base.Equipment.EPhuse ePhuse = Atend.Base.Equipment.EPhuse.SelectByCode(ProductCode);
                DBName = ePhuse.Name;
                PID    = ePhuse.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.StreetBox:
                Atend.Base.Equipment.EStreetBox eStreet = Atend.Base.Equipment.EStreetBox.SelectByCode(ProductCode);
                DBName = eStreet.Name;
                PID    = eStreet.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Transformer:
                Atend.Base.Equipment.ETransformer eTrans = Atend.Base.Equipment.ETransformer.SelectByCode(ProductCode);
                DBName = eTrans.Name;
                PID    = eTrans.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.PT:
                Atend.Base.Equipment.EPT ePT = Atend.Base.Equipment.EPT.SelectByCode(ProductCode);
                DBName = ePT.Name;
                PID    = ePT.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Insulator:
                Atend.Base.Equipment.EInsulator eInsulator = Atend.Base.Equipment.EInsulator.SelectByCode(ProductCode);
                DBName = eInsulator.Name;
                PID    = eInsulator.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.ReCloser:
                Atend.Base.Equipment.EReCloser eRecloser = Atend.Base.Equipment.EReCloser.SelectByCode(ProductCode);
                DBName = eRecloser.Name;
                PID    = eRecloser.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.PhuseKey:
                Atend.Base.Equipment.EPhuseKey ePhusekey = Atend.Base.Equipment.EPhuseKey.SelectByCode(ProductCode);
                DBName = ePhusekey.Name;
                PID    = ePhusekey.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Consol:
                Atend.Base.Equipment.EConsol eConsol = Atend.Base.Equipment.EConsol.SelectByCode(ProductCode);
                DBName = eConsol.Name;
                PID    = eConsol.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.PhusePole:
                Atend.Base.Equipment.EPhusePole ePhusepole = Atend.Base.Equipment.EPhusePole.SelectByCode(ProductCode);
                DBName = ePhusepole.Name;
                PID    = ePhusepole.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                Atend.Base.Equipment.EJAckPanel eJackP = Atend.Base.Equipment.EJAckPanel.SelectByCode(ProductCode);
                DBName = eJackP.Name;
                PID    = eJackP.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.Khazan:
                Atend.Base.Equipment.EKhazan eKhazan = Atend.Base.Equipment.EKhazan.SelectByCode(ProductCode);
                DBName = eKhazan.Name;
                PID    = eKhazan.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.GroundPost:
                Atend.Base.Equipment.EGroundPost ePost = Atend.Base.Equipment.EGroundPost.SelectByCode(ProductCode);
                DBName = ePost.Name;
                PID    = ePost.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.AirPost:
                Atend.Base.Equipment.EAirPost eAirpost = Atend.Base.Equipment.EAirPost.SelectByCode(ProductCode);
                DBName = eAirpost.Name;
                PID    = eAirpost.ProductCode;
                break;

            case Atend.Control.Enum.ProductType.WeekJackPanel:
                Atend.Base.Equipment.EJackPanelWeek eJPW = Atend.Base.Equipment.EJackPanelWeek.SelectByCode(ProductCode);
                DBName = eJPW.Name;
                PID    = eJPW.ProductCode;
                break;
            }

            return(DBName);
        }
示例#5
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EBus bus = new Atend.Base.Equipment.EBus();
            bus.Size = txtSize.Text;
            //bus.MaterialCode = Convert.ToByte(cboMaterial.SelectedValue);
            bus.ProductCode = Atend.Control.Common.selectedProductCode;
            bus.Type        = Convert.ToByte(cboType.SelectedValue);
            bus.Comment     = txtComment.Text;
            bus.Name        = txtName.Text;
            bus.IsDefault   = IsDefault;
            bus.Voltage     = Convert.ToDouble(txtVoltage.Text);
            bus.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);
            }
            bus.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);
            }
            bus.OperationList = EOperation;
            if (SelectedBusCode == Guid.Empty)
            {
                if (bus.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                bus.XCode = SelectedBusCode;
                if (bus.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
示例#6
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.EBus.SearchByName(txtName.Text) == true && SelectedBusCode == Guid.Empty)
            {
                MessageBox.Show("نام قبلا استفاده شده است", "خطا");
                txtName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(txtSize.Text))
            {
                MessageBox.Show("لطفاً سایز شین را مشخص نمایید", "خطا");
                txtSize.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(txtVoltage.Text))
            {
                MessageBox.Show("لطفاً ولتاژ شین را مشخص نمایید", "خطا");
                txtVoltage.Focus();
                return(false);
            }
            if (!Atend.Control.NumericValidation.DoubleConverter(txtVoltage.Text))
            {
                MessageBox.Show("لطفاً ولتاژ شین رابا فرمت مناسب مشخص نمایید", "خطا");
                txtVoltage.Focus();
                return(false);
            }
            Atend.Base.Equipment.EBus bus = Atend.Base.Equipment.EBus.CheckForExist(txtSize.Text, Convert.ToByte(cboType.SelectedValue));
            if (bus.Code != -1 && SelectedBusCode == Guid.Empty)
            {
                if (MessageBox.Show("شین با مشخصات داده شده موجود میباشد\n\n شین با مشخصات فوق  :  " + bus.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(SelectedBusCode, Convert.ToInt32(Atend.Control.Enum.ProductType.Bus), _EProductPackage.XCode, _EProductPackage.TableType))
                {
                    MessageBox.Show(string.Format("تجهیز '{0}' در زیر تجهیزات موجود می باشد", txtName.Text), "خطا");
                    gvSelectedEquipment.Focus();
                    return(false);
                }
            }
            return(CheckStatuseOfAccessChangeDefault());
            //return true;
        }