Rapid Agile Development for Prototyping and Rapid Application Development

Navigation: <Root level>

Enumerations

 

 

 

 

Table and Field Enumerations are added as part of the C.R.U.D. Project Set Up Wizard.

 

 

 

The Table and Field Enumerations generated can be used for Field access. If Tables and Fields are dropped the compiler will highlight errors in the code where these enumerations are now no longer available.

 

namespace kissOrders.SQLServer2014.TableAndFieldEnums

{

          public class kissOrders

          {

                    public enum Tables

                    {

                              customer = 0,

                              order = 1,

                              orderLine = 2,

                              product = 3,

                              tests = 4

                    }

 

                    public enum Customer

                    {

                              ID = 0,

                              Name = 1,

                              Surname = 2,

                              DoB = 3,

                              UserName = 4

                    }

 

                    public enum Order

                    {

                              ID = 0,

                              OrderNo = 1,

                              CustomerID = 2,

                              OrderDate = 3,

                              Notes = 4

                    }

 

                    public enum OrderLine

                    {

                              ID = 0,

                              OrderID = 1,

                              PoductID = 2,

                              Qty = 3

                    }

 

                    public enum Product

                    {

                              ID = 0,

                              Name = 1,

                              Description = 2,

                              Price = 3,

                              ProductImage = 4

                    }

 

                    public enum Tests

                    {

                              ID = 0,

                              Test = 1,

                              Test4 = 2

                    }

 

 

          }

}

 

...

 

E.g.

 

        private void dgvCustomer_SelectionChanged(object sender, EventArgs e)

        {

            try

            {

                if (dgvCustomers.SelectedRows.Count == 1)

                {

                    _CustomerID = Convert.ToInt32(dgvCustomers.SelectedRows[0].Cells[Convert.ToInt32(kissOrders.SQLServer2014.TableAndFieldEnums.Customer.ID)].Value);

                    numCustomerID.Value = _CustomerID;

                }

            }

            catch (System.Exception ex)

            {

                MessageBox.Show(ex.Message);

            }

        }

 

 

 

 

 

www.rapidagiledevelopment.com by Cove Bay Software Limited Copyright © 2015