コード例 #1
0
        public string GetComponent(string BuildingID, string Location_Renamed)
        {
            string str = Conversions.ToString(-1);

            try
            {
                this.dtComponents = mdUtility.DB.GetDataTable("SELECT System_Component.[SYS_COMP_ID], RO_Component.COMP_DESC FROM RO_Component INNER JOIN (Building_System INNER JOIN System_Component ON Building_System.[BLDG_SYS_ID] = System_Component.[SYS_COMP_BLDG_SYS_ID]) ON RO_Component.[COMP_ID] = System_Component.[SYS_COMP_COMP_LINK] WHERE (((System_Component.[SYS_COMP_ID]) Not In (SELECT [SYS_COMP_ID] FROM Components_by_location WHERE Components_by_location.[Facility_ID]={" + BuildingID + "} AND SAMP_DATA_LOC={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(Location_Renamed).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "})) AND ((Building_System.[BLDG_SYS_BLDG_ID])={" + BuildingID + "}) AND ((System_Component.BRED_Status)<>'D' Or (System_Component.BRED_Status) Is Null)) ORDER BY RO_Component.COMP_DESC;");
                if (this.dtComponents.Rows.Count == 0)
                {
                    int num = (int)Interaction.MsgBox((object)"There are no components to attach.  Please switch\rto the inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Components to Inspection");
                    str = Conversions.ToString(-1);
                }
                else
                {
                    UltraTreeNode nodeByKey = mdUtility.fMainForm.tvInspection.GetNodeByKey(Location_Renamed);
                    if (nodeByKey.Nodes.Count > 0)
                    {
                        UltraTreeNode ultraTreeNode = nodeByKey.Nodes[0];
                        int           count         = nodeByKey.Nodes.Count;
                        int           num           = 1;
                        while (num <= count)
                        {
                            if (ultraTreeNode.Tag != null)
                            {
                                DataView dataView = new DataView(this.dtComponents);
                                dataView.RowFilter = "[sys_comp_id]= '" + Strings.Replace(ultraTreeNode.Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "'";
                                while (dataView.Count > 0)
                                {
                                    dataView.Delete(0);
                                }
                                ultraTreeNode = ultraTreeNode.GetSibling(NodePosition.Next);
                            }
                            checked { ++num; }
                        }
                    }
                    this.cboComponents.DisplayMember = "COMP_DESC";
                    this.cboComponents.ValueMember   = "SYS_COMP_ID";
                    this.cboComponents.DataSource    = (object)this.dtComponents;
                    if (this.cboComponents.Items.Count == 0)
                    {
                        int num = (int)Interaction.MsgBox((object)"There are no components to attach.  Please switch\rto the inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Components to Inspection");
                        str = Conversions.ToString(-1);
                    }
                    else
                    {
                        int num = (int)this.ShowDialog();
                        str = !this.m_bUserCanceled ? this.m_strComponentID : Conversions.ToString(-1);
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                mdUtility.Errorhandler(ex, nameof(frmAttachComponent), nameof(GetComponent));
                ProjectData.ClearProjectError();
            }
            return(str);
        }
コード例 #2
0
        public string GetSection(string strComponentID, string SampleLocation)
        {
            string str = Conversions.ToString(-1);

            try
            {
                this.m_dtSections = mdUtility.DB.GetDataTable("SELECT [Section Info].[SEC_ID], [Section Info].SectionName, [Section Info].[SEC_SYS_COMP_ID] FROM [Section Info] WHERE ((([Section Info].[SEC_ID]) Not In (SELECT [SEC_ID] FROM Sections_by_location WHERE Sections_by_location.[SEC_SYS_COMP_ID]={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(strComponentID).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "} AND Samp_Data_Loc={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(SampleLocation).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "})) AND (([Section Info].[SEC_SYS_COMP_ID])={" + Strings.Replace(mdUtility.fMainForm.tvInspection.GetNodeByKey(strComponentID).Tag.ToString(), "'", "''", 1, -1, CompareMethod.Binary) + "}) AND (([Section Info].BRED_Status)<>'D' Or ([Section Info].BRED_Status) Is Null))");
                if (this.m_dtSections.Rows.Count == 0)
                {
                    int num = (int)Interaction.MsgBox((object)"There are no sections to attach.  Please switch \r\nto the Inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Section to Inspection");
                    str = "-1";
                }
                else
                {
                    UltraTreeNode nodeByKey = mdUtility.fMainForm.tvInspection.GetNodeByKey(strComponentID);
                    if (nodeByKey.Nodes.Count > 0)
                    {
                        UltraTreeNode ultraTreeNode = nodeByKey.Nodes[0];
                        int           num           = checked (nodeByKey.Nodes.Count - 1);
                        int           index1        = 0;
                        while (index1 <= num)
                        {
                            if (nodeByKey.Nodes[index1].Tag != null)
                            {
                                string Right  = nodeByKey.Nodes[index1].Tag.ToString();
                                int    index2 = checked (this.m_dtSections.Rows.Count - 1);
                                while (index2 >= 0)
                                {
                                    if (Microsoft.VisualBasic.CompilerServices.Operators.CompareString(this.m_dtSections.Rows[index2]["SEC_ID"].ToString(), Right, false) == 0)
                                    {
                                        this.m_dtSections.Rows.Remove(this.m_dtSections.Rows[index2]);
                                    }
                                    checked { index2 += -1; }
                                }
                                ultraTreeNode = ultraTreeNode.GetSibling(NodePosition.Next);
                            }
                            checked { ++index1; }
                        }
                    }
                    if (this.m_dtSections.Rows.Count == 0)
                    {
                        int num = (int)Interaction.MsgBox((object)"There are no sections to attach.  Please switch \r\nto the Inventory screen and add them.", MsgBoxStyle.OkOnly, (object)"Attach Section to Inspection");
                        str = "-1";
                    }
                    else
                    {
                        this.cboSections.DisplayMember = "SectionName";
                        this.cboSections.ValueMember   = "SEC_ID";
                        this.cboSections.DataSource    = (object)this.m_dtSections;
                        int num = (int)this.ShowDialog();
                        str = !this.m_bUserCanceled ? this.m_strSectionID : Conversions.ToString(-1);
                    }
                }
            }
            catch (Exception ex)
            {
                ProjectData.SetProjectError(ex);
                mdUtility.Errorhandler(ex, nameof(frmAttachSection), nameof(GetSection));
                ProjectData.ClearProjectError();
            }
            return(str);
        }