Ejemplo n.º 1
0
        private void ComboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            PlacesModel placesObj = new PlacesModel(comboBox3.SelectedValue.ToString());

            controllerObj            = new ViewController();
            dataSetObj               = controllerObj.travelEmployee(placesObj);
            dataGridView1.DataSource = dataSetObj.Tables[0];
        }
Ejemplo n.º 2
0
        public DataSet travelEmployee(PlacesModel obj)
        {
            sqlDataAdapterObj            = new SqlDataAdapter();
            selectCommandObj             = new SqlCommand();
            selectCommandObj.CommandText = "select EmployeeTravelDetails.TravelID,EmployeeTravelDetails.EmployeeID,EmployeeTravelDetails.ArrivalDate,EmployeeTravelDetails.DepartureDate,s.State,p1.Placename as Source,P.PlaceName as Destination from EmployeeTravelDetails, Places P,Places p1, Status s where EmployeeTravelDetails.ToPlaceID = @placename and EmployeeTravelDetails.ToPlaceID = P.PlaceID and EmployeeTravelDetails.FromPlaceID = p1.PlaceID and EmployeeTravelDetails.StatusID = s.StatusID";

            selectCommandObj.Connection = sqlConnectionobj;

            sqlParameterObj1 = new SqlParameter("@placename", obj.PlaceName);
            selectCommandObj.Parameters.Add(sqlParameterObj1);
            sqlDataAdapterObj.SelectCommand = selectCommandObj;
            dataSetObj = new DataSet();
            sqlDataAdapterObj.Fill(dataSetObj);
            return(dataSetObj);
        }