Exemplo n.º 1
0
        public List <VendorInformationClass> GetVendorInformation()
        {
            VendorInformationClass        vendors   = null;
            List <VendorInformationClass> vendorses = new List <VendorInformationClass>();
            string        connectionString          = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection = new SqlConnection(connectionString);

            connection.Open();

            string        queryString = "SELECT * FROM vendorsInformation";
            SqlCommand    command     = new SqlCommand(queryString, connection);
            SqlDataReader reader      = command.ExecuteReader();

            while (reader.Read())
            {
                vendors                      = new VendorInformationClass();
                vendors.VendorsName          = (reader["vendorsName"]).ToString();
                vendors.VendorsPostalCode    = (reader["vendorsPostalCode"]).ToString();
                vendors.VendorsStreetAddress = (reader["vendorsStreetAddress"]).ToString();
                vendors.VendorsCity          = (reader["vendorsCity"]).ToString();
                vendorses.Add(vendors);
            }
            connection.Close();
            return(vendorses);
        }
Exemplo n.º 2
0
        public void saveVendorsInformation(VendorInformationClass vehicleinformationObj)
        {
            string        connectionString = @"server=DUET-559FE4FA51\SQLEXPRESS;integrated security = SSPI; database = VehicleInformationDB;";
            SqlConnection connection       = new SqlConnection(connectionString);

            connection.Open();

            string     insertString = "INSERT INTO vendorsInformation VALUES('" + vehicleinformationObj.VendorsName + "','" + vehicleinformationObj.VendorsStreetAddress + "','" + vehicleinformationObj.VendorsCity + "','" + vehicleinformationObj.VendorsPostalCode + "')";
            SqlCommand command      = new SqlCommand(insertString, connection);

            command.ExecuteNonQuery();
            connection.Close();
        }
Exemplo n.º 3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            VendorInformationClass vendorsObj = new VendorInformationClass();

            vendorsObj.VendorsName          = vendorsNameTextBox.Text;
            vendorsObj.VendorsStreetAddress = vendorsStreetTextBox.Text;
            vendorsObj.VendorsPostalCode    = vendorsPotalCodTextBox.Text;
            vendorsObj.VendorsCity          = vendosCityTextBox.Text;

            VendorInformationctore vendorObj = new VendorInformationctore();

            vendorObj.saveVendorsInformation(vendorsObj);



            MessageBox.Show("Information save Suxcesfully");
        }