Пример #1
0
        /// <summary>
        /// 加载设备类型
        /// </summary>
        private void addlx()
        {
            DataView  view;
            DataTable dts;

            DataRow[] rows;
            #region 加载分站
            dts = GetAllDev();
            comb_fz.Properties.Items.Clear();
            comb_fz.Properties.Items.Add("");
            if (dts.Rows.Count > 0)
            {
                rows = dts.Select("", "fzh asc");
                for (int i = 0; i < rows.Length; i++)
                {
                    comb_fz.Properties.Items.Add(rows[i]["point"].ToString());
                }
            }
            #endregion

            #region 加载类型
            comb_lb.Properties.Items.Clear();
            dtlx      = OprFuction.GetAlllb("");
            view      = new DataView(dtlx);
            view.Sort = "lxtype asc";
            dts       = view.ToTable(true, "lx", "lxtype");
            if (dts != null && dts.Rows.Count > 0)
            {
                foreach (DataRow row in dts.Rows)
                {
                    comb_lb.Properties.Items.Add(row["lx"].ToString());
                }
            }
            #endregion
        }
Пример #2
0
        private void comb_fz_SelectedIndexChanged(object sender, EventArgs e)
        {
            string temp = "";

            DataRow[] rows = null;

            try
            {
                #region 加载分站下测点
                fzh = "";
                listB.Items.Clear();
                comb_lb.Text = "";
                comb_zl.Text = "";
                comb_lb.Properties.Items.Clear();
                comb_zl.Properties.Items.Clear();
                if (!string.IsNullOrEmpty(comb_fz.Text))
                {
                    temp = comb_fz.Text.Trim();
                    temp = temp.Substring(temp.IndexOf('[') + 1, temp.IndexOf(']') - temp.IndexOf('[') - 1);
                    lock (StaticClass.allPointDtLockObj)
                    {
                        rows = StaticClass.AllPointDt.Select("point='" + temp + "'", "tdh asc");
                        if (rows.Length > 0)
                        {
                            fzh  = rows[0]["fzh"].ToString();
                            rows = StaticClass.AllPointDt.Select("fzh='" + rows[0]["fzh"].ToString() + "'", "tdh asc");
                            if (rows.Length > 0)
                            {
                                foreach (DataRow row in rows)
                                {
                                    listB.Items.Add(string.Format("[{0}]{1}[{2}]", row["point"].ToString(), row["wz"].ToString(), row["lb"].ToString()));
                                }
                            }
                        }
                    }
                }
                dtlx = OprFuction.GetAlllb(fzh);
                DataView view = new DataView(dtlx);
                view.Sort = "lxtype asc";
                DataTable dts = view.ToTable(true, "lx", "lxtype");
                if (dts != null && dts.Rows.Count > 0)
                {
                    foreach (DataRow row in dts.Rows)
                    {
                        comb_lb.Properties.Items.Add(row["lx"].ToString());
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                OprFuction.SaveErrorLogs("加载分站下测点", ex);
            }
        }
Пример #3
0
        /// <summary>
        /// 设备类别树初始化
        /// </summary>
        private void tree_devlb_init()
        {
            DataRow[] rows = null;
            int       i    = 0;
            DataView  view;
            DataTable dts;
            string    lx = "", zl = "";

            DevExpress.XtraTreeList.Nodes.TreeListNode node;
            try
            {
                treeList_zl.BeginUpdate();
                treeList_zl.Nodes[0].StateImageIndex = 0;
                treeList_zl.Nodes[0].Nodes.Clear();
                DataTable dt = OprFuction.GetAlllb("");

                #region 加载类型
                view      = new DataView(dt);
                view.Sort = "lxtype";
                dts       = view.ToTable(true, "lx", "lxtype");
                if (dts != null && dts.Rows.Count > 0)
                {
                    foreach (DataRow row in dts.Rows)
                    {
                        node = treeList_zl.AppendNode(
                            new object[] { row["lx"].ToString(), i, "" }, treeList_zl.Nodes[0]);
                        i++;
                        node.ImageIndex       = 0;
                        node.Tag              = row["lx"].ToString();
                        node.SelectImageIndex = 1;
                        node.StateImageIndex  = 0;
                    }
                }
                #endregion

                #region 加载种类
                view = new DataView(dt);
                dts  = view.ToTable(true, "lx", "zl");
                if (treeList_zl.Nodes[0].Nodes.Count > 0)
                {
                    for (int j = 0; j < treeList_zl.Nodes[0].Nodes.Count; j++)
                    {
                        lx   = treeList_zl.Nodes[0].Nodes[j].Tag.ToString();
                        rows = dts.Select("lx='" + lx + "'");
                        if (rows.Length > 0)
                        {
                            foreach (DataRow row in rows)
                            {
                                //if (row["zl"].ToString() != "")
                                //{
                                node = treeList_zl.AppendNode(
                                    new object[] { string.IsNullOrEmpty(row["zl"].ToString()) ? "" : row["zl"].ToString(), i, "" }, treeList_zl.Nodes[0].Nodes[j]);
                                i++;
                                node.ImageIndex       = 0;
                                node.Tag              = row["zl"].ToString();
                                node.SelectImageIndex = 1;
                                node.StateImageIndex  = 0;
                                //}
                            }
                        }
                    }
                }
                #endregion

                #region 加载设备名称
                view = new DataView(dt);
                dts  = view.ToTable(true, "lx", "zl", "lb");
                if (treeList_zl.Nodes[0].Nodes.Count > 0)
                {
                    for (int j = 0; j < treeList_zl.Nodes[0].Nodes.Count; j++)
                    {
                        if (treeList_zl.Nodes[0].Nodes[j].Nodes.Count > 0)
                        {
                            for (int k = 0; k < treeList_zl.Nodes[0].Nodes[j].Nodes.Count; k++)
                            {
                                lx   = treeList_zl.Nodes[0].Nodes[j].Tag.ToString();
                                zl   = treeList_zl.Nodes[0].Nodes[j].Nodes[k].Tag.ToString();
                                rows = dts.Select("lx='" + lx + "' and zl='" + zl + "'");
                                if (rows.Length > 0)
                                {
                                    foreach (DataRow row in rows)
                                    {
                                        node = treeList_zl.AppendNode(
                                            new object[] { row["lb"].ToString(), i, "" }, treeList_zl.Nodes[0].Nodes[j].Nodes[k]);
                                        i++;
                                        node.ImageIndex       = 0;
                                        node.Tag              = row["lb"].ToString();
                                        node.SelectImageIndex = 1;
                                        node.StateImageIndex  = 0;
                                        node.Visible          = true;
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                treeList_zl.EndUpdate();
                treeList_zl.ExpandAll();
            }
            catch (Exception ex)
            {
                OprFuction.SaveErrorLogs(ex.Message, ex);
            }
        }
Пример #4
0
        private void comb_lb_SelectedIndexChanged(object sender, EventArgs e)
        {
            DataView  view;
            DataTable dts;

            DataRow [] rows;
            string     lx = "";

            try
            {
                lx = comb_lb.Text;
                comb_zl.Properties.Items.Clear();
                comb_zl.Text = "";
                if (!string.IsNullOrEmpty(lx))
                {
                    dtlx = OprFuction.GetAlllb(fzh);
                    view = new DataView(dtlx);
                    dts  = view.ToTable(true, "lx", "zl");

                    rows = dts.Select("lx='" + lx + "'");
                    if (rows.Length > 0)
                    {
                        foreach (DataRow row in rows)
                        {
                            comb_zl.Properties.Items.Add(row["zl"].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OprFuction.SaveErrorLogs("加载种类", ex);
            }
            string str1 = "", str2 = "", str3 = "";

            try
            {
                listB.Items.Clear();
                if (!string.IsNullOrEmpty(lx))
                {
                    lock (StaticClass.allPointDtLockObj)
                    {
                        if (fzh != "")
                        {
                            rows = StaticClass.AllPointDt.Select("fzh='" + fzh + "' and  lx='" + lx + "'");
                        }
                        else
                        {
                            rows = StaticClass.AllPointDt.Select("lx='" + lx + "'");
                        }
                        if (rows.Length > 0)
                        {
                            for (int i = 0; i < rows.Length; i++)
                            {
                                if (!rows[i].IsNull("point"))
                                {
                                    #region 加载测点
                                    str1 = rows[i]["point"].ToString();
                                    if (!rows[i].IsNull("wz"))
                                    {
                                        str2 = rows[i]["wz"].ToString();
                                    }
                                    else
                                    {
                                        str2 = "";
                                    }
                                    if (!rows[i].IsNull("lb"))
                                    {
                                        str3 = rows[i]["lb"].ToString();
                                    }
                                    else
                                    {
                                        str3 = "";
                                    }
                                    listB.Items.Add(string.Format("[{0}]{1}[{2}]", str1, str2, str3));
                                    #endregion
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                OprFuction.SaveErrorLogs("根据种类加载测点", ex);
            }
        }