Example #1
0
 private void tsbShare_Click(object sender, EventArgs e)
 {
     if (SelectedTransmormerCode != Guid.Empty)
     {
         if (Atend.Base.Equipment.EContainerPackage.ShareOnServer(Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer), SelectedTransmormerCode))
         {
             Atend.Base.Equipment.ETransformer Transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(SelectedTransmormerCode);
             Code = Transformer.Code;
             MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
         }
         else
         {
             MessageBox.Show("خطا در به اشتراک گذاری .");
         }
     }
     else
     {
         MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
     }
     //if (SelectedTransmormerCode != Guid.Empty)
     //{
     //    if (Atend.Base.Equipment.ETransformer.ShareOnServer(SelectedTransmormerCode))
     //    {
     //        Atend.Base.Equipment.ETransformer t1 = Atend.Base.Equipment.ETransformer.SelectByXCode(SelectedTransmormerCode);
     //        Code = t1.Code;
     //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
     //    }
     //    else
     //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
     //}
     //else
     //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
 }
Example #2
0
        private double CalculateCapasity()
        {
            double Cap = 0;//Convert.ToInt32(txtCapacity.Text);

            for (int i = 0; i < gvSelectedProduct.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvSelectedProduct.Rows[i].Cells[4].Value.ToString()) == (int)Atend.Control.Enum.ProductType.Transformer)
                {
                    Atend.Base.Equipment.ETransformer Trans = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(gvSelectedProduct.Rows[i].Cells[0].Value.ToString()));
                    Cap = Cap + Convert.ToInt32(gvSelectedProduct.Rows[i].Cells[2].Value.ToString()) * Trans.Capaciy;
                }
            }
            return(Cap);
        }
Example #3
0
 public void BindDataToOwnControl(Guid _Code)
 {
     Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(_Code);
     //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(reCloser.ProductCode);
     Atend.Control.Common.selectedProductCode = transformer.ProductCode;
     SelectProduct();
     SelectedTransmormerCode = _Code;
     txtName.Text            = transformer.Name;
     SelectedTransmormerCode = _Code;
     cboVoltage.Text         = transformer.Volt.ToString();
     cboType.SelectedValue   = transformer.TypeCode;
     txtCapacity.Text        = transformer.Capaciy.ToString();
     txtComment.Text         = transformer.Comment;
     tsbIsDefault.Checked    = transformer.IsDefault;
     //Code = transformer.Code;
     transformerCode = transformer.Code;
     BindTreeViwAndGrid();
 }
Example #4
0
        private bool CheckStatuseOfAccessChangeDefault()
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault);
            if (!Atend.Control.Common.AccessChangeDefault)
            {
                if (SelectedTransmormerCode == Guid.Empty && IsDefault)
                {
                    MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
                    return(false);
                }
                else
                {
                    Atend.Base.Equipment.ETransformer transform = Atend.Base.Equipment.ETransformer.SelectByXCode(SelectedTransmormerCode);
                    if (transform.IsDefault || IsDefault)
                    {
                        MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #5
0
        private void SetGrideTrans()
        {
            //Atend.Base.Design.DPackage PostPack = Atend.Base.Design.DPackage.SelectByNodeCode(Nodecode);
            DataTable PackTbl = Atend.Base.Design.DPackage.AccessSelectByParentCodeAndType(DPCode, (int)Atend.Control.Enum.ProductType.Transformer);// SelectByParentCodeAndType(DPCode, (int)Atend.Control.Enum.ProductType.Transformer);

            DataTable  TransSelected = new DataTable();
            DataColumn Col1          = new DataColumn("Code", typeof(int));
            DataColumn Col2          = new DataColumn("Name", typeof(string));

            TransSelected.Columns.Add(Col1);
            TransSelected.Columns.Add(Col2);

            foreach (DataRow Dr in PackTbl.Rows)
            {
                Atend.Base.Equipment.ETransformer Trans = Atend.Base.Equipment.ETransformer.SelectByCode(Convert.ToInt32(Dr["ProductCode"].ToString()));
                DataRow TRow = TransSelected.NewRow();
                TRow["Code"] = Trans.Code;
                TRow["Name"] = Trans.Name;
                TransSelected.Rows.Add(TRow);
            }

            gvTransSelected.AutoGenerateColumns = false;
            gvTransSelected.DataSource          = TransSelected;
        }
Example #6
0
        private void btnOk_Click_1(object sender, EventArgs e)
        {
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Clear();


            int projectcode = 0;
            int Existance   = 0;

            if (Validation())
            {
                dtSuEquip = (DataTable)gvSubEquip.DataSource;

                //ed.WriteMessage("btnOK Click\n");
                //ed.WriteMessage("IsSql={0}\n", gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value);
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true)
                {
                    //ed.WriteMessage("It Is Local Wquipment\n");
                    Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess   = false;
                    Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;
                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3];
                        //if (c.Value.ToString() == "موجود-موجود")
                        //{
                        //    Existance = 0;
                        //}
                        //if (c.Value.ToString() == "موجود-مستعمل")
                        //{
                        //    Existance = 1;
                        //}
                        //if (c.Value.ToString() == "موجود-اسقاط")
                        //{
                        //    Existance = 2;
                        //}
                        //if (c.Value.ToString() == "موجود-جابجایی")
                        //{
                        //    Existance = 3;
                        //}
                        //if (c.Value.ToString() == "پیشنهادی-نو")
                        //{
                        //    Existance = 4;
                        //}
                        //if (c.Value.ToString() == "پیشنهادی-جابجایی")
                        //{
                        //    Existance = 5;
                        //}
                        Existance = Convert.ToInt32(dr["IsExistance"].ToString());
                        //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                        projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());

                        //ed.WriteMessage("Type={0}\n", gvSubEquip.Rows[i].Cells[5].Value.ToString());
                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                        {
                            //ed.WriteMessage("JavkpanelMiddle.Code={0}\n", dr["XCode"].ToString());
                            Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode);
                            //ed.WriteMessage("FJavkpanelMiddle\n");
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            //ed.WriteMessage("JavkpanelWeek\n");

                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode);
                            //ed.WriteMessage("FJavkpanelMiddle\n");
                        }


                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            //ed.WriteMessage("Transformer\n");

                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode);
                            //ed.WriteMessage("FJavkpanelMiddle\n");
                        }
                    }
                }
                else
                {
                    //ed.WriteMessage("It Is Access Wquipment\n");

                    Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess   = true;
                    Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;
                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3];
                        //if (c.Value.ToString() == "موجود-موجود")
                        //{
                        //    Existance = 0;
                        //}
                        //if (c.Value.ToString() == "موجود-مستعمل")
                        //{
                        //    Existance = 1;
                        //}
                        //if (c.Value.ToString() == "موجود-اسقاط")
                        //{
                        //    Existance = 2;
                        //}
                        //if (c.Value.ToString() == "موجود-جابجایی")
                        //{
                        //    Existance = 3;
                        //}
                        //if (c.Value.ToString() == "پیشنهادی-نو")
                        //{
                        //    Existance = 4;
                        //}
                        //if (c.Value.ToString() == "پیشنهادی-جابجایی")
                        //{
                        //    Existance = 5;
                        //}
                        Existance = Convert.ToInt32(dr["IsExistance"].ToString());
                        //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                        projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                        {
                            Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode);
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            //Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString()));
                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode);
                        }


                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode);
                        }
                    }
                }

                Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString());
                if (cboProjCode.Items.Count != 0)
                {
                    Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString());
                }
                else
                {
                    Atend.Control.Common.ProjectCode = -1;
                }

                AllowToclose = true;
            }
            else
            {
                AllowToclose = false;
            }
            //ed.WriteMessage("Finish btnOK\n");
        }
Example #7
0
        //public void BindDataTocboInGrid()
        //{
        //    DataTable dt = Atend.Control.Common.StatuseCode.Copy();
        //    DataGridViewComboBoxColumn c = (DataGridViewComboBoxColumn)gvSubEquip.Columns["Column9"];
        //    c.DataSource = dt;
        //    c.DisplayMember = "Name";
        //    c.ValueMember = "Code";

        //    DataTable dt2 = Atend.Base.Base.BProjectCode.SelectAll();
        //    DataGridViewComboBoxColumn c2 = (DataGridViewComboBoxColumn)gvSubEquip.Columns["Column12"];
        //    c2.DataSource = dt2;
        //    c2.DisplayMember = "Name";
        //    c2.ValueMember = "Code";
        //}
        //private void chkIsExist_CheckedChanged(object sender, EventArgs e)
        //{
        //    if (chkIsExist.Checked)
        //    {
        //        cboIsExist.Items.Clear();
        //        cboIsExist.Items.Add("برکناری-مستعمل");
        //        cboIsExist.Items.Add("برکناری-اسقات");
        //    }
        //    else if (chkIsExist.CheckState == CheckState.Unchecked)
        //    {
        //        cboIsExist.Items.Clear();
        //        cboIsExist.Items.Add("نصب");
        //    }
        //    cboIsExist.SelectedIndex = 0;
        //    cboIsExist.Refresh();
        //}

        //In Use

        private void btnOk_Click(object sender, EventArgs e)
        {
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Clear();

            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Clear();

            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Clear();
            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Clear();


            int ProjectCode;
            int Existance = 0;

            if (Validation())
            {
                dtSuEquip = (DataTable)gvSubEquip.DataSource;
                //ed.WriteMessage("btnOK Click\n");
                //ed.WriteMessage("IsSql={0}\n", gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value);
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true)
                {
                    //ed.WriteMessage("It Is Local Wquipment\n");
                    Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess   = false;
                    Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;


                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                        Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                        if (dr["ProjectCode"].ToString() == "")
                        {
                            ProjectCode = 0;
                        }
                        else
                        {
                            ProjectCode = Convert.ToInt32(dr["ProjectCode"].ToString());
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                        {
                            Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(ProjectCode);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(ProjectCode);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                        }


                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(ProjectCode);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                        }
                    }
                }
                else
                {
                    //ed.WriteMessage("It Is Access Wquipment\n");

                    Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess   = true;
                    Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;

                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                        Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                        if (dr["ProjectCode"].ToString() == "")
                        {
                            ProjectCode = 0;
                        }
                        else
                        {
                            ProjectCode = Convert.ToInt32(dr["ProjectCode"].ToString());
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                        {
                            Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(ProjectCode);

                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                        }

                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(ProjectCode);

                            Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                        }


                        if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(ProjectCode);

                            Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                        }
                    }
                }

                Atend.Base.Base.BEquipStatus status02 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                Atend.Base.Acad.AcadGlobal.GroundPostData.Existance = status02.ACode;

                if (cboProjCode.Items.Count == 0)
                {
                    Atend.Base.Acad.AcadGlobal.GroundPostData.ProjectCode = 0;
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.GroundPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString());
                if (cboProjCode.Items.Count != 0)
                {
                    Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString());
                }
                else
                {
                    Atend.Control.Common.ProjectCode = -1;
                }
            }
            //ed.WriteMessage("Finish btnOK\n");
        }
Example #8
0
        //In Use
        private void gvDisconnector_Click(object sender, EventArgs e)
        {
            dtSuEquip.Rows.Clear();

            Atend.Base.Equipment.EGroundPost groundPost;
            DataTable dtExistance = Atend.Base.Base.BEquipStatus.SelectAllX();                                                        //Atend.Control.Common.StatuseCode;
            DataTable dtProjCode  = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString())); //Atend.Base.Base.BProjectCode.AccessSelectAll();

            if (gvDisconnector.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true)
                {
                    //ed.WriteMessage("## SQL\n");
                    groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    if (groundPost.Code != -1)
                    {
                        //ed.WriteMessage("Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count : {0}", Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count);
                        for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count; i++)
                        {
                            int count = Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeCountEPackageX[i].ToString());
                            for (int j = 0; j < count; j++)
                            {
                                DataRow dr = dtSuEquip.NewRow();
                                dr["XCode"] = Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i];
                                string name = "";
                                //ed.WriteMessage("~~~~~~~~ TYPE:{0}", Atend.Base.Equipment.EGroundPost.nodeTypeEPackageX[i].ToString());
                                switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EGroundPost.nodeTypeEPackageX[i].ToString())))
                                {
                                case Atend.Control.Enum.ProductType.Transformer:
                                    //     {
                                    Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                    name              = transformer.Name;
                                    dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                    dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                    if (cboProjCode.Items.Count > 0)
                                    {
                                        dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                    }
                                    else
                                    {
                                        dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                    }
                                    dr["Name"]  = name;
                                    dr["IsSql"] = true;
                                    dtSuEquip.Rows.Add(dr);

                                    break;

                                //       }
                                case Atend.Control.Enum.ProductType.WeekJackPanel:
                                    //   {
                                    Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                    name              = jackPanelweek.Name;
                                    dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                    dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                    if (cboProjCode.Items.Count > 0)
                                    {
                                        dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                    }
                                    else
                                    {
                                        dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                    }
                                    dr["Name"]  = name;
                                    dr["IsSql"] = true;
                                    dtSuEquip.Rows.Add(dr);

                                    break;

                                // }
                                case Atend.Control.Enum.ProductType.MiddleJackPanel:
                                    //{
                                    Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                    name              = jackPanel.Name;
                                    dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                    dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                    if (cboProjCode.Items.Count > 0)
                                    {
                                        dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                    }
                                    else
                                    {
                                        dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                    }
                                    dr["Name"]  = name;
                                    dr["IsSql"] = true;
                                    dtSuEquip.Rows.Add(dr);

                                    break;

                                    //}
                                }

                                //dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                //if (cboProjCode.Items.Count > 0)
                                //{
                                //    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                //}
                                //else
                                //{
                                //    dr["ProjectCode"] = 0;
                                //}
                                //dr["Name"] = name;
                                //dr["IsSql"] = true;
                                //dtSuEquip.Rows.Add(dr);
                            }
                        }
                    }
                }
                else
                {
                    //ed.WriteMessage("## Access\n");
                    groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackage.Count; i++)
                    {
                        //ed.WriteMessage("##1\n");
                        int count = Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeCountEPackage[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            DataRow dr = dtSuEquip.NewRow();
                            dr["Code"] = Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EGroundPost.nodeTypeEPackage[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                //ed.WriteMessage("##Transformer\n");
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name              = transformer.Name;
                                dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                }
                                dr["Name"]  = name;
                                dr["IsSql"] = false;
                                dtSuEquip.Rows.Add(dr);
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                //ed.WriteMessage("##WeekJackPanel\n");
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name              = jackPanelweek.Name;
                                dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                }
                                dr["Name"]  = name;
                                dr["IsSql"] = false;
                                dtSuEquip.Rows.Add(dr);
                                break;
                            }

                            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                            {
                                //ed.WriteMessage("##MiddleJackPanel\n");
                                Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name              = jackPanel.Name;
                                dr["Type"]        = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                                }
                                dr["Name"]  = name;
                                dr["IsSql"] = false;
                                dtSuEquip.Rows.Add(dr);
                                break;
                            }
                            }
                        }
                    }
                }


                txtName.Text = groundPost.Name;
                if (groundPost.GroundType == 0)
                {
                    txtGroundType.Text = "روزمینی";
                }
                else
                {
                    txtGroundType.Text = "زیرزمینی";
                }
                //**
                if (groundPost.Type == 0)
                {
                    txtType.Text = "عمومی";
                }
                if (groundPost.Type == 1)
                {
                    txtType.Text = "اختصاصی";
                }
                if (groundPost.Type == 2)
                {
                    txtType.Text = "پاساژ";
                }
                //**

                if (groundPost.AdvanceType == 0)
                {
                    txtAdvanceType.Text = "معمولی";
                }
                if (groundPost.AdvanceType == 1)
                {
                    txtAdvanceType.Text = "کامپکت";
                }

                if (groundPost.AdvanceType == 2)
                {
                    txtAdvanceType.Text = "کیوسک";
                }


                txtSelectedCapacity.Text = groundPost.Capacity.ToString();
            }
        }
Example #9
0
        private void gvDisconnector_Click_1(object sender, EventArgs e)
        {
            bool Valid = false;

            dtSuEquip.Rows.Clear();
            Atend.Base.Equipment.EGroundPost groundPost;
            System.Data.DataTable            dtExistance = Atend.Base.Base.BEquipStatus.SelectAllX();
            System.Data.DataTable            dtProjCode  = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString()));

            if (gvDisconnector.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true)
                {
                    groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX.Count; i++)
                    {
                        int count = Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeCountEPackageX[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            Valid = false;
                            DataRow dr = dtSuEquip.NewRow();

                            dr["XCode"] = Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EGroundPost.nodeTypeEPackageX[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                            {
                                Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(Atend.Base.Equipment.EGroundPost.nodeKeysEPackageX[i].ToString()));
                                name       = jackPanel.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                Valid      = true;
                                break;
                            }
                            }

                            if (Valid == true)
                            {
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = 0;
                                }
                                //dr["IsExistance"] = Convert.ToInt32(dtExistance.Rows[0]["Code"].ToString());
                                //dr["ProjectCode"] = Convert.ToInt32(dtProjCode.Rows[0]["Code"].ToString());
                                dr["Name"]  = name;
                                dr["IsSql"] = true;
                                dtSuEquip.Rows.Add(dr);
                            }
                        }
                    }
                }
                else
                {
                    groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EGroundPost.nodeKeysEPackage.Count; i++)
                    {
                        int count = Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeCountEPackage[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            Valid = false;
                            DataRow dr = dtSuEquip.NewRow();
                            dr["Code"] = Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EGroundPost.nodeTypeEPackage[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                            {
                                Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EGroundPost.nodeKeysEPackage[i].ToString()));
                                name       = jackPanel.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                Valid      = true;
                                break;
                            }
                            }
                            if (Valid)
                            {
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = 0;
                                }
                                //dr["IsExistance"] = Convert.ToInt32(dtExistance.Rows[0]["Code"].ToString());
                                //dr["ProjectCode"] = Convert.ToInt32(dtProjCode.Rows[0]["Code"].ToString());
                                dr["Name"]  = name;
                                dr["IsSql"] = false;
                                dtSuEquip.Rows.Add(dr);
                            }
                        }
                    }
                }


                txtName.Text = groundPost.Name;
                if (groundPost.GroundType == 0)
                {
                    txtGroundType.Text = "روزمینی";
                }
                else
                {
                    txtGroundType.Text = "زیرزمینی";
                }
                //**
                if (groundPost.Type == 0)
                {
                    txtType.Text = "عمومی";
                }
                if (groundPost.Type == 1)
                {
                    txtType.Text = "اختصاصی";
                }
                if (groundPost.Type == 2)
                {
                    txtType.Text = "پاساژ";
                }
                //**

                if (groundPost.AdvanceType == 0)
                {
                    txtAdvanceType.Text = "معمولی";
                }
                if (groundPost.AdvanceType == 1)
                {
                    txtAdvanceType.Text = "کامپکت";
                }

                if (groundPost.AdvanceType == 2)
                {
                    txtAdvanceType.Text = "کیوسک";
                }


                txtSelectedCapacity.Text = groundPost.Capacity.ToString();

                //if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == false)
                //{
                //    dtSuEquip = dtCurrent.Copy();
                //    gvSubEquip.AutoGenerateColumns = false;
                //    gvSubEquip.DataSource = dtSuEquip;
                //    return;
                //}
            }
        }
Example #10
0
        private void frmEditDrawGroundPost01_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            dtMerge = Atend.Base.Equipment.EGroundPost.SelectAllAndMerge();
            Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            selectedProductCode = dPack.ProductCode;

            gvDisconnector.AutoGenerateColumns = false;
            gvDisconnector.DataSource          = dtMerge;

            Atend.Global.Utility.UBinding.SetGridToCurrentSelectedEquip("Code,XCode", new object[2] {
                selectedProductCode, "00000000-0000-0000-0000-000000000000"
            }, dtMerge, gvDisconnector, this);
            ChangeColor();
            for (int i = 0; i < gvDisconnector.Rows.Count; i++)
            {
                if (Convert.ToInt32(gvDisconnector.Rows[i].Cells[0].Value.ToString()) == selectedProductCode && Convert.ToBoolean(gvDisconnector.Rows[i].Cells[2].Value.ToString()) == false)
                {
                    gvDisconnector.Rows[i].DefaultCellStyle.BackColor = Color.Yellow;
                }
            }

            System.Data.DataColumn dtCode = new System.Data.DataColumn("Code");
            dtSuEquip.Columns.Add(dtCode);
            System.Data.DataColumn dtXCode = new System.Data.DataColumn("XCode");
            dtSuEquip.Columns.Add(dtXCode);
            System.Data.DataColumn dtName = new System.Data.DataColumn("Name");
            dtSuEquip.Columns.Add(dtName);
            System.Data.DataColumn dtIsSql = new System.Data.DataColumn("IsSql");
            dtSuEquip.Columns.Add(dtIsSql);
            System.Data.DataColumn dtType = new System.Data.DataColumn("Type");
            dtSuEquip.Columns.Add(dtType);
            System.Data.DataColumn dcIsExistance = new System.Data.DataColumn("IsExistance", System.Type.GetType("System.Int32"));
            dtSuEquip.Columns.Add(dcIsExistance);
            System.Data.DataColumn dcProjectCode = new System.Data.DataColumn("ProjectCode", System.Type.GetType("System.Int32"));
            dtSuEquip.Columns.Add(dcProjectCode);


            //Atend.Base.Design.DNode node = Atend.Base.Design.DNode.AccessSelectByCode(NodeCode);
            //txtHeight.Text = Convert.ToString(Math.Round(node.Height, 2));

            dtCurrent = Atend.Base.Design.DPackage.AccessSelectByParentCode(dPack.Code);

            foreach (DataRow Dr in dtCurrent.Rows)
            {
                DataRow SubEqRow = dtSuEquip.NewRow();
                SubEqRow["Code"]        = Dr["ProductCode"];
                SubEqRow["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByACode(Convert.ToInt32(Dr["IsExistance"])).Code;

                SubEqRow["ProjectCode"] = Dr["ProjectCode"];
                //SubEqRow["IsSql"] = Dr["IsSql"];
                SubEqRow["Type"] = Dr["Type"];

                if (Convert.ToInt32(Dr["Type"].ToString()) == (int)(Atend.Control.Enum.ProductType.MiddleJackPanel))
                {
                    Atend.Base.Equipment.EJAckPanel JP = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(Dr["ProductCode"].ToString()));
                    SubEqRow["Name"]  = JP.Name;
                    SubEqRow["XCode"] = JP.XCode;
                }

                if (Convert.ToInt32(Dr["Type"].ToString()) == (int)(Atend.Control.Enum.ProductType.WeekJackPanel))
                {
                    Atend.Base.Equipment.EJackPanelWeek JPW = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(Dr["ProductCode"].ToString()));
                    SubEqRow["Name"]  = JPW.Name;
                    SubEqRow["XCode"] = JPW.XCode;
                }

                if (Convert.ToInt32(Dr["Type"].ToString()) == (int)(Atend.Control.Enum.ProductType.Transformer))
                {
                    Atend.Base.Equipment.ETransformer Trns = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(Dr["ProductCode"].ToString()));
                    SubEqRow["Name"]  = Trns.Name;
                    SubEqRow["XCode"] = Trns.XCode;
                }

                dtSuEquip.Rows.Add(SubEqRow);
            }

            dtCurrent = dtSuEquip.Copy();

            BindDataToIsExist();
            //BindDataTocboProjCode();

            BindDataToCboInGridView();
            AddProjectCodeColumn();

            gvSubEquip.AutoGenerateColumns = false;
            gvSubEquip.DataSource          = dtSuEquip;
            Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);
            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dpack.IsExistance).Code;
            cboProjCode.SelectedValue = dpack.ProjectCode;


            //Atend.Calculating.frmTest _frmTest = new Atend.Calculating.frmTest();
            //_frmTest.dataGridView4.DataSource = dtSuEquip;
            //_frmTest.ShowDialog();
        }
Example #11
0
        private void gvDisconnector_Click(object sender, EventArgs e)
        {
            bool      Valid = false;
            DataTable dt    = Atend.Base.Base.BEquipStatus.SelectAllX();                                                        //Atend.Control.Common.StatuseCode.Copy();
            DataTable dt2   = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString())); //Atend.Base.Base.BProjectCode.AccessSelectAll();

            dtsub.Clear();
            Atend.Base.Equipment.EAirPost AirPost;
            if (gvDisconnector.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true)
                {
                    AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EAirPost.nodeKeysEPackageX.Count; i++)
                    {
                        Valid = false;
                        int count = Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeCountEPackageX[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            DataRow dr = dtsub.NewRow();
                            dr["XCode"] = Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EAirPost.nodeTypeEPackageX[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }
                            }
                            if (Valid == true)
                            {
                                dr["Name"]        = name;
                                dr["IsSql"]       = true;
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    //MessageBox.Show(cboProjCode.SelectedValue.ToString());
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    //dr["ProjectCode"] = 0;
                                    dr["ProjectCode"] = dtBWorkOrders.Rows[0]["ACode"];
                                }
                                dtsub.Rows.Add(dr);
                            }
                        }
                    }
                }
                else
                {
                    AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EAirPost.nodeKeysEPackage.Count; i++)
                    {
                        int count = Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeCountEPackage[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            Valid = false;
                            DataRow dr = dtsub.NewRow();
                            dr["Code"] = Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EAirPost.nodeTypeEPackage[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }
                            }
                            if (Valid == true)
                            {
                                dr["Name"]        = name;
                                dr["IsSql"]       = false;
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    //MessageBox.Show(cboProjCode.SelectedValue.ToString());
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    //dr["ProjectCode"] = 0;
                                    dr["ProjectCode"] = dtBWorkOrders.Rows[0]["ACode"].ToString();
                                }
                                dtsub.Rows.Add(dr);
                            }
                        }
                    }
                }
                txtName.Text             = AirPost.Name;
                txtSelectedCapacity.Text = AirPost.Capacity.ToString();
            }
            gvSubEquip.Refresh();
        }
Example #12
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            txtCapacity.Focus();
            int projectcode = 0;
            int Existance   = 0;

            if (Validation())
            {
                List <Atend.Base.Equipment.EJackPanelWeek> JackPanelWeeks = new List <Atend.Base.Equipment.EJackPanelWeek>();
                List <Atend.Base.Equipment.ETransformer>   Transformers   = new List <Atend.Base.Equipment.ETransformer>();
                ArrayList JackPanelWeekExistance   = new ArrayList();
                ArrayList TransformerExistance     = new ArrayList();
                ArrayList JackPanelWeekProjectCode = new ArrayList();
                ArrayList TransformerProjectCode   = new ArrayList();


                //Atend.Global.Acad.DrawEquips.AcDrawAirPost AirPost = new Atend.Global.Acad.DrawEquips.AcDrawAirPost();
                dtSuEquip = (System.Data.DataTable)gvSubEquip.DataSource;

                //##
                //##

                Atend.Base.Base.BEquipStatus statusAir = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                AirPost.Existance = statusAir.ACode; //Convert.ToInt32(cboIsExist.SelectedValue);

                if (cboProjCode.Items.Count == 0)
                {
                    AirPost.ProjectCode = 0;
                }
                else
                {
                    AirPost.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                AirPost.SelectedObjectId = ObjID;
                Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);


                //AllowToclose = true;
                //if (AirPost.UpdateAirPostData(dpack.Code))
                //{
                //    AllowToclose = true;
                //    this.Close();
                //}
                //else
                //{
                //    AllowToclose = false;
                //}
                if (Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()) != selecetdProductCode)
                {
                    if (MessageBox.Show("آیا مایل به حذف پست موجود و \nجایگزین کردن پست جدید می باشید", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        //Draw&Save
                        if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true)
                        {
                            Atend.Base.Equipment.EAirPost airPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                            AirPost.UseAccess = false;
                            AirPost.eAirPost  = airPost;

                            foreach (DataRow dr in dtSuEquip.Rows)
                            {
                                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                                {
                                    Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    JackPanelWeekExistance.Add(Existance);
                                    JackPanelWeeks.Add(jackPanelWeek);
                                    JackPanelWeekProjectCode.Add(projectcode);
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                                {
                                    Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    TransformerExistance.Add(Existance);
                                    Transformers.Add(transformer);
                                    TransformerProjectCode.Add(projectcode);
                                }
                            }
                        }
                        else
                        {
                            Atend.Base.Equipment.EAirPost airPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                            AirPost.UseAccess = true;
                            AirPost.eAirPost  = airPost;

                            foreach (DataRow dr in dtSuEquip.Rows)
                            {
                                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                                {
                                    Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    JackPanelWeekExistance.Add(Existance);
                                    JackPanelWeeks.Add(jackPanelWeek);
                                    JackPanelWeekProjectCode.Add(projectcode);
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                                {
                                    Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    TransformerExistance.Add(Existance);
                                    Transformers.Add(transformer);
                                    TransformerProjectCode.Add(projectcode.ToString());
                                }
                            }
                        }

                        AirPost.eJackPanelWeeks           = JackPanelWeeks;
                        AirPost.eJackPanelWeekExistance   = JackPanelWeekExistance;
                        AirPost.eJackPanelWeekProjectCode = JackPanelWeekProjectCode;
                        AirPost.eTransformers             = Transformers;
                        AirPost.eTransformerExistance     = TransformerExistance;
                        AirPost.eTransformerProjectCode   = TransformerProjectCode;

                        if (AirPost.UpdateAirPostData(dpack.Code))
                        {
                            AirPost.DrawAirPost();
                            AllowToclose = true;
                            this.Close();
                        }
                        else
                        {
                            AllowToclose = false;
                        }
                    }
                    else
                    {
                        AllowToclose = false;
                    }
                }
                else
                {
                    //SaveWithoutDrawAllowToclose = false
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["Isexistance"].ToString())).ACode;
                    }
                    if (!AirPost.UpdateAirPostWithoutDraw(dpack.Code, dtSuEquip))
                    {
                        Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                        notification.Title = "خطا";
                        notification.Msg   = "خطا در ویرایش پست هوایی";
                        notification.ShowStatusBarBalloon();
                        AllowToclose = false;
                    }
                    else
                    {
                        AllowToclose = true;
                    }
                }
            }
            else
            {
                AllowToclose = false;
            }
            //OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
            //Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Clear();
            //Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Clear();
            //Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Clear();
            //Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Clear();
            //int projectcode = 0;
            //int Existance = 0;
            //if (Validation())
            //{
            //    dtsub = (System.Data.DataTable)gvSubEquip.DataSource;
            //    if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true)
            //    {
            //        ed.WriteMessage("It Is Local Wquipment\n");
            //        Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
            //        Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false;
            //        Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost;
            //        Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
            //        Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);

            //        txtName.Text = AirPost.Name;
            //        txtCapacity.Text = AirPost.Capacity.ToString();
            //        foreach (DataRow dr1 in dtsub.Rows)
            //        {
            //            Existance = Convert.ToInt32(dr1["IsExistance"].ToString());
            //            projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString());
            //            if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
            //            {
            //                Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr1["XCode"].ToString()));
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
            //            }


            //            if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
            //            {
            //                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr1["XCode"].ToString()));
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
            //            }
            //        }

            //    }
            //    else
            //    {
            //        ed.WriteMessage("It Is Access Wquipment\n");
            //        Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
            //        Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true;
            //        Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost;
            //        Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
            //        Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
            //        txtName.Text = AirPost.Name;
            //        txtCapacity.Text = AirPost.Capacity.ToString();
            //        foreach (DataRow dr1 in dtsub.Rows)
            //        {
            //            Existance = Convert.ToInt32(dr1["IsExistance"].ToString());
            //            projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString());
            //            if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
            //            {
            //                Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr1["Code"]));
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
            //            }


            //            if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
            //            {
            //                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr1["Code"]));
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
            //                Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
            //            }
            //        }
            //    }
            //    AllowToclose = true;
            //}
            //else
            //{
            //    AllowToclose = false;
            //}
        }
Example #13
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);
        }
Example #14
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.ETransformer transformer = new Atend.Base.Equipment.ETransformer();
            transformer.Volt        = Convert.ToDouble(cboVoltage.Text);
            transformer.ProductCode = Atend.Control.Common.selectedProductCode;
            transformer.TypeCode    = Convert.ToByte(cboType.SelectedValue);
            transformer.Comment     = txtComment.Text;
            transformer.Name        = txtName.Text;
            transformer.Capaciy     = Convert.ToDouble(txtCapacity.Text);
            transformer.IsDefault   = IsDefault;
            transformer.Code        = transformerCode;

            //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);
            }
            transformer.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);
            }
            transformer.OperationList = EOperation;
            if (SelectedTransmormerCode == Guid.Empty)
            {
                if (transformer.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                transformer.Code  = transformerCode;
                transformer.XCode = SelectedTransmormerCode;
                if (transformer.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }
Example #15
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.ETransformer.SearchByName(txtName.Text) == true && SelectedTransmormerCode == Guid.Empty)
            {
                MessageBox.Show("نام قبلا استفاده شده است", "خطا");
                txtName.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(cboVoltage.Text))
            {
                MessageBox.Show("لطفا ولتاژ را مشخص نمایید", "خطا");
                cboVoltage.Focus();
                //txtVolt.Select(0, txtVolt.Text.Length);
                return(false);
            }
            //if (!Atend.Control.NumericValidation.DoubleConverter(cboVoltage.Text))
            //{
            //    MessageBox.Show("لطفاً ولتاژ را با فرمت مناسب وارد نمایید","خطا");
            //    cboVoltage.Focus();
            //    //txtVolt.Select(0, txtVolt.Text.Length);
            //    return false;
            //}

            if (string.IsNullOrEmpty(txtCapacity.Text))
            {
                MessageBox.Show("لطفا ظرفیت را مشخص نمایید", "خطا");
                txtCapacity.Focus();
                txtCapacity.Select(0, txtCapacity.Text.Length);
                return(false);
            }
            if (!Atend.Control.NumericValidation.DoubleConverter(txtCapacity.Text))
            {
                MessageBox.Show("لطفاً ظرفیت را با فرمت مناسب وارد نمایید", "خطا");
                txtCapacity.Focus();
                txtCapacity.Select(0, txtCapacity.Text.Length);
                return(false);
            }

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

            return(CheckStatuseOfAccessChangeDefault());

            //return true;
        }
Example #16
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            btnCancel.Focus();
            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Clear();
            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Clear();
            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Clear();
            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Clear();
            int projectcode = 0;
            int Existance   = 0;

            if (Validation())
            {
                dtsub = (System.Data.DataTable)gvSubEquip.DataSource;
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true)
                {
                    Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false;
                    Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost  = AirPost;


                    txtName.Text     = AirPost.Name;
                    txtCapacity.Text = AirPost.Capacity.ToString();
                    foreach (DataRow dr1 in dtsub.Rows)
                    {
                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr1["IsExistance"].ToString()));
                        Existance = status.ACode; //Convert.ToInt32(dr1["IsExistance"].ToString());

                        if (dr1["ProjectCode"].ToString() == "")
                        {
                            projectcode = 0;
                        }
                        else
                        {
                            projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString());
                        }

                        if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr1["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                        }


                        if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr1["XCode"].ToString()));
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerProjectCode.Add(projectcode);
                        }
                    }

                    //////////////////////
                    //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = false;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
                    //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);

                    //txtName.Text = AirPost.Name;
                    //txtCapacity.Text = AirPost.Capacity.ToString();
                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    //{

                    //    //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3];
                    //    //if (c.Value.ToString() == "موجود-موجود")
                    //    //{
                    //    //    Existance = 0;
                    //    //}
                    //    //if (c.Value.ToString() == "موجود-مستعمل")
                    //    //{
                    //    //    Existance = 1;
                    //    //}
                    //    //if (c.Value.ToString() == "موجود-اسقاط")
                    //    //{
                    //    //    Existance = 2;
                    //    //}
                    //    //if (c.Value.ToString() == "موجود-جابجایی")
                    //    //{
                    //    //    Existance = 3;
                    //    //}
                    //    //if (c.Value.ToString() == "پیشنهادی-نو")
                    //    //{
                    //    //    Existance = 4;
                    //    //}
                    //    //if (c.Value.ToString() == "پیشنهادی-جابجایی")
                    //    //{
                    //    //    Existance = 5;
                    //    //}
                    //    //ed.WriteMessage("Type={0}\n", gvSubEquip.Rows[i].Cells[5].Value.ToString());

                    //    //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                    //    //projectcode = Convert.ToInt32(cPCode.Value);

                    //    if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                    //    {

                    //        Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString()));
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                    //    }


                    //    if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                    //    {

                    //        Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString()));
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                    //    }

                    //}
                }
                else
                {
                    ed.WriteMessage("It Is Access Wquipment\n");
                    Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true;
                    Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost  = AirPost;

                    txtName.Text     = AirPost.Name;
                    txtCapacity.Text = AirPost.Capacity.ToString();
                    foreach (DataRow dr1 in dtsub.Rows)
                    {
                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr1["IsExistance"].ToString()));
                        Existance = status.ACode; //Convert.ToInt32(dr1["IsExistance"].ToString());

                        if (dr1["ProjectCode"].ToString() == "")
                        {
                            projectcode = 0;
                        }
                        else
                        {
                            projectcode = Convert.ToInt32(dr1["ProjectCode"].ToString());
                        }

                        if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                        {
                            Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr1["Code"]));
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                        }


                        if (Convert.ToInt32(dr1["Type"]) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                        {
                            Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr1["Code"]));
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
                            Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerProjectCode.Add(projectcode);
                        }
                    }

                    ///////////////////////
                    //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
                    //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                    //txtName.Text = AirPost.Name;
                    //txtCapacity.Text = AirPost.Capacity.ToString();
                    //Atend.Base.Equipment.EAirPost AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    //Atend.Base.Acad.AcadGlobal.AirPostData.UseAccess = true;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.eAirPost = AirPost;
                    //Atend.Base.Acad.AcadGlobal.AirPostData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
                    //Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                    //txtName.Text = AirPost.Name;
                    //txtCapacity.Text = AirPost.Capacity.ToString();
                    //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                    //{

                    //    DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[3];
                    //    if (c.Value.ToString() == "موجود-موجود")
                    //    {
                    //        Existance = 0;
                    //    }
                    //    if (c.Value.ToString() == "موجود-مستعمل")
                    //    {
                    //        Existance = 1;
                    //    }
                    //    if (c.Value.ToString() == "موجود-اسقاط")
                    //    {
                    //        Existance = 2;
                    //    }
                    //    if (c.Value.ToString() == "موجود-جابجایی")
                    //    {
                    //        Existance = 3;
                    //    }
                    //    if (c.Value.ToString() == "پیشنهادی-نو")
                    //    {
                    //        Existance = 4;
                    //    }
                    //    if (c.Value.ToString() == "پیشنهادی-جابجایی")
                    //    {
                    //        Existance = 5;
                    //    }

                    //    DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                    //    projectcode = Convert.ToInt32(cPCode.Value);

                    //    if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                    //    {

                    //        //Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString()));
                    //        Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(gvSubEquip.Rows[i].Cells[0].Value.ToString()));
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekExistance.Add(Existance);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeeks.Add(jackPanelWeek);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                    //    }


                    //    if (Convert.ToInt32(gvSubEquip.Rows[i].Cells[5].Value) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                    //    {
                    //        ed.WriteMessage("@Code{0}\n", gvSubEquip.Rows[i].Cells[0].Value);
                    //        ed.WriteMessage("@XCode{0}\n", gvSubEquip.Rows[i].Cells[1].Value);
                    //        Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(gvSubEquip.Rows[i].Cells[0].Value.ToString()));
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eTransformerExistance.Add(Existance);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eTransformers.Add(transformer);
                    //        Atend.Base.Acad.AcadGlobal.AirPostData.eJackPanelWeekProjectCode.Add(projectcode);
                    //    }

                    //}
                }

                Atend.Base.Base.BEquipStatus status02 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                Atend.Base.Acad.AcadGlobal.AirPostData.Existance = status02.ACode;

                if (cboProjCode.Items.Count == 0)
                {
                    Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = 0;
                }
                else
                {
                    Atend.Base.Acad.AcadGlobal.AirPostData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                Atend.Control.Common.IsExist = Convert.ToInt32(cboIsExist.SelectedValue.ToString());
                if (cboProjCode.Items.Count != 0)
                {
                    Atend.Control.Common.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue.ToString());
                }
                else
                {
                    Atend.Control.Common.ProjectCode = -1;
                }

                AllowToclose = true;
            }
            else
            {
                AllowToclose = false;
            }
            ed.WriteMessage("Finish btnOK\n");
        }
Example #17
0
        private void gvDisconnector_Click(object sender, EventArgs e)
        {
            bool Valid = false;

            System.Data.DataTable dt  = Atend.Base.Base.BEquipStatus.SelectAllX();
            System.Data.DataTable dt2 = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString()));
            dtSuEquip.Clear();
            Atend.Base.Equipment.EAirPost AirPost;
            if (gvDisconnector.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == true)
                {
                    AirPost = Atend.Base.Equipment.EAirPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EAirPost.nodeKeysEPackageX.Count; i++)
                    {
                        int count = Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeCountEPackageX[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            Valid = false;
                            DataRow dr = dtSuEquip.NewRow();
                            dr["XCode"] = Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EAirPost.nodeTypeEPackageX[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                            {
                                Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(Atend.Base.Equipment.EAirPost.nodeKeysEPackageX[i].ToString()));
                                name       = jackPanel.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                Valid      = true;
                                break;
                            }
                            }
                            if (Valid == true)
                            {
                                dr["Name"]        = name;
                                dr["IsSql"]       = true;
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = 0;
                                }
                                //dr["IsExistance"] = Convert.ToByte(dt.Rows[0]["Code"]);
                                //dr["ProjectCode"] = Convert.ToInt32(dt2.Rows[0]["Code"]);
                                dtSuEquip.Rows.Add(dr);
                            }
                        }
                    }
                }
                else
                {
                    AirPost = Atend.Base.Equipment.EAirPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                    for (int i = 0; i < Atend.Base.Equipment.EAirPost.nodeKeysEPackage.Count; i++)
                    {
                        int count = Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeCountEPackage[i].ToString());
                        for (int j = 0; j < count; j++)
                        {
                            Valid = false;
                            DataRow dr = dtSuEquip.NewRow();
                            dr["Code"] = Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i];
                            string name = "";
                            switch ((Atend.Control.Enum.ProductType)(int.Parse(Atend.Base.Equipment.EAirPost.nodeTypeEPackage[i].ToString())))
                            {
                            case Atend.Control.Enum.ProductType.Transformer:
                            {
                                Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i].ToString()));
                                name       = transformer.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.WeekJackPanel:
                            {
                                Atend.Base.Equipment.EJackPanelWeek jackPanelweek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i].ToString()));
                                name       = jackPanelweek.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel);
                                Valid      = true;
                                break;
                            }

                            case Atend.Control.Enum.ProductType.MiddleJackPanel:
                            {
                                Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EAirPost.nodeKeysEPackage[i].ToString()));
                                name       = jackPanel.Name;
                                dr["Type"] = Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel);
                                Valid      = true;
                                break;
                            }
                            }
                            if (Valid == true)
                            {
                                dr["Name"]        = name;
                                dr["IsSql"]       = false;
                                dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                                if (cboProjCode.Items.Count > 0)
                                {
                                    dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                                }
                                else
                                {
                                    dr["ProjectCode"] = 0;
                                }
                                //dr["IsExistance"] = Convert.ToByte(dt.Rows[0]["Code"]);
                                //dr["ProjectCode"] = Convert.ToInt32(dt2.Rows[0]["Code"]);
                                dtSuEquip.Rows.Add(dr);
                            }
                        }
                    }
                }
                txtName.Text             = AirPost.Name;
                txtSelectedCapacity.Text = AirPost.Capacity.ToString();

                //if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[4].Value) == false)
                //{
                //    dtSuEquip = dtCurrent.Copy();
                //    gvSubEquip.AutoGenerateColumns = false;
                //    gvSubEquip.DataSource = dtSuEquip;
                //    return;
                //}
            }

            gvSubEquip.Refresh();

            //Atend.Calculating.frmTest a = new Atend.Calculating.frmTest();
            //a.dataGridView4.DataSource = dtSuEquip;
            //a.ShowDialog();
        }
Example #18
0
        private void gvConsolsTip_Click(object sender, EventArgs e)
        {
            //tvConsolSubEquipment.Nodes.Clear();

            //int Type = (int)Atend.Control.Enum.ProductType.Consol;
            //int ContainerCode = Convert.ToInt32(gvConsolsTip.SelectedRows[0].Cells[0].Value);

            //ed.WriteMessage("Row Code is : " + ContainerCode + "\n");
            //Atend.Base.Equipment.EContainerPackage ContainerPackage = Atend.Base.Equipment.EContainerPackage.selectByContainerCodeAndType(ContainerCode, Type);
            //ed.WriteMessage("Row Code in EContainerPackage is : " + ContainerPackage.Code + "\n");


            //DataTable ProductPackageTable = Atend.Base.Equipment.EProductPackage.SelectByContainerPackageCode(ContainerPackage.Code);
            //ed.WriteMessage(string.Format("RowCount in productPackage : {0} \n", ProductPackageTable.Rows.Count));

            //foreach (DataRow row in ProductPackageTable.Rows)
            //{

            //    #region find each row TableType
            //    byte TableType = Convert.ToByte(row["TableType"]);
            //    #endregion
            //    ed.WriteMessage(string.Format("TableType : {0} \n", TableType));

            //    #region search in XML for Table of TableType value
            //    string Table = DetermineTableValue(TableType);
            //    #endregion

            //    ed.WriteMessage(string.Format("Table : {0} \n", Table));

            //    if (Table == "Self")
            //    {
            //        switch ((Atend.Control.Enum.ProductType)TableType)
            //        {
            //            case Atend.Control.Enum.ProductType.Insulator:

            //                ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
            //                Atend.Base.Equipment.EInsulator insulator = Atend.Base.Equipment.EInsulator.SelectByCode(Convert.ToInt32(row["ProductCode"]));
            //                tvConsolSubEquipment.Nodes.Add(insulator.Name);

            //                break;
            //            case Atend.Control.Enum.ProductType.InsulatorChain:

            //                break;
            //            case Atend.Control.Enum.ProductType.InsulatorPipe:
            //                break;
            //        }
            //    }
            //    else
            //    {
            //        ed.WriteMessage("second productCode : " + Convert.ToInt32(row["ProductCode"]).ToString());
            //        Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(Convert.ToInt32(row["ProductCode"]));
            //        tvConsolSubEquipment.Nodes.Add(product.Name);
            //    }
            //}

            /////////////////////////////////////////////////////////////////////

            if (gvConsolsTip.Rows.Count > 0)
            {
                tvConsolSubEquipment.Nodes.Clear();

                int Type          = (int)Atend.Control.Enum.ProductType.Consol;
                int ContainerCode = Convert.ToInt32(gvConsolsTip.SelectedRows[0].Cells[0].Value);

                //ed.WriteMessage("Row Code is : " + ContainerCode + "\n");
                //Atend.Base.Equipment.EContainerPackage ContainerPackage = Atend.Base.Equipment.EContainerPackage.selectByContainerCodeAndType(ContainerCode, Type);
                //ed.WriteMessage("Row Code in EContainerPackage is : " + ContainerPackage.Code + "\n");


                DataTable ProductPackageTable = Atend.Base.Equipment.EProductPackage.SelectByContainerCodeAndType(ContainerCode, Type);
                //ed.WriteMessage(string.Format("RowCount in productPackage : {0} \n", ProductPackageTable.Rows.Count));

                foreach (DataRow row in ProductPackageTable.Rows)
                {
                    #region find each row TableType
                    byte TableType = Convert.ToByte(row["TableType"]);
                    #endregion
                    //ed.WriteMessage(string.Format("TableType : {0} \n", TableType));

                    #region search in XML for Table of TableType value
                    string Table = DetermineTableValue(TableType);
                    #endregion

                    //ed.WriteMessage(string.Format("Table : {0} \n", Table));

                    if (Table == "Self")
                    {
                        switch ((Atend.Control.Enum.ProductType)TableType)
                        {
                        case Atend.Control.Enum.ProductType.Insulator:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EInsulator insulator = Atend.Base.Equipment.EInsulator.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(insulator.Name);

                            break;

                        case Atend.Control.Enum.ProductType.AirPost:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EAirPost airPost = Atend.Base.Equipment.EAirPost.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(airPost.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.AuoKey3p:

                        //    //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EAutoKey_3p autokey3p = Atend.Base.Equipment.EAutoKey_3p.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(autokey3p.Name);
                        //    break;

                        case Atend.Control.Enum.ProductType.Breaker:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EBreaker breaker = Atend.Base.Equipment.EBreaker.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(breaker.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.Bus:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EBus bus = Atend.Base.Equipment.EBus.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(conductor.Name);
                        //    break;
                        case Atend.Control.Enum.ProductType.GroundCabel:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EGroundCabel cabel = Atend.Base.Equipment.EGroundCabel.AccessSelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(cabel.Name);
                            break;

                        case Atend.Control.Enum.ProductType.CatOut:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.ECatOut catout = Atend.Base.Equipment.ECatOut.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(catout.Name);
                            break;

                        case Atend.Control.Enum.ProductType.Conductor:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EConductor conductor = Atend.Base.Equipment.EConductor.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(conductor.Name);
                            break;

                        case Atend.Control.Enum.ProductType.Consol:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EConsol consol = Atend.Base.Equipment.EConsol.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(consol.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.Countor:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.ECountor counter = Atend.Base.Equipment.ECountor.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(counter.Name);
                        //    break;
                        //case Atend.Control.Enum.ProductType.CT:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.ECT ct = Atend.Base.Equipment.ECT.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(ct.Name);
                        //    break;
                        //case Atend.Control.Enum.ProductType.DB:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EDB db = Atend.Base.Equipment.EDB.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(db.Name);
                        //    break;
                        case Atend.Control.Enum.ProductType.Disconnector:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EDisconnector disconnector = Atend.Base.Equipment.EDisconnector.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(disconnector.Name);
                            break;

                        case Atend.Control.Enum.ProductType.GroundPost:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(groundPost.Name);
                            break;

                        case Atend.Control.Enum.ProductType.HeaderCabel:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EHeaderCabel headerCabel = Atend.Base.Equipment.EHeaderCabel.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(headerCabel.Name);
                            break;

                        case Atend.Control.Enum.ProductType.Jumper:
//Extra
                        ////ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //Atend.Base.Equipment.EJumper jumper = Atend.Base.Equipment.EJumper.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //tvConsolSubEquipment.Nodes.Add(jumper.Name);
                        //break;
                        case Atend.Control.Enum.ProductType.Khazan:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EKhazan khzan = Atend.Base.Equipment.EKhazan.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(khzan.Name);
                            break;

                        case Atend.Control.Enum.ProductType.Mafsal:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EMafsal mafsal = Atend.Base.Equipment.EMafsal.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(mafsal.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.PhotoCell:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EPhotoCell phtoCell = Atend.Base.Equipment.EPhotoCell.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(phtoCell.Name);
                        //    break;
                        case Atend.Control.Enum.ProductType.Pole:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EPole pole = Atend.Base.Equipment.EPole.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(pole.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.PT:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EPT pt = Atend.Base.Equipment.EPT.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(pt.Name);
                        //    break;
                        //case Atend.Control.Enum.ProductType.ReCloser:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.EReCloser recloser = Atend.Base.Equipment.EReCloser.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(recloser.Name);
                        //    break;
                        case Atend.Control.Enum.ProductType.Rod:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.ERod rod = Atend.Base.Equipment.ERod.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(rod.Name);
                            break;
                        //case Atend.Control.Enum.ProductType.SectionLizer:

                        //    ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                        //    Atend.Base.Equipment.ESectionLizer sectionLizer = Atend.Base.Equipment.ESectionLizer.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                        //    tvConsolSubEquipment.Nodes.Add(sectionLizer.Name);
                        //    break;
                        case Atend.Control.Enum.ProductType.StreetBox:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.EStreetBox streetBox = Atend.Base.Equipment.EStreetBox.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(streetBox.Name);
                            break;

                        case Atend.Control.Enum.ProductType.Transformer:

                            //ed.WriteMessage("first productCode : " + Convert.ToInt32(row["ProductCode"]));
                            Atend.Base.Equipment.ETransformer transform = Atend.Base.Equipment.ETransformer.SelectByCode(Convert.ToInt32(row["ProductCode"]));
                            tvConsolSubEquipment.Nodes.Add(transform.Name);
                            break;

                        case Atend.Control.Enum.ProductType.InsulatorChain:

                            break;

                        case Atend.Control.Enum.ProductType.InsulatorPipe:
                            break;
                        }
                    }
                    else
                    {
                        //ed.WriteMessage("second productCode : " + Convert.ToInt32(row["ProductCode"]).ToString());
                        Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(Convert.ToInt32(row["ProductCode"]));
                        tvConsolSubEquipment.Nodes.Add(product.Name);
                    }
                }
            }

            /////////////////////////////////////////////////////////////////////
        }
Example #19
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            txtAdvanceType.Focus();
            int projectcode = 0;
            int Existance   = 0;

            if (Validation())
            {
                List <Atend.Base.Equipment.EJAckPanel>     JackPanelMiddles = new List <Atend.Base.Equipment.EJAckPanel>();
                List <Atend.Base.Equipment.EJackPanelWeek> JackPanelWeeks   = new List <Atend.Base.Equipment.EJackPanelWeek>();
                List <Atend.Base.Equipment.ETransformer>   Transformers     = new List <Atend.Base.Equipment.ETransformer>();
                ArrayList JackPanelMiddleExistance   = new ArrayList();
                ArrayList JackPanelWeekExistance     = new ArrayList();
                ArrayList TransformerExistance       = new ArrayList();
                ArrayList JackPanelMiddleProjectCode = new ArrayList();
                ArrayList JackPanelWeekProjectCode   = new ArrayList();
                ArrayList TransformerProjectCode     = new ArrayList();


                dtSuEquip = (System.Data.DataTable)gvSubEquip.DataSource;

                //##
                //##

                Atend.Base.Base.BEquipStatus statusGround = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                GroundPost.Existance = statusGround.ACode; //Convert.ToInt32(cboIsExist.SelectedValue);

                if (cboProjCode.Items.Count == 0)
                {
                    GroundPost.ProjectCode = 0;
                }
                else
                {
                    GroundPost.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }

                //MessageBox.Show(ObjID.ToString());
                GroundPost.SelectedObjectId = ObjID;
                Atend.Base.Design.DPackage dpack = Atend.Base.Design.DPackage.AccessSelectByCode(NodeCode);


                //AllowToclose = true;
                //if (GroundPost.UpdateGroundPostData(dpack.Code))
                //{
                //    AllowToclose = true;
                //    this.Close();
                //}
                //else
                //{
                //    AllowToclose = false;
                //}
                if (Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()) != selectedProductCode)
                {
                    if (MessageBox.Show("آیا مایل به حذف پست موجود و \nجایگزین کردن پست جدید می باشید", "هشدار", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                    {
                        if (Convert.ToBoolean(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[2].Value) == true)
                        {
                            Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[1].Value.ToString()));
                            //Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = false;
                            //Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;
                            GroundPost.UseAccess   = false;
                            GroundPost.eGroundPost = groundPost;

                            //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                            foreach (DataRow dr in dtSuEquip.Rows)
                            {
                                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                                //ed.WriteMessage("Type={0}\n", gvSubEquip.Rows[i].Cells[5].Value.ToString());
                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                                {
                                    Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode);
                                    JackPanelMiddleExistance.Add(Existance);
                                    JackPanelMiddles.Add(jackPanel);
                                    JackPanelMiddleProjectCode.Add(projectcode);
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                                {
                                    Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode);
                                    JackPanelWeekExistance.Add(Existance);
                                    JackPanelWeeks.Add(jackPanelWeek);
                                    JackPanelWeekProjectCode.Add(projectcode.ToString());
                                }


                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                                {
                                    Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode);
                                    TransformerExistance.Add(Existance);
                                    Transformers.Add(transformer);
                                    TransformerProjectCode.Add(projectcode.ToString());
                                }
                            }
                        }
                        else
                        {
                            Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.AccessSelectByCode(Convert.ToInt32(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
                            //Atend.Base.Acad.AcadGlobal.GroundPostData.UseAccess = true;
                            //Atend.Base.Acad.AcadGlobal.GroundPostData.eGroundPost = groundPost;
                            GroundPost.UseAccess   = true;
                            GroundPost.eGroundPost = groundPost;

                            //for (int i = 0; i < gvSubEquip.Rows.Count; i++)
                            foreach (DataRow dr in dtSuEquip.Rows)
                            {
                                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = status.ACode; //Convert.ToInt32(dr["IsExistance"].ToString());

                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvSubEquip.Rows[i].Cells[6];
                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel))
                                {
                                    Atend.Base.Equipment.EJAckPanel jackPanel = Atend.Base.Equipment.EJAckPanel.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddles.Add(jackPanel);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelMiddleProjectCode.Add(projectcode);
                                    JackPanelMiddleExistance.Add(Existance);
                                    JackPanelMiddles.Add(jackPanel);
                                    JackPanelMiddleProjectCode.Add(projectcode.ToString());
                                }

                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel))
                                {
                                    //Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.SelectByXCode(new Guid(gvSubEquip.Rows[i].Cells[1].Value.ToString()));
                                    Atend.Base.Equipment.EJackPanelWeek jackPanelWeek = Atend.Base.Equipment.EJackPanelWeek.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeeks.Add(jackPanelWeek);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eJackPanelWeekProjectCode.Add(projectcode);
                                    JackPanelWeekExistance.Add(Existance);
                                    JackPanelWeeks.Add(jackPanelWeek);
                                    JackPanelWeekProjectCode.Add(projectcode.ToString());
                                }


                                if (Convert.ToInt32(dr["Type"].ToString()) == Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer))
                                {
                                    Atend.Base.Equipment.ETransformer transformer = Atend.Base.Equipment.ETransformer.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerExistance.Add(Existance);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformers.Add(transformer);
                                    //Atend.Base.Acad.AcadGlobal.GroundPostData.eTransformerProjectCode.Add(projectcode);
                                    TransformerExistance.Add(Existance);
                                    Transformers.Add(transformer);
                                    TransformerProjectCode.Add(projectcode.ToString());
                                }
                            }
                        }
                        GroundPost.eJackPanelMiddles           = JackPanelMiddles;
                        GroundPost.eJackPanelMiddleExistance   = JackPanelMiddleExistance;
                        GroundPost.eJackPanelMiddleProjectCode = JackPanelMiddleProjectCode;
                        GroundPost.eJackPanelWeeks             = JackPanelWeeks;
                        GroundPost.eJackPanelWeekExistance     = JackPanelWeekExistance;
                        GroundPost.eJackPanelWeekProjectCode   = JackPanelWeekProjectCode;
                        GroundPost.eTransformers           = Transformers;
                        GroundPost.eTransformerExistance   = TransformerExistance;
                        GroundPost.eTransformerProjectCode = TransformerProjectCode;

                        if (GroundPost.UpdateGroundPostData(dpack.Code))
                        {
                            GroundPost.DrawGroundPost();
                            AllowToclose = true;
                            this.Close();
                        }
                        else
                        {
                            AllowToclose = false;
                        }
                    }
                    else
                    {
                        AllowToclose = false;
                    }
                }
                else
                {
                    //SaveWithoutDrawAllowToclose = false
                    foreach (DataRow dr in dtSuEquip.Rows)
                    {
                        dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["Isexistance"].ToString())).ACode;
                    }
                    if (!GroundPost.UpdateGroundPostWithoutDraw(dpack.Code, dtSuEquip))
                    {
                        Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                        notification.Title = "خطا";
                        notification.Msg   = "خطا در ویرایش پست زمینی";
                        notification.ShowStatusBarBalloon();
                        AllowToclose = false;
                    }
                    else
                    {
                        AllowToclose = true;
                    }
                }
            }
            else
            {
                AllowToclose = false;
            }


            //Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
            //if (!Atend.Global.Desig.NodeTransaction.DeleteGroundPost(GPCode))
            //{
            //    ed.WriteMessage("\nEXIT\n");
            //    return;
            //}

            //if (Validation())
            //{
            //    Atend.Base.Equipment.EGroundPost groundPost = Atend.Base.Equipment.EGroundPost.SelectByXCode(
            //        new Guid(gvDisconnector.Rows[gvDisconnector.CurrentRow.Index].Cells[0].Value.ToString()));
            //    //**EDIT**
            //    //GroundPostProductCode = groundPost.Code;
            //    GroundPostProductCode = groundPost.XCode;
            //    DataTable dtWeekJackPanel = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.WeekJackPanel));
            //    DataTable dtMiddleJAckanel = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.MiddleJackPanel));
            //    DataTable dtTransform = Atend.Base.Equipment.EContainerPackage.selectByContainerXCodeAndTypeAndTAbleType(groundPost.XCode, Convert.ToInt32(Atend.Control.Enum.ProductType.GroundPost), Convert.ToInt32(Atend.Control.Enum.ProductType.Transformer));
            //    transformerCount = dtTransform.Rows.Count;
            //    MiddlejackPanelCount = dtMiddleJAckanel.Rows.Count;

            //    MiddlejackPanelCount = 0;
            //    foreach (DataRow dr in dtMiddleJAckanel.Rows)
            //    {

            //        int MiddleCounter = Convert.ToInt32(dr["Count"]);
            //        for (int i = 1; i <= MiddleCounter; i++)
            //        {
            //            arMiddleJAckPAnel.Add(dr["ProductCode"].ToString());
            //            MiddlejackPanelCount++;
            //        }
            //    }

            //    //WeekJackPAnelCount = dtWeekJackPanel.Rows.Count;
            //    WeekJackPAnelCount = 0;
            //    foreach (DataRow dr in dtWeekJackPanel.Rows)
            //    {

            //        int WeekCounter = Convert.ToInt32(dr["Count"]);
            //        for (int i = 1; i <= WeekCounter; i++)
            //        {
            //            arweekJackPanel.Add(dr["ProductCode"]);
            //            WeekJackPAnelCount++;
            //        }
            //    }

            //    transformerCount = 0;
            //    foreach (DataRow dr in dtTransform.Rows)
            //    {

            //        int TransformerCounter = Convert.ToInt32(dr["Count"]);
            //        for (int i = 1; i <= TransformerCounter; i++)
            //        {
            //            arTransformer.Add(dr["ProductCode"]);
            //            transformerCount++;
            //        }

            //    }

            //    //PostCode = Convert.ToInt32(gvDisconnector.SelectedRows[0].Cells[0].Value.ToString());
            //    PostCode = new Guid(gvDisconnector.SelectedRows[0].Cells[0].Value.ToString());

            //    AllowToclose = true;
            //}
        }