Ejemplo n.º 1
0
        //take in form inputs and popluate grid content
        private void dataGrid_climbs_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            DataTable dt    = climbDb.getDt();
            DataRow   dr    = dt.Rows[e.RowIndex];
            routeData route = new routeData();

            //exception handling
            try
            {
                //collect information from the form
                route.attempts  = Convert.ToInt32(dr["attempts"]);
                route.color     = dr["color"].ToString();
                route.date      = Convert.ToDateTime(dr["date"].ToString());
                route.grade     = dr["grade"].ToString();
                route.notes     = dr["notes"].ToString();
                route.routeDesc = dr["routeDesc"].ToString();

                //create new climb
                singleClimb climb = new singleClimb();
                //assign form data to climb
                climb.assignInfo(route);

                //create new route
                RouteInfo routeInfo = new RouteInfo(climb);
                //show route
                routeInfo.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Ejemplo n.º 2
0
 public void assignInfo(routeData data)
 {
     details.attempts  = data.attempts;
     details.color     = data.color;
     details.date      = data.date;
     details.grade     = data.grade;
     details.notes     = data.notes;
     details.routeDesc = data.routeDesc;
 }
Ejemplo n.º 3
0
        public RouteInfo(singleClimb climbInfo)
        {
            //set value of form labels
            InitializeComponent();
            routeData route = climbInfo.getDetails();

            lbl_attempts.Text    = route.attempts.ToString();
            lbl_color.Text       = route.color.ToString();
            lbl_dateClimbed.Text = route.date.ToString();
            lbl_description.Text = route.routeDesc.ToString();
            lbl_grade.Text       = route.grade.ToString();
            lbl_notes.Text       = route.notes.ToString();
        }
Ejemplo n.º 4
0
        //add the climb to the database
        public void addClimbToDb(Climb climb)
        {
            routeData route = climb.getDetails();

            //exception handling
            try
            {
                //add row to data table
                dt.Rows.Add(route.date, route.routeDesc, route.color, route.grade, route.attempts, route.notes);
            }
            //exception handling
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Ejemplo n.º 5
0
 //add details
 public void assignInfo(routeData data)
 {
     details.Add(data);
 }
Ejemplo n.º 6
0
 // create new route data for climb
 public singleClimb()
 {
     details = new routeData();
 }