Ejemplo n.º 1
0
        public bool Delete(Jasa p)
        {
            bool isSuccess = false;

            // conn.Open();
            try
            {
                string       sql = "DELETE FROM jasa_service  WHERE ID_JASA_SERVICE=@ID";
                MySqlCommand cmd = new MySqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@ID", p.ID);


                conn.Open();
                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
Ejemplo n.º 2
0
        public bool Insert(Jasa p)
        {
            bool isSuccess = false;

            conn.Open();
            try
            {
                string       sql = "INSERT INTO jasa_service(ID_JASA_SERVICE,NAMA_JASA,HARGA_JASA) VALUES(@ID,@NAMA,@HARGA)";
                MySqlCommand cmd = new MySqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@ID", p.ID);
                cmd.Parameters.AddWithValue("@NAMA", p.Name);
                cmd.Parameters.AddWithValue("@HARGA", p.biaya);

                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
Ejemplo n.º 3
0
        public bool Update(Jasa p)
        {
            bool isSuccess = false;

            conn.Open();
            try
            {
                string       sql = "UPDATE jasa_service SET NAMA_JASA=@NAMA,HARGA_JASA=@HARGA WHERE ID_JASA_SERVICE=@ID  ";
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@ID", p.ID);
                cmd.Parameters.AddWithValue("@NAMA", p.Name);
                cmd.Parameters.AddWithValue("@HARGA", p.biaya);


                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }