Exemplo n.º 1
0
        private void BtnSearch_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtSearch.Text))
            {
                list.Clear();
                listDetails.Clear();
                int cont = 0;
                AlmacenDisecWS.tool[] a = new AlmacenDisecWS.tool[200];
                a    = serviceDA.queryAllTool();
                cont = a.Count();
                for (int i = 0; i < cont; i++)
                {
                    Tool s = new Tool();
                    s.id_item          = a[i].id_item;
                    s.name_item        = a[i].name_item;
                    s.price            = a[i].price;
                    s.brand.brand_name = a[i].brand.brand_name;
                    list.Add(s);
                }

                dgvSearch.AutoGenerateColumns = false;
                dgvSearch.DataSource          = list;
                btnNew.Enabled     = true;
                btnAddTool.Enabled = true;

                /*
                 * if (s.tool_details != null)
                 * {
                 *  cont = s.tool_details.Count();
                 *  for (int i = 0; i < cont; i++)
                 *  {
                 *      AlmacenDisecWS.toolDetail t = new AlmacenDisecWS.toolDetail();
                 *      t.code_tool = s.tool_details[i].code_tool;
                 *      t.serie_tool = s.tool_details[i].serie_tool;
                 *      t.detail_tool = s.tool_details[i].detail_tool;
                 *      t.tool_state = s.tool_details[i].tool_state;
                 *      listDetails.Add(t);
                 *  }
                 *
                 *  dgvSearch.AutoGenerateColumns = false;
                 *  dgvSearch.DataSource = listDetails;
                 *  btnModify.Enabled = true;
                 * }*/


                /*
                 * a = serviceDA.queryAllTool();
                 * cont = a.Count();
                 * for (int i = 0; i < cont; i++)
                 * {
                 *  Tool s = new Tool();
                 *  s.id_tool = a[i].id_tool;
                 *  s.name_item = a[i].name_item;
                 *  s.price = a[i].price;
                 *  s.brand = a[i].brand;
                 *  s.tool_details = a[i].tool_details;
                 *  if (s.tool_details != null)
                 *  {
                 *      int b = s.tool_details.Length;
                 *      for (int j = 0; j < b; j++)
                 *      {
                 *          AlmacenDisecWS.toolDetail t = new AlmacenDisecWS.toolDetail();
                 *          t.code_tool = s.tool_details[j].code_tool;
                 *          t.serie_tool = s.tool_details[j].serie_tool;
                 *          t.detail_tool = s.tool_details[j].detail_tool;
                 *          t.tool_state = s.tool_details[j].tool_state;
                 *          listDetails.Add(t);
                 *      }
                 *  }
                 *
                 *  list.Add(s);
                 * }
                 * dgvSearch.AutoGenerateColumns = false;
                 * dgvSearch.DataSource = listDetails;
                 */
            }
            else
            {
            }
        }