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

            //if (SelectedHalterXCode != Guid.Empty)
            //{
            //    if (Atend.Base.Equipment.EHalter.ShareOnServer(SelectedHalterXCode))
            //    {
            //        Atend.Base.Equipment.EHalter h1 = Atend.Base.Equipment.EHalter.SelectByXCode(SelectedHalterXCode);
            //        Code = h1.Code;
            //        MessageBox.Show("به اشتراک گذاری با موفقیت انجام شد");
            //    }
            //    else
            //        MessageBox.Show("خطا در به اشتراک گذاری . لطفاً دوباره سعی کنید");
            //}
            //else
            //    MessageBox.Show("لطفا تجهیز مورد نظر را انتخاب کنید");
        }
Esempio n. 2
0
        public void BindDataToOwnControl(Guid XCode)
        {
            Atend.Base.Equipment.EHalter Hl = Atend.Base.Equipment.EHalter.SelectByXCode(XCode);
            //Atend.Base.Base.BProduct product = Atend.Base.Base.BProduct.Select_ByCode(key.ProductCode);
            Atend.Control.Common.selectedProductCode = Hl.ProductCode;

            SelectProduct();
            txtName.Text  = Hl.Name;
            txtX.Text     = Math.Round(Hl.X, 4).ToString();
            txtY.Text     = Math.Round(Hl.Y, 4).ToString();
            txtPower.Text = Math.Round(Hl.Power, 4).ToString();
            //txtAmper.Text = Convert.ToString(Math.Round(Fl.Amper, 2));
            //txtComment.Text = Fl.Comment;
            tsbIsDefault.Checked = Hl.IsDefault;
            SelectedHalterXCode  = new Guid(XCode.ToString());
            Code = Hl.Code;
            BindTreeViwAndGrid();
        }
Esempio n. 3
0
        public frmHalter(DataTable _dtForceOnPole, double _SafteyFactor, Guid _SectionCode, bool _IsUTs, double _SaftyFactorOburi)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            ed.WriteMessage("\nchecking.....\n");
            if (!Atend.Global.Acad.DrawEquips.Dicision.IsHere())
            {
                if (!Atend.Global.Acad.DrawEquips.Dicision.IsThere())
                {
                    //System.Diagnostics.Process[] prs = System.Diagnostics.Process.GetProcesses();
                    //foreach (System.Diagnostics.Process pr in prs)
                    //{
                    //    if (pr.ProcessName == "acad")
                    //    {
                    //        pr.CloseMainWindow();
                    //    }
                    //}
                    Atend.Global.Acad.Notification notification = new Atend.Global.Acad.Notification();
                    notification.Title = "شناسایی قفل";
                    notification.Msg   = "لطفا وضعیت قفل را بررسی نمایید ";
                    notification.infoCenterBalloon();

                    ForceToClose = true;
                }
            }

            InitializeComponent();
            dtForceOnPole    = _dtForceOnPole;
            IsUTs            = _IsUTs;
            SectionCode      = _SectionCode;
            SaftyFactor      = _SafteyFactor;
            SaftyFactorOburi = _SaftyFactorOburi;
            Atend.Global.Calculation.Mechanical.CalcOptimalSagTension calc = new Atend.Global.Calculation.Mechanical.CalcOptimalSagTension();
            ed.WriteMessage("BeforSelectAll\n");
            DataTable dtHalter = Atend.Base.Equipment.EHalter.SelectAllX();

            ed.WriteMessage("BeforSelectByXCode\n");
            Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.SelectByXCode(new Guid(dtHalter.Rows[0]["XCode"].ToString()));
            ed.WriteMessage("CalcResult\n");
            //DataTable dtResult=calc.CalcHalter(dtForceOnPole,halter);


            // dataGridView1.DataSource = dtResult;
        }
Esempio n. 4
0
 private bool CheckStatuseOfAccessChangeDefault()
 {
     Autodesk.AutoCAD.EditorInput.Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
     //ed.WriteMessage("AccessChangeDefault={0}\n", Atend.Control.Common.AccessChangeDefault);
     if (!Atend.Control.Common.AccessChangeDefault)
     {
         if (SelectedHalterXCode == Guid.Empty && IsDefault)
         {
             MessageBox.Show("کاربر گرامی شما اجازه ثبت تجهیز به صورت پیش فرض ندارید", "خطا");
             return(false);
         }
         else
         {
             Atend.Base.Equipment.EHalter Equip = Atend.Base.Equipment.EHalter.SelectByXCode(SelectedHalterXCode);
             if (Equip.IsDefault || IsDefault)
             {
                 MessageBox.Show("کاربر گرامی شما اجازه ویرایش  تجهیز به صورت پیش فرض ندارید", "خطا");
                 return(false);
             }
         }
     }
     return(true);
 }
        private void frmDrawPoleTip02_Load(object sender, EventArgs e)
        {
            if (ForceToClose)
            {
                this.Close();
            }

            BindDataToComboBoxIsExist();
            BindDataToCboInGridView();
            AddProjectCodeColumn();

            dtMergePoleTip = Atend.Base.Equipment.EPoleTip.SelectAllAndMerge();
            Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(NodeCode);
            selectedProductCode = dPack.ProductCode;

            gvPoleTip.AutoGenerateColumns = false;
            gvPoleTip.DataSource          = dtMergePoleTip;

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

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

            dtgvPoleConsol = Atend.Base.Design.DPackage.AccessSelectByParentCodeForConsol(dPack.Code, (int)Atend.Control.Enum.ProductType.Consol);

            dtHalt = Atend.Base.Design.DPackage.AccessSelectByParentCodeAndType(dPack.Code, Convert.ToInt32(Atend.Control.Enum.ProductType.Halter));
            if (dtHalt.Rows.Count > 0)
            {
                Atend.Base.Equipment.EHalter Halter = Atend.Base.Equipment.EHalter.AccessSelectByCode(Convert.ToInt32(dtHalt.Rows[0]["ProductCode"].ToString()));
                txtHalter.Text = Halter.Name;
            }

            System.Data.DataColumn dcIsSql = new System.Data.DataColumn("IsSql");
            dtgvPoleConsol.Columns.Add(dcIsSql);

            System.Data.DataColumn dcAccessCode = new System.Data.DataColumn("AccessCode");
            dtgvPoleConsol.Columns.Add(dcAccessCode);

            System.Data.DataColumn dcXCode = new System.Data.DataColumn("XCode");
            dtgvPoleConsol.Columns.Add(dcXCode);

            foreach (DataRow dr in dtgvPoleConsol.Rows)
            {
                dr["IsExistance"] = Atend.Base.Base.BEquipStatus.SelectByACode(Convert.ToInt32(dr["IsExistance"].ToString())).Code;
                dr["IsSql"]       = false;
                dr["XCode"]       = "_";
                dr["AccessCode"]  = dr["ProductCode"].ToString();
            }


            gvConsol.AutoGenerateColumns = false;
            gvConsol.DataSource          = dtgvPoleConsol;

            dtLastConsol = dtgvPoleConsol.Copy();

            //for (int i = 0; i < gvPoleTip.Rows.Count; i++)
            //{
            //    gvPoleTip.Rows[i].Selected = false;
            //}

            Atend.Base.Equipment.EPoleTip EPolT = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(dPack.ProductCode);
            if (EPolT.Code != -1)
            {
                txtHalterCount.Text = EPolT.HalterCount.ToString();
            }



            //BindDataTocboProjCode();

            cboIsExist.SelectedValue  = Atend.Base.Base.BEquipStatus.SelectByACode(dPack.IsExistance).Code;
            cboProjCode.SelectedValue = dPack.ProjectCode;

            if (dtHalt.Rows.Count > 0)
            {
                cboHIsExistance.SelectedValue = Atend.Base.Base.BEquipStatus.SelectByACode(Convert.ToInt32(dtHalt.Rows[0]["IsExistance"].ToString())).Code;
                cboHProjectCode.SelectedValue = Convert.ToInt32(dtHalt.Rows[0]["ProjectCode"].ToString());
            }
            dtCurrent = dtgvPoleConsol.Copy();
        }
        private void gvPoleTip_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            dtgvPoleConsol.Rows.Clear();
            Atend.Base.Equipment.EPoleTip poleTip       = new Atend.Base.Equipment.EPoleTip();
            System.Data.DataTable         dtExistance   = Atend.Base.Base.BEquipStatus.SelectAllX();                                                        //Atend.Control.Common.StatuseCode;
            System.Data.DataTable         dtProjectCode = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString())); //Atend.Base.Base.BProjectCode.AccessSelectAll();


            if (gvPoleTip.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == true)
                {
                    poleTip = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString()));
                    //poleTip = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString()));
                    Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.SelectByXCode(poleTip.HalterXID);
                    if (halter.Code != -1)
                    {
                        txtHalter.Text      = halter.Name;
                        txtHalterCount.Text = poleTip.HalterCount.ToString();
                    }

                    dtgvPoleConsol.Rows.Clear();
                    for (int i = 0; i < Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX.Count; i++)
                    {
                        Atend.Base.Equipment.EConsol consol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i].ToString()));
                        DataRow dr = dtgvPoleConsol.NewRow();
                        dr["Code"]        = Guid.Empty;
                        dr["XCode"]       = Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i];
                        dr["AccessCode"]  = "_";
                        dr["IsSql"]       = true;
                        dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                        if (cboProjCode.Items.Count > 0)
                        {
                            dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                        }
                        else
                        {
                            dr["ProjectCode"] = 0;
                        }
                        //dr["IsExistance"] = dtExistance.Rows[4]["Code"].ToString();
                        //dr["ProjectCode"] = dtProjectCode.Rows[0]["Code"].ToString();
                        dr["Name"]  = consol.Name;
                        dr["Count"] = "1";
                        dtgvPoleConsol.Rows.Add(dr);
                        //gvConsol.Rows[gvConsol.Rows.Count - 1].Cells[0].Value = Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i];
                        //Atend.Base.Equipment.EConsol Consol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i].ToString()));
                        //gvConsol.Rows[gvConsol.Rows.Count - 1].Cells[2].Value = Consol.Name;
                        //gvConsol.Rows[gvConsol.Rows.Count - 1].Cells[4].Value = Atend.Base.Equipment.EPoleTip.nodeCountEPackageX[i].ToString();
                    }
                }
                else
                {
                    poleTip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));
                    //poleTip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.AccessSelectByCode(poleTip.HalterID);
                    if (halter.Code != -1)
                    {
                        txtHalter.Text      = halter.Name;
                        txtHalterCount.Text = poleTip.HalterCount.ToString();
                    }
                    else
                    {
                        txtHalter.Text      = "";
                        txtHalterCount.Text = "0";
                    }

                    dtgvPoleConsol.Rows.Clear();
                    for (int i = 0; i < Atend.Base.Equipment.EPoleTip.nodeKeysEPackage.Count; i++)
                    {
                        Atend.Base.Equipment.EConsol Consol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i].ToString()));
                        DataRow dr = dtgvPoleConsol.NewRow();
                        dr["Name"]        = Consol.Name;
                        dr["Code"]        = Guid.Empty;//Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i];
                        dr["XCode"]       = "_";
                        dr["AccessCode"]  = Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i];
                        dr["IsSql"]       = false;
                        dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                        if (cboProjCode.Items.Count > 0)
                        {
                            dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                        }
                        else
                        {
                            dr["ProjectCode"] = 0;
                        }
                        //dr["IsExistance"] = dtExistance.Rows[4]["Code"].ToString();
                        //dr["ProjectCode"] = dtProjectCode.Rows[0]["Code"].ToString();
                        dr["count"] = "1";
                        dtgvPoleConsol.Rows.Add(dr);
                    }
                }

                //if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == false)
                //{
                //    dtgvPoleConsol = dtCurrent.Copy();
                //    gvConsol.AutoGenerateColumns = false;
                //    gvConsol.DataSource = dtgvPoleConsol;
                //    return;
                //}
                //else
                //{
                //    gvConsol.AutoGenerateColumns = false;
                //    gvConsol.DataSource = dtgvPoleConsol;
                //}
            }
        }
        private void btnOk_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            if (Validation())
            {
                bool useAccess   = false;
                int  projectcode = 0;

                List <Atend.Base.Equipment.EConsol> list = new List <Atend.Base.Equipment.EConsol>();
                ArrayList consoluse      = new ArrayList();
                ArrayList consolexis     = new ArrayList();
                ArrayList consolcount    = new ArrayList();
                ArrayList ConsolProjCode = new ArrayList();
                ArrayList DelConsol      = new ArrayList();

                Atend.Base.Equipment.EConsol eConsol = new Atend.Base.Equipment.EConsol();
                int Existance = 0;
                Atend.Base.Equipment.EPole    ePole    = new Atend.Base.Equipment.EPole();
                Atend.Base.Equipment.EPoleTip ePoletip = new Atend.Base.Equipment.EPoleTip();
                //ed.WriteMessage("IsSqlSelected={0}\n", gvPoleTip.SelectedRows[0].Cells[2].Value.ToString());
                Atend.Base.Equipment.EHalter halt = new Atend.Base.Equipment.EHalter();

                if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == true)
                {
                    ePoletip  = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString()));
                    ePole     = Atend.Base.Equipment.EPole.SelectByXCode(ePoletip.PoleXCode);
                    useAccess = false;
                    if (ePoletip.HalterCount != 0)
                    {
                        halt = Atend.Base.Equipment.EHalter.SelectByXCode(ePoletip.HalterXID);
                    }
                }
                else
                {
                    ePoletip  = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));//gvPoleTip.SelectedRows[0].Cells[1].Value
                    ePole     = Atend.Base.Equipment.EPole.AccessSelectByCode(ePoletip.PoleCode);
                    useAccess = true;
                    if (ePoletip.HalterCount != 0)
                    {
                        halt = Atend.Base.Equipment.EHalter.AccessSelectByCode(ePoletip.HalterID);
                    }
                }

                foreach (DataRow dr in dtLastConsol.Rows)
                {
                    DelConsol.Add(dr["Code"].ToString());
                }



                //if (ePole.Shape == 0)
                //{
                //    ed.WriteMessage("**********I AM IN Shape=0\n");
                //    shape = 0;
                //    Atend.Global.Acad.DrawEquips.AcDrawCirclePole ACDCP = new Atend.Global.Acad.DrawEquips.AcDrawCirclePole();
                //    ACDCP.ePole = ePole;
                //    ACDCP.ePoleTip = ePoletip;
                //    ACDCP.UseAccess = useAccess;
                //    ACDCP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                //    ACDCP.Existance = Convert.ToByte(cboIsExist.SelectedValue);

                //    ACDCP.HalterExistance = Convert.ToByte(cboHIsExistance.SelectedValue);
                //    ACDCP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                //    ACDCP.Height = Convert.ToInt32(txtHeight.Text);
                //    ACDCP.eHalter = halt;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear();
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Clear();
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Clear();
                //    ed.WriteMessage("oo\n");
                //    ACDCP.eConsols.Clear();
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Clear();
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Clear();

                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.Factor = ePoletip.Factor;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.Existance = Convert.ToByte(cboIsExist.SelectedValue);
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.UseAccess = useAccess;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.ePole = ePole;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.ePoleTip = ePoletip;
                //    //Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);

                //    foreach (DataRow dr in dtgvPoleConsol.Rows)
                //    {
                //        if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                //        {
                //            //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];
                //            //Existance = Convert.ToInt32(c.Value);

                //            //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];
                //            //projectcode = Convert.ToInt32(cPCode.Value);
                //            if (Convert.ToBoolean(dr["IsSql"].ToString()))
                //            {
                //                ed.WriteMessage("LocalConsolXCODE={0}\n", dr["XCode"].ToString());
                //                eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(
                //                    dr["XCode"].ToString()));
                //                ed.WriteMessage("Consol.NAme={0}\n", eConsol.Name);
                //                ACDCP.eConsols.Add(eConsol);
                //                ed.WriteMessage("HH\n");
                //                ACDCP.eConsolUseAccess.Add(false);
                //                ed.WriteMessage("AA\n");
                //                ACDCP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                //                ed.WriteMessage("Ab\n");

                //                ACDCP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString()));
                //                ed.WriteMessage("Ac\n");

                //                ACDCP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));
                //            }
                //            else
                //            {
                //                ed.WriteMessage("Access Consol\n");
                //                eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(
                //                   dr["AccessCode"].ToString()));
                //                ACDCP.eConsols.Add(eConsol);
                //                ACDCP.eConsolUseAccess.Add(true);
                //                ACDCP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                //                ed.WriteMessage("eConsolExistance={0}\n", Existance);
                //                ACDCP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString()));
                //                ACDCP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));

                //            }

                //        }
                //    }
                //    ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Count);

                //    if (ACDCP.UpdatePoleDataTip(objID, DelConsol, NodeCode))
                //    {
                //        AllowClose = true;
                //        return;
                //    }
                //}
                //else
                //{
                //    shape = 1;
                //    ed.WriteMessage("TYPE={0}\n", ePole.Type);
                //    if (ePole.Type == 2)
                //    {
                //        Atend.Global.Acad.DrawEquips.AcDrawPolygonPole ACDP = new Atend.Global.Acad.DrawEquips.AcDrawPolygonPole();
                //        ed.WriteMessage("***************Type=2\n");
                //        Type = 2;
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear();
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Clear();
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Clear();
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear();
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Clear();
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Clear();

                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                //        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.Factor = ePoletip.Factor;
                //        ACDP.Existance = Convert.ToByte(cboIsExist.SelectedValue);
                //        ACDP.UseAccess = useAccess;
                //        ACDP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);

                //        ACDP.ePole = ePole;
                //        ACDP.ePoleTip = ePoletip;


                //        ACDP.HalterExistance = Convert.ToByte(cboHIsExistance.SelectedValue);
                //        ACDP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                //        ACDP.Height = Convert.ToInt32(txtHeight.Text);
                //        ACDP.eHalter = halt;
                //        foreach (DataRow dr in dtgvPoleConsol.Rows)
                //        {
                //            if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                //            {
                //                //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];


                //                //Existance = Convert.ToInt32(c.Value);
                //                //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];
                //                //projectcode = Convert.ToInt32(cPCode.Value);
                //                ed.WriteMessage("***IsSQL={0}\n",dr["IsSql"].ToString());
                //                if (Convert.ToBoolean(dr["IsSql"].ToString()))
                //                {
                //                    eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(
                //                       dr["XCode"].ToString()));
                //                    ACDP.eConsols.Add(eConsol);
                //                    ACDP.eConsolUseAccess.Add(false);
                //                    ACDP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                //                    ed.WriteMessage("eConsolExistance={0}\n", Existance);
                //                    ACDP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString()));
                //                    ACDP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));
                //                }
                //                else
                //                {
                //                    eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(
                //                       dr["AccessCode"].ToString()));
                //                    ACDP.eConsols.Add(eConsol);
                //                    ACDP.eConsolUseAccess.Add(true);
                //                    ACDP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                //                    ed.WriteMessage("eConsolExistance={0}\n", Existance);
                //                    ACDP.eConsolExistance.Add(Convert.ToInt32(dr["IsExistance"].ToString()));
                //                    ACDP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));
                //                }
                //            }
                //        }
                //        if (ACDP.UpdatePoleDataTip(objID, DelConsol, NodeCode))
                //        {
                //            AllowClose = true;
                //            return;
                //        }
                //        //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Count);

                //    }
                //    //if (ePole.Type == 3)
                //    //{
                //Type = 3;
                Atend.Global.Acad.DrawEquips.AcDrawPole ADP = new Atend.Global.Acad.DrawEquips.AcDrawPole();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Clear();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Clear();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Clear();
                //Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Clear();

                //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.Factor = ePoletip.Factor;
                Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue.ToString()));
                ADP.Existance = status.ACode;

                if (cboProjCode.Items.Count == 0)
                {
                    ADP.ProjectCode = 0;
                }
                else
                {
                    ADP.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                }
                ADP.UseAccess = useAccess;
                ADP.ePoleTip  = ePoletip;
                ADP.ePole     = ePole;


                Atend.Base.Base.BEquipStatus statusHalter = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExistance.SelectedValue.ToString()));
                ADP.HalterExist = statusHalter.ACode;

                if (cboHProjectCode.Items.Count == 0)
                {
                    ADP.HalterProjectCode = 0;
                }
                else
                {
                    ADP.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                }

                ADP.Height       = Convert.ToInt32(txtHeight.Text);
                ADP.eHalter      = halt;
                ADP.eHalterCount = Convert.ToInt32(txtHalterCount.Text);

                foreach (DataRow dr in dtgvPoleConsol.Rows)
                {
                    if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                    {
                        //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];

                        //Existance = Convert.ToInt32(c.Value);
                        //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];
                        //projectcode = Convert.ToInt32(cPCode.Value);
                        if (Convert.ToBoolean(dr["IsSql"].ToString()))
                        {
                            eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(
                                                                                     dr["XCode"].ToString()));
                            ADP.eConsols.Add(eConsol);
                            ADP.eConsolUseAccess.Add(false);
                            ADP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));

                            Atend.Base.Base.BEquipStatus status2 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                            ADP.eConsolExistance.Add(status2.ACode);

                            if (dr["ProjectCode"].ToString() == "")
                            {
                                ADP.eConsolProjectCode.Add(0);
                            }
                            else
                            {
                                ADP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));
                            }
                        }
                        else
                        {
                            eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(
                                                                                          dr["AccessCode"].ToString()));
                            ADP.eConsols.Add(eConsol);
                            ADP.eConsolUseAccess.Add(true);
                            ADP.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));

                            Atend.Base.Base.BEquipStatus status2 = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                            ADP.eConsolExistance.Add(status2.ACode);

                            if (dr["ProjectCode"].ToString() == "")
                            {
                                ADP.eConsolProjectCode.Add(0);
                            }
                            else
                            {
                                ADP.eConsolProjectCode.Add(Convert.ToInt32(dr["ProjectCode"].ToString()));
                            }
                        }
                    }
                }
                if (ADP.UpdatePoleDataTip(objID, DelConsol, NodeCode))
                {
                    AllowClose = true;
                    return;
                }

                //}


                //}

                //AllowClose = true;
            }
            else
            {
                AllowClose = false;
            }
        }
Esempio n. 8
0
        private void gvPoleTip_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            //MessageBox.Show(dtMergePoleTip.Rows[gvPoleTip.CurrentRow.Index]["Height"].ToString());
            dtgvPoleConsol.Rows.Clear();
            DataTable dtExistance   = Atend.Base.Base.BEquipStatus.SelectAllX();
            DataTable dtProjectCode = Atend.Base.Base.BWorkOrder.SelectJoinOrder(Convert.ToInt32(cboIsExist.SelectedValue.ToString())); //Atend.Base.Base.BProjectCode.AccessSelectAll();

            Atend.Base.Equipment.EPoleTip poleTip = new Atend.Base.Equipment.EPoleTip();
            if (gvPoleTip.Rows.Count > 0)
            {
                if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells["IsSql"].Value) == true)
                {
                    poleTip = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString()));
                    Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.SelectByXCode(poleTip.HalterXID);
                    if (halter.Code != -1)
                    {
                        txtHalter.Text      = halter.Name;
                        txtHalterCount.Text = poleTip.HalterCount.ToString();
                    }
                    Byte[] byteBLOBData = new Byte[0];
                    byteBLOBData = (Byte[])(poleTip.Image);
                    MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
                    pictureBox1.Image = Image.FromStream(stmBLOBData);

                    for (int i = 0; i < Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX.Count; i++)
                    {
                        //int count = Convert.ToInt32(Atend.Base.Equipment.EPoleTip.nodeCountEPackageX[i].ToString());
                        DataRow dr = dtgvPoleConsol.NewRow();
                        dr["XCode"] = Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i];
                        Atend.Base.Equipment.EConsol Consol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(Atend.Base.Equipment.EPoleTip.nodeKeysEPackageX[i].ToString()));
                        dr["Name"]  = Consol.Name;
                        dr["Count"] = Atend.Base.Equipment.EPoleTip.nodeCountEPackageX[i].ToString();

                        dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                        if (cboProjCode.Items.Count > 0)
                        {
                            dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                        }
                        else
                        {
                            dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                        }
                        //dr["IsExistance"] = Convert.ToInt32(dtExistance.Rows[4]["Code"]);
                        //dr["ProjectCode"] = Convert.ToInt32(dtProjectCode.Rows[0]["Code"]);
                        dr["Code"] = Guid.Empty;
                        dtgvPoleConsol.Rows.Add(dr);
                    }
                }
                else
                {
                    //ed.WriteMessage("Code={0}\n", gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString());
                    poleTip = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));
                    Atend.Base.Equipment.EHalter halter = Atend.Base.Equipment.EHalter.AccessSelectByCode(poleTip.HalterID);
                    if (halter.Code != -1)
                    {
                        txtHalter.Text      = halter.Name;
                        txtHalterCount.Text = poleTip.HalterCount.ToString();
                    }
                    Byte[] byteBLOBData = new Byte[0];
                    byteBLOBData = (Byte[])(poleTip.Image);
                    MemoryStream stmBLOBData = new MemoryStream(byteBLOBData);
                    pictureBox1.Image = Image.FromStream(stmBLOBData);
                    for (int i = 0; i < Atend.Base.Equipment.EPoleTip.nodeKeysEPackage.Count; i++)
                    {
                        //int count = Convert.ToInt32(Atend.Base.Equipment.EPoleTip.nodeCountEPackage[i].ToString());
                        DataRow dr = dtgvPoleConsol.NewRow();
                        dr["Code"] = Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i];
                        string name = "";
                        //ed.WriteMessage("EPoleTip.nodeKeysEPackage[i]={0}\n", Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i]);
                        Atend.Base.Equipment.EConsol Consol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(Atend.Base.Equipment.EPoleTip.nodeKeysEPackage[i].ToString()));
                        dr["Name"]  = Consol.Name;
                        dr["Count"] = Atend.Base.Equipment.EPoleTip.nodeCountEPackage[i].ToString();

                        dr["IsExistance"] = cboIsExist.SelectedValue.ToString();
                        if (cboProjCode.Items.Count > 0)
                        {
                            dr["ProjectCode"] = cboProjCode.SelectedValue.ToString();
                        }
                        else
                        {
                            dr["ProjectCode"] = dtWorkOrders.Rows[0]["ACode"];
                        }
                        //dr["IsExistance"] = Convert.ToInt32(dtExistance.Rows[4]["Code"]);
                        //dr["ProjectCode"] = Convert.ToInt32(dtProjectCode.Rows[0]["Code"]);
                        //dr["Code"] = Guid.Empty;
                        dtgvPoleConsol.Rows.Add(dr);
                    }
                }
            }
        }
Esempio n. 9
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;

            if (Validation())
            {
                //Atend.Base.Base.BEquipStatus statusaaaa = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                gvPoleTip.Focus();
                bool useAccess   = false;
                int  projectcode = 0;
                Atend.Base.Equipment.EConsol eConsol = new Atend.Base.Equipment.EConsol();
                int Existance = 0;
                Atend.Base.Equipment.EPole    ePole    = new Atend.Base.Equipment.EPole();
                Atend.Base.Equipment.EPoleTip ePoletip = new Atend.Base.Equipment.EPoleTip();

                Atend.Base.Equipment.EHalter Halt = new Atend.Base.Equipment.EHalter();


                if (Convert.ToBoolean(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[2].Value) == true)
                {
                    ePoletip  = Atend.Base.Equipment.EPoleTip.SelectByXCode(new Guid(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[0].Value.ToString()));
                    ePole     = Atend.Base.Equipment.EPole.SelectByXCode(ePoletip.PoleXCode);
                    useAccess = false;
                    Halt      = Atend.Base.Equipment.EHalter.SelectByXCode(ePoletip.HalterXID);
                }
                else
                {
                    //ed.WriteMessage("Access\n");
                    ePoletip  = Atend.Base.Equipment.EPoleTip.AccessSelectByCode(Convert.ToInt32(gvPoleTip.Rows[gvPoleTip.CurrentRow.Index].Cells[1].Value.ToString()));
                    ePole     = Atend.Base.Equipment.EPole.AccessSelectByCode(ePoletip.PoleCode);
                    useAccess = true;
                    Halt      = Atend.Base.Equipment.EHalter.AccessSelectByCode(ePoletip.HalterID);
                }



                if (ePole.Shape == 0)
                {
                    shape = 0;

                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear();
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Clear();
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Clear();
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Clear();
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Clear();
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Clear();

                    Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                    //Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.dPoleInfo.Factor = ePoletip.Factor;
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.UseAccess        = useAccess;

                    Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.Existance = status.ACode;
                    if (cboProjCode.Items.Count == 0)
                    {
                        Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = 0;
                    }
                    else
                    {
                        Atend.Base.Acad.AcadGlobal.CirclePoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                    }

                    Atend.Base.Acad.AcadGlobal.CirclePoleData.ePole    = ePole;
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.ePoleTip = ePoletip;
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.Height   = Convert.ToDouble(txtHeight.Text);

                    Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue));
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterExistance = statusHalteer.ACode;
                    if (cboHProjectCode.Items.Count == 0)
                    {
                        Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterProjectCode = 0;
                    }
                    else
                    {
                        Atend.Base.Acad.AcadGlobal.CirclePoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                    }

                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eHalter      = Halt;
                    Atend.Base.Acad.AcadGlobal.CirclePoleData.eHalterCount = ePoletip.HalterCount;

                    //for (int i = 0; i < gvConsol.Rows.Count; i++)
                    foreach (DataRow dr in dtgvPoleConsol.Rows)
                    {
                        if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                        {
                            //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];
                            Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                            Existance = statusPole.ACode;
                            if (dr["ProjectCode"].ToString() == "")
                            {
                                projectcode = 0;
                            }
                            else
                            {
                                projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                            }

                            //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];
                            if (!useAccess)
                            {
                                eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Add(eConsol);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Add(false);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Add(Existance);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Add(projectcode);
                            }
                            else
                            {
                                eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsols.Add(eConsol);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolUseAccess.Add(true);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolExistance.Add(Existance);
                                Atend.Base.Acad.AcadGlobal.CirclePoleData.eConsolProjectCode.Add(projectcode);
                            }
                        }
                    }
                }
                else
                {
                    shape = 1;
                    //ed.WriteMessage("*******EPOLe.Type={0}\n", ePole.Type);

                    if (ePole.Type == 2)
                    {
                        //ed.WriteMessage("Type=2\n");
                        Type = 2;
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear();
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Clear();
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Clear();
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Clear();
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Clear();
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Clear();

                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                        //Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.dPoleInfo.Factor = ePoletip.Factor;

                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.Existance = status.ACode;
                        if (cboProjCode.Items.Count == 0)
                        {
                            Atend.Base.Acad.AcadGlobal.PolygonPoleData.ProjectCode = 0;
                        }
                        else
                        {
                            Atend.Base.Acad.AcadGlobal.PolygonPoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                        }

                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.UseAccess = useAccess;
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.Height    = Convert.ToDouble(txtHeight.Text);

                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.ePole    = ePole;
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.ePoleTip = ePoletip;

                        Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue));
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterExistance = statusHalteer.ACode;
                        if (cboHProjectCode.Items.Count == 0)
                        {
                            Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterProjectCode = 0;
                        }
                        else
                        {
                            Atend.Base.Acad.AcadGlobal.PolygonPoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                        }

                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eHalter      = Halt;
                        Atend.Base.Acad.AcadGlobal.PolygonPoleData.eHalterCount = ePoletip.HalterCount;

                        //for (int i = 0; i < gvConsol.Rows.Count; i++)
                        foreach (DataRow dr in dtgvPoleConsol.Rows)
                        {
                            if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                            {
                                //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];

                                Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = statusPole.ACode;
                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];

                                if (!useAccess)
                                {
                                    eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(
                                                                                             dr["XCode"].ToString()));
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Add(eConsol);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Add(false);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                    //ed.WriteMessage("eConsolExistance={0}\n", Existance);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Add(Existance);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Add(projectcode);
                                }
                                else
                                {
                                    eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(
                                                                                                  dr["Code"].ToString()));
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Add(eConsol);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolUseAccess.Add(true);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                    //ed.WriteMessage("eConsolExistance={0}\n", Existance);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolExistance.Add(Existance);
                                    Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsolProjectCode.Add(projectcode);
                                }
                            }
                        }
                        //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PolygonPoleData.eConsols.Count);
                    }
                    else   //if (ePole.Type == 3)
                    {
                        Type = 3;
                        //ed.WriteMessage("Type=3\n");
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear();
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Clear();
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Clear();
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Clear();
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Clear();
                        Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Clear();

                        Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterCount = ePoletip.HalterCount;
                        //Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.HalterType = ePoletip.HalterID;
                        Atend.Base.Acad.AcadGlobal.PoleData.dPoleInfo.Factor = ePoletip.Factor;

                        Atend.Base.Base.BEquipStatus status = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboIsExist.SelectedValue));
                        Atend.Base.Acad.AcadGlobal.PoleData.Existance = status.ACode;
                        if (cboProjCode.Items.Count == 0)
                        {
                            Atend.Base.Acad.AcadGlobal.PoleData.ProjectCode = 0;
                        }
                        else
                        {
                            Atend.Base.Acad.AcadGlobal.PoleData.ProjectCode = Convert.ToInt32(cboProjCode.SelectedValue);
                        }

                        Atend.Base.Acad.AcadGlobal.PoleData.UseAccess = useAccess;
                        Atend.Base.Acad.AcadGlobal.PoleData.ePoleTip  = ePoletip;
                        Atend.Base.Acad.AcadGlobal.PoleData.ePole     = ePole;
                        Atend.Base.Acad.AcadGlobal.PoleData.Height    = Convert.ToDouble(txtHeight.Text);

                        Atend.Base.Base.BEquipStatus statusHalteer = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(cboHIsExist.SelectedValue));
                        Atend.Base.Acad.AcadGlobal.PoleData.HalterExistance = statusHalteer.ACode;
                        if (cboHProjectCode.Items.Count == 0)
                        {
                            Atend.Base.Acad.AcadGlobal.PoleData.HalterProjectCode = 0;
                        }
                        else
                        {
                            Atend.Base.Acad.AcadGlobal.PoleData.HalterProjectCode = Convert.ToInt32(cboHProjectCode.SelectedValue);
                        }

                        Atend.Base.Acad.AcadGlobal.PoleData.eHalter      = Halt;
                        Atend.Base.Acad.AcadGlobal.PoleData.eHalterCount = ePoletip.HalterCount;

                        //for (int i = 0; i < gvConsol.Rows.Count; i++)
                        foreach (DataRow dr in dtgvPoleConsol.Rows)
                        {
                            if (Convert.ToInt32(dr["Count"].ToString()) != 0)
                            {
                                //DataGridViewComboBoxCell c = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[3];
                                Atend.Base.Base.BEquipStatus statusPole = Atend.Base.Base.BEquipStatus.SelectByCode(Convert.ToInt32(dr["IsExistance"].ToString()));
                                Existance = statusPole.ACode;
                                if (dr["ProjectCode"].ToString() == "")
                                {
                                    projectcode = 0;
                                }
                                else
                                {
                                    projectcode = Convert.ToInt32(dr["ProjectCode"].ToString());
                                }

                                //DataGridViewComboBoxCell cPCode = (DataGridViewComboBoxCell)gvConsol.Rows[i].Cells[5];
                                if (!useAccess)
                                {
                                    eConsol = Atend.Base.Equipment.EConsol.SelectByXCode(new Guid(dr["XCode"].ToString()));
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Add(eConsol);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Add(false);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                    //ed.WriteMessage("eConsolExistance={0}\n", Existance);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Add(Existance);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Add(projectcode);
                                }
                                else
                                {
                                    eConsol = Atend.Base.Equipment.EConsol.AccessSelectByCode(Convert.ToInt32(dr["Code"].ToString()));
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Add(eConsol);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolUseAccess.Add(true);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolCount.Add(Convert.ToInt32(dr["Count"].ToString()));
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolExistance.Add(Existance);
                                    Atend.Base.Acad.AcadGlobal.PoleData.eConsolProjectCode.Add(projectcode);
                                }
                            }
                        }
                        //ed.WriteMessage("Consol.Count={0}\n", Atend.Base.Acad.AcadGlobal.PoleData.eConsols.Count);
                    }
                }

                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;
                }

                AllowClose = true;
            }
            else
            {
                AllowClose = false;
            }
        }
Esempio n. 10
0
        private void btnChange_Click(object sender, EventArgs e)
        {
            Atend.Global.Calculation.Mechanical.CMechanicalChange MecChange = new Atend.Global.Calculation.Mechanical.CMechanicalChange();
            if (IsPowerWithHalter)
            {
                for (int i = 0; i < gvCommentPowerWithHalter.Rows.Count; i++)
                {
                    DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvCommentPowerWithHalter.Rows[i].Cells[11];
                    //ed.WriteMessage("");
                    if (chk.Value.ToString() == "True")
                    {
                        //ed.WriteMessage("CommentPole={0}\n",gvCommentPower.Rows[i].Cells[5].Value.ToString());
                        if (gvCommentPowerWithHalter.Rows[i].Cells[5].Value.ToString() != "")
                        {
                            ed.WriteMessage("Add dPack\n");
                            Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[1].Value.ToString()));
                            MecChange.DPackage.Add(dPack);

                            Atend.Base.Design.DPoleInfo dPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[1].Value.ToString()));
                            MecChange.PoleInfo.Add(dPoleInfo);
                            MecChange.Count.Add(Convert.ToInt32(gvCommentPowerWithHalter.Rows[i].Cells[7].Value.ToString()));

                            //ed.WriteMessage("###={0}\n", gvCommentPower.Rows[i].Cells[2].Value.ToString());
                            Atend.Base.Equipment.EPole Pole = Atend.Base.Equipment.EPole.SelectByXCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[2].Value.ToString()));
                            MecChange.Pole.Add(Pole);



                            Atend.Base.Equipment.EHalter Halter = Atend.Base.Equipment.EHalter.SelectByXCode(new Guid(gvCommentPowerWithHalter.Rows[i].Cells[12].Value.ToString()));
                            MecChange.Halter.Add(Halter);
                            MecChange.HalterCount.Add(Convert.ToInt32(gvCommentPowerWithHalter.Rows[i].Cells[10].Value.ToString()));
                        }
                    }
                }

                if (!MecChange.ChangePoleInfoWithHalter())
                {
                    ed.WriteMessage("Error in ChangePoleInfoWithHalter");
                }
            }
            else
            {
                for (int i = 0; i < gvCommentPower.Rows.Count; i++)
                {
                    DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)gvCommentPower.Rows[i].Cells[8];
                    //ed.WriteMessage("");
                    if (chk.Value.ToString() == "True")
                    {
                        if (gvCommentPower.Rows[i].Cells["CommentPole"].Value.ToString() != "")
                        {
                            ed.WriteMessage("Add dPack\n");
                            Atend.Base.Design.DPackage dPack = Atend.Base.Design.DPackage.AccessSelectByNodeCode(new Guid(gvCommentPower.Rows[i].Cells["DcPoleGuid"].Value.ToString()));
                            MecChange.DPackage.Add(dPack);

                            Atend.Base.Design.DPoleInfo dPoleInfo = Atend.Base.Design.DPoleInfo.AccessSelectByNodeCode(new Guid(gvCommentPower.Rows[i].Cells["DcPoleGuid"].Value.ToString()));
                            MecChange.PoleInfo.Add(dPoleInfo);
                            MecChange.Count.Add(Convert.ToInt32(gvCommentPower.Rows[i].Cells["Count"].Value.ToString()));

                            ed.WriteMessage("###={0}\n", gvCommentPower.Rows[i].Cells["Code"].Value.ToString());
                            Atend.Base.Equipment.EPole Pole = Atend.Base.Equipment.EPole.SelectByXCode(new Guid(gvCommentPower.Rows[i].Cells["Code"].Value.ToString()));
                            MecChange.Pole.Add(Pole);
                        }
                    }
                }

                if (!MecChange.ChangePoleInfo())
                {
                    ed.WriteMessage("Error in ChangePoleInfo");
                }
            }
        }
Esempio n. 11
0
        private void Save()
        {
            txtName.Focus();
            Atend.Base.Equipment.EHalter Halter = new Atend.Base.Equipment.EHalter();
            Halter.ProductCode = Atend.Control.Common.selectedProductCode;
            //Halter.Amper = Convert.ToDouble(txtAmper.Text);
            //Halter.Comment = txtComment.Text;
            Halter.Name      = txtName.Text;
            Halter.X         = Convert.ToDouble(txtX.Text);
            Halter.Y         = Convert.ToDouble(txtY.Text);
            Halter.IsDefault = IsDefault;
            Halter.Power     = Convert.ToDouble(txtPower.Text);
            Halter.Code      = Code;
            //Equipment
            ArrayList EPackageProduct = new ArrayList();

            for (int j = 0; j < gvSelectedEquipment.Rows.Count; j++)
            {
                Atend.Base.Equipment.EProductPackage _EProductPackage = new Atend.Base.Equipment.EProductPackage();
                _EProductPackage.XCode     = new Guid(gvSelectedEquipment.Rows[j].Cells[0].Value.ToString());
                _EProductPackage.Count     = Convert.ToInt32(gvSelectedEquipment.Rows[j].Cells[2].Value.ToString());
                _EProductPackage.TableType = Convert.ToInt16(gvSelectedEquipment.Rows[j].Cells[3].Value.ToString());
                EPackageProduct.Add(_EProductPackage);
            }
            Halter.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);
            }
            Halter.OperationList = EOperation;
            if (SelectedHalterXCode == Guid.Empty)
            {
                if (Halter.InsertX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان ثبت کردن اطلاعات نمی باشد", "خطا");
                }
            }
            else
            {
                Halter.XCode = new Guid(SelectedHalterXCode.ToString());
                if (Halter.UpdateX())
                {
                    Reset();
                }
                else
                {
                    MessageBox.Show("امکان به روز رسانی اطلاعات نمی باشد", "خطا");
                }
            }
        }