private void QueryPlugLineStructInfo()
        {
            RadGridViewProperties.ClearGridView(this.radGridView1, null);
            var selectSQL = "order by ID desc";

            if (this.rtbCableCondition.Text.Trim() != "")
            {
                selectSQL = $"where CableName like '%{this.rtbCableCondition.Text.Trim()}%' order by ID desc";
            }
            var data = lineStructLibraryDetailManager.GetDataSetByFieldsAndWhere("distinct CableName", selectSQL).Tables[0];

            if (data.Rows.Count < 1)
            {
                return;
            }
            int iRow = 0;

            foreach (DataRow dr in data.Rows)
            {
                var lineStructName = dr["CableName"].ToString();
                if (IsExistLineStruct(lineStructName))
                {
                    continue;
                }
                this.radGridView1.Rows.AddNew();
                var resultString = GetInterfaceInfoByCableName(lineStructName);
                this.radGridView1.Rows[iRow].Cells[0].Value = iRow + 1;
                this.radGridView1.Rows[iRow].Cells[1].Value = lineStructName;
                this.radGridView1.Rows[iRow].Cells[2].Value = resultString;
                this.radGridView1.Rows[iRow].Cells[3].Value = lineStructLibraryDetailManager.GetRowCountByWhere($"where CableName='{lineStructName}'");
                //this.radGridView1.Rows[iRow].Cells[4].Value = dr["Remark"].ToString();
                iRow++;
            }
        }
예제 #2
0
        private bool IsInterUsed(string interName)
        {
            TCableTestLibraryManager libraryManager = new TCableTestLibraryManager();
            var data = libraryManager.GetDataSetByFieldsAndWhere("DISTINCT CableName", $"where StartInterface = '{interName}' OR EndInterface = '{interName}'").Tables[0];

            if (data.Rows.Count > 0)
            {
                return(true);
            }
            return(false);
        }
        private void QueryCableLibInfo()
        {
            RadGridViewProperties.ClearGridView(this.radGridView1, null);
            var where = "";
            if (this.tool_queryFilter.Text != "")
            {
                where = $"where CableName like '%{this.tool_queryFilter.Text}%'";
            }
            var data = lineStructLibraryDetailManager.GetDataSetByFieldsAndWhere("distinct CableName,Remark,Operator", where).Tables[0];

            if (data.Rows.Count < 1)
            {
                return;
            }
            int iRow = 0;

            foreach (DataRow dr in data.Rows)
            {
                var lineStructName = dr[0].ToString();

                if (IsExistLineStruct(lineStructName))
                {
                    continue;
                }
                this.radGridView1.Rows.AddNew();
                var resultString = GetInterfaceInfoByCableName(lineStructName);
                this.radGridView1.Rows[iRow].Cells[0].Value = iRow + 1;
                this.radGridView1.Rows[iRow].Cells[1].Value = lineStructName;
                this.radGridView1.Rows[iRow].Cells[2].Value = resultString.Split(',').Length;
                this.radGridView1.Rows[iRow].Cells[3].Value = resultString;
                this.radGridView1.Rows[iRow].Cells[4].Value = lineStructLibraryDetailManager.GetRowCountByWhere($"where CableName='{lineStructName}'");
                this.radGridView1.Rows[iRow].Cells[5].Value = dr[1].ToString();
                this.radGridView1.Rows[iRow].Cells[6].Value = dr[2].ToString();
                iRow++;
            }
        }
        private void GetLineStructDetailData(string plugCableName)
        {
            if (plugCableName == "")
            {
                return;
            }
            TCableTestLibraryManager lineStructManager = new TCableTestLibraryManager();
            var data = lineStructManager.GetDataSetByWhere($"where CableName = '{plugCableName}'").Tables[0];

            if (data.Rows.Count < 1)
            {
                return;
            }
            List <string> interfaceList      = new List <string>();
            List <int>    interfacePointList = new List <int>();

            this.Invoke(new Action(() =>
            {
                this.rtbCableName.Text = this.lineCableName;
                this.rtb_remark.Text   = data.Rows[0]["Remark"].ToString();
                var dt = lineStructManager.GetDataSetByFieldsAndWhere("DISTINCT StartInterface,EndInterface,StartContactPoint,EndContactPoint", $"where CableName = '{this.lineCableName}'").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    this.cb_startInterface.EditorControl.Rows.Clear();
                    this.cb_endInterface.EditorControl.Rows.Clear();
                    this.cb_startPin.EditorControl.Rows.Clear();
                    this.cb_endPin.EditorControl.Rows.Clear();

                    foreach (DataRow dr in dt.Rows)
                    {
                        var startInterface    = dr["StartInterface"].ToString();
                        var endInterface      = dr["EndInterface"].ToString();
                        var startContactPoint = int.Parse(dr["StartContactPoint"].ToString());
                        var endContactPoint   = int.Parse(dr["EndContactPoint"].ToString());

                        if (!interfaceList.Contains(startInterface))
                        {
                            interfaceList.Add(startInterface);
                        }
                        if (!interfaceList.Contains(endInterface))
                        {
                            interfaceList.Add(endInterface);
                        }
                        if (!interfacePointList.Contains(startContactPoint))
                        {
                            interfacePointList.Add(startContactPoint);
                        }
                        if (!interfacePointList.Contains(endContactPoint))
                        {
                            interfacePointList.Add(endContactPoint);
                        }
                    }
                    interfacePointList.Sort();

                    int iStart = 1;
                    foreach (var pointString in interfacePointList)
                    {
                        if (!IsExistCombox(this.cb_startPin, iStart.ToString()))
                        {
                            this.cb_startPin.EditorControl.Rows.Add(iStart);
                        }
                        if (!IsExistCombox(this.cb_endPin, iStart.ToString()))
                        {
                            this.cb_endPin.EditorControl.Rows.Add(iStart);
                        }
                        iStart++;
                    }
                    this.cb_startPin.EditorControl.ShowColumnHeaders    = false;
                    this.cb_startPin.EditorControl.AllowAutoSizeColumns = true;
                    this.cb_endPin.EditorControl.ShowColumnHeaders      = false;
                    this.cb_endPin.EditorControl.AllowAutoSizeColumns   = true;

                    foreach (var interString in interfaceList)
                    {
                        if (!IsExistInterfaceCombox(interString))
                        {
                            this.cb_startInterface.EditorControl.Rows.Add(interString);
                        }
                        if (!IsExistEndInterfaceCombox(interString))
                        {
                            this.cb_endInterface.EditorControl.Rows.Add(interString);
                        }
                        InitCableParams(interString);
                    }
                    this.cb_startInterface.EditorControl.ShowColumnHeaders   = false;
                    this.cb_startInterface.EditorControl.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
                    this.cb_endInterface.EditorControl.ShowColumnHeaders     = false;
                    this.cb_endInterface.EditorControl.AutoSizeColumnsMode   = GridViewAutoSizeColumnsMode.Fill;
                }
                int iRow = 0;
                foreach (DataRow dr in data.Rows)
                {
                    this.radGridView1.Rows.AddNew();
                    this.radGridView1.Rows[iRow].Cells[0].Value = iRow + 1;
                    this.radGridView1.Rows[iRow].Cells[1].Value = dr["StartInterface"].ToString();
                    this.radGridView1.Rows[iRow].Cells[2].Value = dr["StartContactPoint"].ToString();
                    this.radGridView1.Rows[iRow].Cells[3].Value = dr["EndInterface"].ToString();
                    this.radGridView1.Rows[iRow].Cells[4].Value = dr["EndContactPoint"].ToString();
                    iRow++;
                }
            }));
        }