コード例 #1
0
        private void UpdateProductCode(string code)
        {
            bool   notFound = true;
            int    id       = 0;
            string name     = null;

            if (!String.IsNullOrWhiteSpace(code))
            {
                OrderDataSet ds = new OrderDataSet();
                OrderDataSetTableAdapters.ProductsTableAdapter adapter = new OrderDataSetTableAdapters.ProductsTableAdapter();
                OrderDataSet.ProductsDataTable dataTable = adapter.GetDataByCode(code);

                if (dataTable.Rows.Count > 0)
                {
                    OrderDataSet.ProductsRow row = (OrderDataSet.ProductsRow)dataTable.Rows[0];

                    id       = row.Id;
                    name     = row.Name;
                    notFound = false;
                }
            }
            ProductId       = id;
            ProductName     = name;
            ProductNotFound = notFound;
        }
コード例 #2
0
        private void UpdateProductInfo(int id)
        {
            if (id > 0)
            {
                OrderDataSet ds = new OrderDataSet();
                OrderDataSetTableAdapters.ProductsTableAdapter adapter = new OrderDataSetTableAdapters.ProductsTableAdapter();
                OrderDataSet.ProductsDataTable dataTable = adapter.GetDataById(id);

                if (dataTable.Rows.Count > 0)
                {
                    OrderDataSet.ProductsRow row = (OrderDataSet.ProductsRow)dataTable.Rows[0];

                    ProductCode = row.Code;
                    ProductName = row.Name;
                }
            }
        }