예제 #1
0
        private void BindTreeView(TreeNodeCollection NodeCollection, DataTable dt, int Level)
        {
            IEnumerable <DataRow> nodes = from d in dt.AsEnumerable()
                                          where d.Field <int>("ParentID") == Level
                                          select d;

            foreach (DataRow Dr in nodes)
            {
                TreeNode node = new TreeNode(Dr.Field <string>("TypeName"), Convert.ToString(Dr.Field <int>("ID")));
                NodeCollection.Add(node);
                BindTreeView(node.ChildNodes, dt, Dr.Field <int>("ID"));
            }
        }
        private void search_J()
        {
            try {
                var name      = new List <string>();
                var sta       = new List <string>();
                var pri       = new List <string>();
                var data_acc  = new OrcDataAcess3();
                var data_acc1 = new orcDataacess4();
                var dt        = new DataTable();
                data_acc.Show(dt);
                data_acc1.Show(dt);

                foreach (DataRow Dr in dt.Rows)
                {
                    name.Add(Dr.Field <string>("NAME"));
                    sta.Add(Dr.Field <string>("PRICE"));
                    pri.Add(Dr.Field <string>("STATE"));
                }
                int MAX = 0;
                for (int i = 0; i < name.Count; i++)
                {
                    if (this.search.Text != name[i])
                    {
                        MAX++;
                    }
                    else
                    {
                        this.AA.IsChecked = false;
                        this.pri1.Text    = pri[i];
                        this.Name1.Text   = name[i];
                        this.bar1.Text    = sta[i];
                    }
                    if (MAX == name.Count)
                    {
                        this.AA.IsChecked = false;
                        this.AA.IsChecked = true;
                        this.pri1.Text    = "";
                        this.Name1.Text   = "";
                        this.bar1.Text    = "";
                    }
                }
            }
            catch (Exception ex) { }
        }
 private void search_P()
 {
     try {
         var name     = new List <string>();
         var bar      = new List <string>();
         var pri      = new List <string>();
         var qua      = new List <string>();
         var data_acc = new OrcDataAcess();
         var dt       = new DataTable();
         data_acc.Show(dt);
         foreach (DataRow Dr in dt.Rows)
         {
             name.Add(Dr.Field <string>("NAME"));
             bar.Add(Dr.Field <string>("BARCODE"));
             pri.Add(Dr.Field <string>("PRICE"));
             qua.Add(Dr.Field <string>("QUANTITY"));
         }
         int MAX = 0;
         for (int i = 0; i < name.Count; i++)
         {
             if (Regex.IsMatch(search.Text, "^[0-9]*$"))
             {
                 if (search.Text == bar[i])
                 {
                     this.AA.IsChecked = false;
                     this.bar.Text     = bar[i];
                     this.qua.Text     = qua[i];
                     this.pri.Text     = pri[i];
                     Name.Text         = name[i];
                 }
                 else
                 {
                     MAX++;
                 }
             }
             else
             {
                 if (search.Text != name[i])
                 {
                     MAX++;
                 }
                 else
                 {
                     this.AA.IsChecked = false;
                     this.bar.Text     = bar[i];
                     this.qua.Text     = qua[i];
                     this.pri.Text     = pri[i];
                     Name.Text         = name[i];
                 }
             }
         }
         if (MAX == name.Count)
         {
             this.AA.IsChecked = false;
             this.AA.IsChecked = true;
             this.bar.Text     = "";
             this.qua.Text     = "";
             this.pri.Text     = "";
             Name.Text         = "";
         }
         bar.Clear();
         qua.Clear();
         pri.Clear();
         name.Clear();
     }
     catch (Exception ex) { }
 }