Ejemplo n.º 1
0
        public void Insert(Faculty faculty)
        {
            try
            {
                SqlConnection con = DataBaseConnection("open");
                SqlCommand sqlcommand;
                string databaseCommand = " INSERT INTO faculty (name) values (" + "'" + faculty.Name + "')";
                sqlcommand = new SqlCommand(databaseCommand, con);
                sqlcommand.ExecuteNonQuery();
                sqlcommand.Dispose();
                DataBaseConnection("close");
            }
            catch (SqlException sqlException)
            {
                Console.WriteLine("Database error:" + sqlException.ToString());

            }
        }
Ejemplo n.º 2
0
 protected void btn_guardar_Click(object sender, EventArgs e)
 {
     FacultyBusiness fb = new FacultyBusiness();
     Faculty f = new Faculty(txb_name.Text);
     fb.Insert(f);
 }
Ejemplo n.º 3
0
        public void Update(Faculty faculty)
        {
            SqlConnection con = DataBaseConnection("open");
            try
            {
                SqlCommand cmdIns = new SqlCommand("UPDATE Reservation SET Name=@Name", con);
                cmdIns.Parameters.Add("@Name", faculty.Name);

                cmdIns.ExecuteNonQuery();
                cmdIns.Dispose();
                cmdIns = null;
            }
            catch (SqlException ex)
            {
                throw new Exception(ex.ToString(), ex);
            }
            finally
            {
                DataBaseConnection("close");
            }
        }
Ejemplo n.º 4
0
 public void Update(Faculty faculty)
 {
     facultyData.Update(faculty);
 }
Ejemplo n.º 5
0
 public void Insert(Faculty faculty)
 {
     facultyData.Insert(faculty);
 }