public View_Trains(int empid)
        {
            InitializeComponent();
            empno         = empid;
            controllerObj = new Controller();


            bool a = controllerObj.IsDriver(empno);

            if (a == true)
            {
                viewmytrains.Enabled = true;
            }
            else
            {
                viewmytrains.Enabled = false;
            }

            TrackCB.DisplayMember = "track_name";
            TrackCB.ValueMember   = "track_num";
            TrackCB.DataSource    = controllerObj.ViewTracks();

            TrackVal = (int)TrackCB.SelectedValue;


            SelTrainDGV.DataSource = controllerObj.SelectTrainDGV(TrackVal);
            SelTrainDGV.Refresh();
            SelTrainDGV.ReadOnly              = true;
            SelTrainDGV.AllowUserToAddRows    = false;
            SelTrainDGV.AllowUserToDeleteRows = false;
        }
 private void TrackCB_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelTrainDGV.DataSource = controllerObj.SelectTrainDGV((int)TrackCB.SelectedValue);
     SelTrainDGV.Refresh();
     SelTrainDGV.ReadOnly              = true;
     SelTrainDGV.AllowUserToAddRows    = false;
     SelTrainDGV.AllowUserToDeleteRows = false;
 }
Exemplo n.º 3
0
        public MyTrains(int empid)
        {
            InitializeComponent();
            empno         = empid;
            controllerObj = new Controller();

            SelTrainDGV.DataSource = controllerObj.SelectMyTrain(empno);
            SelTrainDGV.Refresh();
            SelTrainDGV.ReadOnly              = true;
            SelTrainDGV.AllowUserToAddRows    = false;
            SelTrainDGV.AllowUserToDeleteRows = false;
        }